calute.core.prompt_template#
Prompt template structures for Calute agents.
Provides PromptSection (an enum of standard prompt sections) and
PromptTemplate (a configurable dataclass for structuring agent
prompts with ordered, labelled sections).
- class calute.core.prompt_template.PromptSection(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
Bases:
EnumEnumeration of different sections in a structured prompt.
This enum defines the standard sections that can be included in a structured prompt template, allowing for consistent prompt organization across different agents and use cases.
- SYSTEM#
System-level instructions and configuration.
- PERSONA#
Agent personality and role definition.
- RULES#
Behavioral rules and constraints for the agent.
- FUNCTIONS#
Available function/tool definitions.
- TOOLS#
Tool usage instructions and format specifications.
- EXAMPLES#
Example interactions for few-shot learning.
- CONTEXT#
Contextual information and variables.
- HISTORY#
Conversation history from previous turns.
- PROMPT#
The actual user prompt/query.
Example
>>> template = PromptTemplate( ... sections={PromptSection.SYSTEM: "INSTRUCTIONS:"}, ... section_order=[PromptSection.SYSTEM, PromptSection.PROMPT] ... )
- CONTEXT = 'context'#
- EXAMPLES = 'examples'#
- FUNCTIONS = 'functions'#
- HISTORY = 'history'#
- PERSONA = 'persona'#
- PROMPT = 'prompt'#
- RULES = 'rules'#
- SYSTEM = 'system'#
- TOOLS = 'tools'#
- class calute.core.prompt_template.PromptTemplate(sections: dict[calute.core.prompt_template.PromptSection, str] | None = None, section_order: list[calute.core.prompt_template.PromptSection] | None = None)[source]#
Bases:
objectConfigurable template for structuring agent prompts.
This class provides a flexible way to structure prompts with different sections that can be customized or reordered based on requirements.
- sections#
Dictionary mapping PromptSection enums to their header strings.
- Type
dict[calute.core.prompt_template.PromptSection, str] | None
- section_order#
List defining the order in which sections appear in the prompt.
- Type
list[calute.core.prompt_template.PromptSection] | None
Example
>>> template = PromptTemplate( ... sections={PromptSection.SYSTEM: "INSTRUCTIONS:"}, ... section_order=[PromptSection.SYSTEM, PromptSection.PROMPT] ... )
- section_order: list[calute.core.prompt_template.PromptSection] | None = None#
- sections: dict[calute.core.prompt_template.PromptSection, str] | None = None#