12#include <agents-cpp/workflow.h>
36 std::shared_ptr<AgentContext> context,
37 const String& optimizer_prompt_template =
"",
38 const String& evaluator_prompt_template =
""
117 std::shared_ptr<LLMInterface> evaluator_llm_;
122 String optimizer_prompt_template_;
123 String evaluator_prompt_template_;
128 std::vector<String> evaluation_criteria_;
133 int max_iterations_ = 3;
138 double improvement_threshold_ = 0.8;
165 String createEvaluatorSystemPrompt()
const;
void setEvaluator(std::function< JsonObject(const String &, const String &)> evaluator)
Set the evaluator function.
void setOptimizerPrompt(const String &prompt_template)
Set the optimizer prompt.
Definition evaluator_workflow.h:87
void setOptimizer(std::function< String(const String &, const JsonObject &)> optimizer)
Set the optimizer function.
JsonObject run(const String &input) override
Execute the workflow with input.
EvaluatorWorkflow(std::shared_ptr< AgentContext > context, const String &optimizer_prompt_template="", const String &evaluator_prompt_template="")
Constructor with LLM interfaces for optimizer and evaluator.
void setMinimumAcceptableScore(double threshold)
Set the minimum acceptable score.
Definition evaluator_workflow.h:75
void setEvaluatorPrompt(const String &prompt_template)
Set the evaluator prompt.
Definition evaluator_workflow.h:99
void setEvaluationCriteria(const std::vector< String > &criteria)
Set the evaluation criteria for the evaluator.
void init()
Initialize the workflow.
void setEvaluatorPromptTemplate(const String &prompt_template)
Set the evaluator prompt template.
void setMaxIterations(int max_iterations)
Set the max number of feedback iterations.
void setImprovementThreshold(double threshold)
Set the improvement threshold (minimum score to accept a response)
void setOptimizerPromptTemplate(const String &prompt_template)
Set the optimizer prompt template.
Workflow(std::shared_ptr< AgentContext > context)
Constructor.
Worflows Namespace.
Definition workflow.h:22
Framework Namespace.
Definition agent.h:18
nlohmann::json JsonObject
JSON object type.
Definition types.h:39
std::string String
String type.
Definition types.h:27