Spaces:
Sleeping
Sleeping
File size: 531 Bytes
266d7bc |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
from openai.types.chat import ChatCompletionSystemMessageParam, ChatCompletionUserMessageParam
def build_messages(
prompt: str,
) -> list[ChatCompletionSystemMessageParam | ChatCompletionUserMessageParam]:
"""Build a list of messages for the OpenAI chat API.
Args:
prompt (str): The user prompt.
Returns:
list[ChatCompletionSystemMessageParam | ChatCompletionUserMessageParam]: A list of messages.
"""
return [
ChatCompletionUserMessageParam(role="user", content=prompt),
]
|