ContextStrLLMCondition

ContextStrLLMCondition(context_str: ContextStr, **data: Any)

Context variable-based LLM condition.
This condition uses a ContextStr object with context variable placeholders that will be substituted before being evaluated by an LLM.
Initialize with a context string as a positional parameter.

Parameters:
NameDescription
context_strType: ContextStr
**dataType: Any

Class Attributes

context_str



model_config



Instance Methods

get_prompt

get_prompt(
    self,
    agent: ConversableAgent,
    messages: list[dict[str, Any]]
) -> str

Return the prompt with context variables substituted.

Parameters:
NameDescription
agentThe agent evaluating the condition (provides context variables)

Type: ConversableAgent
messagesThe conversation history (not used)

Type: list[dict[str, typing.Any]]
Returns:
TypeDescription
strThe prompt with context variables substituted