core.prompt_builder
Prompt assembly with history resolution and variable interpolation.
Prompt assembly with history resolution and variable interpolation.
- class PromptBuilder(prompt_attr_history)[source]
Bases:
objectBuilds final prompts with history context and variable interpolation.
Reads from the shared prompt-attribute history to resolve
{{prompt_name.response}}patterns and assemble conversation context blocks.- build_prompt(prompt, history=None, dependencies=None, strict=False)[source]
Build the final prompt with history and variable interpolation.
- Parameters:
prompt (str) – The prompt template (may contain {{}} interpolation patterns)
history (list[str] | None) – List of prompt names to include in conversation history
dependencies (Any | None) – Additional dependencies (unused but kept for compatibility)
strict (bool) – If True, raise ValueError on unknown {{name.response}} references
- Returns:
Tuple of (final_prompt, set_of_interpolated_prompt_names)
- Return type:
Classes
- class PromptBuilder(prompt_attr_history)[source]
Bases:
objectBuilds final prompts with history context and variable interpolation.
Reads from the shared prompt-attribute history to resolve
{{prompt_name.response}}patterns and assemble conversation context blocks.- build_prompt(prompt, history=None, dependencies=None, strict=False)[source]
Build the final prompt with history and variable interpolation.
- Parameters:
prompt (str) – The prompt template (may contain {{}} interpolation patterns)
history (list[str] | None) – List of prompt names to include in conversation history
dependencies (Any | None) – Additional dependencies (unused but kept for compatibility)
strict (bool) – If True, raise ValueError on unknown {{name.response}} references
- Returns:
Tuple of (final_prompt, set_of_interpolated_prompt_names)
- Return type: