Generate text completions using OpenAI's API for Chat
Source:R/service-openai_api_calls.R
openai_create_chat_completion.Rd
Generate text completions using OpenAI's API for Chat
Usage
openai_create_chat_completion(
prompt = "<|endoftext|>",
model = getOption("gptstudio.model"),
openai_api_key = Sys.getenv("OPENAI_API_KEY"),
task = "chat/completions"
)
Arguments
- prompt
The prompt for generating completions
- model
The model to use for generating text
- openai_api_key
The API key for accessing OpenAI's API. By default, the function will try to use the
OPENAI_API_KEY
environment variable.- task
The task that specifies the API url to use, defaults to "completions" and "chat/completions" is required for ChatGPT model.