agentlab.llm.prompt_templates

Functions

get_prompt_template(model_name)

Classes

PromptTemplate(system, human, ai[, prompt_end])

Base class for prompt templates.

class agentlab.llm.prompt_templates.PromptTemplate(system: str, human: str, ai: str, prompt_end: str = '')

Bases: object

Base class for prompt templates.

Defines a standard interface for prompt templates, ensuring that they contain the required fields for the CustomLLMChatbot.

ai: str
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:

str

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:

str

Raises:

ValueError – If the message type is not supported.

human: str
prompt_end: str = ''
system: str
agentlab.llm.prompt_templates.get_prompt_template(model_name)