core.response_executor
Orchestration helper for prompt execution with conditions and structured output.
Orchestration helper for prompt execution with conditions and structured output.
- class ResponseExecutor(prompt_builder, condition_evaluator_fn, results_by_name_fn)[source]
Bases:
objectOrchestrates prompt resolution, condition evaluation, and LLM dispatch.
Constructed once in
FFAI.__init__with callables bound to the FFAI instance. Theexecutemethod handles the synchronous path used bygenerate_response;execute_asynchandles the async path used byexecute_graph.- Parameters:
prompt_builder (Callable[..., tuple[str, set[str]]]) – Bound
PromptBuilder.build_promptmethod.condition_evaluator_fn (Callable[[str, dict[str, dict[str, Any]]], tuple[bool, str | None, str | None]]) – Callable taking
(condition_str, results_by_name)and returning(should_execute, error, trace).results_by_name_fn (Callable[[], dict[str, dict[str, Any]]]) – Callable returning
dict[str, dict[str, Any]]mapping prompt names to their results.
- execute(generate_fn, prompt, prompt_name, options, default_model, skip_condition=False)[source]
Synchronous execution path (used by
generate_response).- Parameters:
- Return type:
Classes
- class ResponseExecutor(prompt_builder, condition_evaluator_fn, results_by_name_fn)[source]
Bases:
objectOrchestrates prompt resolution, condition evaluation, and LLM dispatch.
Constructed once in
FFAI.__init__with callables bound to the FFAI instance. Theexecutemethod handles the synchronous path used bygenerate_response;execute_asynchandles the async path used byexecute_graph.- Parameters:
prompt_builder (Callable[..., tuple[str, set[str]]]) – Bound
PromptBuilder.build_promptmethod.condition_evaluator_fn (Callable[[str, dict[str, dict[str, Any]]], tuple[bool, str | None, str | None]]) – Callable taking
(condition_str, results_by_name)and returning(should_execute, error, trace).results_by_name_fn (Callable[[], dict[str, dict[str, Any]]]) – Callable returning
dict[str, dict[str, Any]]mapping prompt names to their results.
- execute(generate_fn, prompt, prompt_name, options, default_model, skip_condition=False)[source]
Synchronous execution path (used by
generate_response).- Parameters:
- Return type: