Class PromptCondition
-
- All Implemented Interfaces:
-
com.embabel.agent.core.Condition,com.embabel.agent.core.ConditionMetadata,com.embabel.agent.core.Operation,com.embabel.common.core.types.HasInfoString,com.embabel.common.core.types.Named
public final class PromptCondition implements Condition
Prompt an LLM to evaluate a condition. Evaluating prompt conditions is expensive, so we need to consider efficiency here.
-
-
Constructor Summary
Constructors Constructor Description PromptCondition(String name, Function1<OperationContext, String> prompt, LlmCall llm)
-
Method Summary
Modifier and Type Method Description DoublegetCost()This is as expensive as it can get StringgetName()final Function1<OperationContext, String>getPrompt()final LlmCallgetLlm()ConditionDeterminationevaluate(OperationContext context)Evaluate the condition in the context of the process. -
-
Constructor Detail
-
PromptCondition
PromptCondition(String name, Function1<OperationContext, String> prompt, LlmCall llm)
- Parameters:
name- name of the conditionprompt- the prompt to evaluate.
-
-
Method Detail
-
getPrompt
final Function1<OperationContext, String> getPrompt()
-
evaluate
ConditionDetermination evaluate(OperationContext context)
Evaluate the condition in the context of the process. This may be expensive, so the cost is provided. The infrastructure will attempt to call this function infrequently on expensive conditions, so there's no urgency to optimize here.
-
-
-
-