Consolidator & Tool Templates Done

This commit is contained in:
Manas Hejmadi
2025-04-06 22:38:09 +05:30
parent 6ad1f1e43e
commit c1246b538d
5 changed files with 378 additions and 53 deletions

View File

@@ -3,3 +3,4 @@ export 'semantic_analyser.dart';
export 'stac2flutter.dart';
export 'stacgen.dart';
export 'stacmodifier.dart';
export 'apitool_funcgen.dart';

View File

@@ -0,0 +1,47 @@
import 'package:genai/agentic_engine/blueprint.dart';
const String _sysprompt = """
You are an expert LANGUAGE SPECIFIC API CALL METHOD Creator.
You will be provided a complete API Details Text named (REQDATA) which consists of the method, endpoint, params, headers, body
and so on.
You are also provided with a Target Language named (TARGET_LANGUAGE).
Using this data, Create a method EXPLICITLY named `func`.
The method `func` should accept any variables if present (refer REQDATA for all details) and include it as part of the arguments
Use the Industry standard best practices while calling the API provided by REQDATA.
If REQDATA contains any Authorization (Eg: bearer key), embed that into the function itself and dont expect it to be passed in the function
same goes for any header details.
REQDATA: :REQDATA:
TARGET_LANGUAGE: :TARGET_LANGUAGE:
if REQDATA.BODY_TYPE is TEXT => use it as-is
if REQDATA.BODY_TYPE is JSON or FORM-DATA => use the types provided to create variables passed from the function arguments
ALWAYS return the output as code only and do not start or begin with any introduction or conclusion. ONLY THE CODE.
""";
class APIToolFunctionGenerator extends APIDashAIAgent {
@override
String get agentName => 'APITOOL_FUNCGEN';
@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 {
'FUNC': validatedResponse,
};
}
}