agentlab.llm.prompt_templates
Functions
|
Classes
|
Base class for prompt templates. |
- class agentlab.llm.prompt_templates.PromptTemplate(system: str, human: str, ai: str, prompt_end: str = '')
Bases:
objectBase class for prompt templates.
Defines a standard interface for prompt templates, ensuring that they contain the required fields for the CustomLLMChatbot.
- construct_prompt(messages: List[dict]) str
Constructs a prompt from a list of messages.
- Parameters:
messages (List[BaseMessage]) – The list of messages to be formatted.
- Returns:
The constructed prompt.
- Return type:
- Raises:
ValueError – If any element in the list is not of type BaseMessage.
- format_message(message: dict) str
Formats a given message based on its type.
- Parameters:
message (dict) – The message to be formatted.
- Returns:
The formatted message.
- Return type:
- Raises:
ValueError – If the message type is not supported.
- agentlab.llm.prompt_templates.get_prompt_template(model_name)