initialize_messages {TheOpenAIR} | R Documentation |
Initialize a new messages object for OpenAI API chat completions
Description
This function initializes a new messages object as a template for messages sent to the OpenAI API https://api.openai.com/v1/chat/completions endpoint. By default, the template contains a single message from the system to the user with the initial content "You are a helpful assistant.", but you can customize the content by specifying a different value for the "initial_system_content" parameter.
Usage
initialize_messages(
initial_role = "system",
initial_content = "You are a helpful assistant."
)
Arguments
initial_role |
A character string representing the role issueing the initial content (per default: "system") |
initial_content |
A character string representing the initial message from the system |
Value
A data frame containing a single message from the system to the user, with columns for the message role and content.
Author(s)
Ulrich Matter umatter@protonmail.com
Examples
messages <- initialize_messages()
messages_custom <- initialize_messages("Hello! How can I assist you today?")
[Package TheOpenAIR version 0.1.0 Index]