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: object

Builds 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.

Parameters:

prompt_attr_history (list[dict[str, Any]]) – The shared prompt-attribute history list.

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:

tuple[str, set[str]]

Classes

class PromptBuilder(prompt_attr_history)[source]

Bases: object

Builds 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.

Parameters:

prompt_attr_history (list[dict[str, Any]]) – The shared prompt-attribute history list.

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:

tuple[str, set[str]]