call_openai_chat | R Documentation |
Sends messages to the OpenAI Chat Completions API and returns the assistant content. Temperature is not sent; models run with API defaults.
call_openai_chat(messages, model)
messages |
List of messages (each a list with 'role' and 'content'). |
model |
OpenAI model to use. |
Character string with assistant reply, or NULL on unexpected response.
## Not run:
msgs <- list(
list(role = "system", content = "You are concise."),
list(role = "user", content = "What does httr do?")
)
call_openai_chat(messages = msgs, model = "gpt-5-mini")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.