prompt
ChatCompletion
Prompt
dataclass
A dataclass
representing a Prompt
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
system_prompt |
str
|
the system prompt. |
required |
formatted_prompt |
str
|
the formatted prompt. |
required |
Examples:
>>> from distilabel.tasks.prompt import Prompt
>>> prompt = Prompt(
... system_prompt="You are a helpful assistant.",
... formatted_prompt="What are the first 5 Fibonacci numbers?",
... )
Source code in src/distilabel/tasks/prompt.py
format_as(format)
Formats the prompt as the specified format.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
format |
SupportedFormats
|
the format to be used for the prompt. Available formats are
|
required |
Returns:
Type | Description |
---|---|
Union[str, List[ChatCompletion]]
|
Union[str, List[ChatCompletion]]: the formatted prompt. |
Raises:
Type | Description |
---|---|
ValueError
|
if the specified format is not supported. |
Examples:
>>> from distilabel.tasks.prompt import Prompt
>>> prompt = Prompt(
... system_prompt="You are a helpful assistant.",
... formatted_prompt="What are the first 5 Fibonacci numbers?",
... )
>>> prompt.format_as("default")
'You are a helpful assistant. What are the first 5 Fibonacci numbers?'