Skip to content

Prompt formatter

Defines a prompt formatter class used in Gen AI applications.

Authors

Henry Wicaksono (henry.wicaksono@gdplabs.id)

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(prompt)

Formats the prompt as a string.

Parameters:

Name Type Description Default
prompt MultimodalPrompt

The prompt to be formatted as a string.

required

Returns:

Name Type Description
str str

The formatted prompt as a string.