openai
OpenAITextGenerationTask
Bases: TextGenerationTask
A TextGenerationTask
for any chat-completion OpenAI model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
system_prompt |
str
|
the system prompt to be used. Defaults to |
required |
principles |
Dict[str, List[str]]
|
the principles to be used for the system prompt.
Defaults to |
required |
principles_distribution |
Union[Dict[str, float], Literal[balanced], None]
|
the
distribution of principles to be used for the system prompt. Defaults to |
required |
Source code in src/distilabel/tasks/text_generation/openai.py
generate_prompt(input)
Generates a prompt for any chat-completion OpenAI model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
input |
str
|
the input to be used for the prompt. |
required |
Returns:
Type | Description |
---|---|
List[ChatCompletion]
|
List[ChatCompletion]: the generated prompt. |
Examples:
>>> from distilabel.tasks.text_generation import OpenAITextGenerationTask
>>> task = OpenAITextGenerationTask(system_prompt="You are a helpful assistant.")
>>> task.generate_prompt("What are the first 5 Fibonacci numbers?")
[
{'role': 'system', 'content': 'You are a helpful assistant.'},
{'role': 'user', 'content': 'What are the first 5 Fibonacci numbers?'},
]