View source: R/service-openai_api_calls.R
openai_create_chat_completion | R Documentation |
Generate text completions using OpenAI's API for Chat
openai_create_chat_completion(
prompt = "<|endoftext|>",
model = getOption("gptstudio.model"),
openai_api_key = Sys.getenv("OPENAI_API_KEY"),
task = "chat/completions"
)
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 |
task |
The task that specifies the API url to use, defaults to "completions" and "chat/completions" is required for ChatGPT model. |
A list with the generated completions and other information returned by the API.
## Not run:
openai_create_completion(
model = "text-davinci-002",
prompt = "Hello world!"
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.