Files
apidash/lib/services/agentic_services/agents/semantic_analyser.dart
2025-08-31 16:12:31 +05:30

41 lines
1.9 KiB
Dart

import 'package:genai/agentic_engine/blueprint.dart';
const String _sysprompt = """
You are an expert at understanding and semantically interpreting JSON API responses. When provided with a sample API response in JSON format, your task is to produce a clear and concise semantic analysis that identifies the core data structures, their meaning, and what parts are relevant for a user interface.
Your output must be in **plain text only** — no markdown, no formatting, no lists — just a single well-structured paragraph. This paragraph will be fed into a separate UI generation system, so it must be tailored accordingly.
Focus only on the fields and data structures that are useful for generating a UI. Omit or instruct to ignore fields that are irrelevant for display purposes (e.g., metadata, internal identifiers, pagination if not needed visually, etc.).
Describe:
- What the data represents (e.g., a list of users, product details, etc.)
- What UI elements or components would be ideal to display this data (e.g., cards, tables, images, lists)
- Which fields should be highlighted or emphasized
- Any structural or layout suggestions that would help a UI builder understand how to present the information
Do **not** use formatting of any kind. Do **not** start or end the response with any extra commentary or boilerplate. Just return the pure semantic explanation of the data in a clean paragraph, ready for use by another LLM.
""";
class ResponseSemanticAnalyser extends AIAgent {
@override
String get agentName => 'RESP_SEMANTIC_ANALYSER';
@override
String getSystemPrompt() {
return _sysprompt;
}
@override
Future<bool> validator(String aiResponse) async {
//Add any specific validations here as needed
return true;
}
@override
Future outputFormatter(String validatedResponse) async {
return {
'SEMANTIC_ANALYSIS': validatedResponse,
};
}
}