Prompt Models
src.prompt_builders.prompt_models.PromptPayload
Bases: BaseModel
Container for prompt generation input data.
This class encapsulates the necessary data for generating prompts, including conversation history and available tools.
Attributes:
Name | Type | Description |
---|---|---|
conversation_history |
List[TextChatMessage]
|
The complete conversation history as a chronological list of messages between user and assistant. |
tool_definitions |
Optional[List[Tool]]
|
List of tools that are available for the model to use in its responses. Defaults to None if no tools are available. |
Source code in src/prompt_builders/prompt_models.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
|
src.prompt_builders.prompt_models.PromptBuilderOutput
Bases: BaseModel
Output container for prompt builder results.
Stores either a text prompt or a list of chat messages, providing a unified interface for different types of prompt outputs.
Attributes:
Name | Type | Description |
---|---|---|
text_prompt |
Optional[str]
|
A single string containing the generated prompt. Mutually exclusive with chat_messages. |
chat_messages |
Optional[List[TextChatMessage]]
|
A list of chat messages representing the prompt. Mutually exclusive with text_prompt. |
Source code in src/prompt_builders/prompt_models.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
|
get_output()
Retrieve the prompt output in its appropriate format.
Returns either the text prompt or chat messages, depending on which was set during initialization.
Returns:
Type | Description |
---|---|
Union[str, List[TextChatMessage]]
|
Union[str, List[TextChatMessage]]: Either a string containing the text prompt or a list of chat messages. |
Raises:
Type | Description |
---|---|
ValueError
|
If neither text_prompt nor chat_messages was set. |
Source code in src/prompt_builders/prompt_models.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
|