Prompt formatter
Defines a prompt formatter class used in Gen AI applications.
References
NONE
BasePromptFormatter(content_separator='\n')
Bases: ABC
A base class for prompt formatters used in Gen AI applications.
The prompt formatter class is used to format a prompt into a string with specific formatting.
Attributes:
| Name | Type | Description |
|---|---|---|
content_separator |
str
|
The separator to be used between the string in a single message. |
Initializes a new instance of the BasePromptFormatter class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
content_separator |
str
|
The separator to be used between the string in a single message. Defaults to "\n". |
'\n'
|
format(messages)
Formats the prompt as a string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
messages |
list[Message]
|
The messages to be formatted as a string. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The formatted messages as a string. |