View source: R/chat4R_history.R
chat4R_history | R Documentation |
This function use the chat history with the the specified GPT model, and chat the AI model.
chat4R_history(
history,
api_key = Sys.getenv("OPENAI_API_KEY"),
Model = "gpt-4o-mini",
temperature = 1
)
history |
A list of message objects. Each object should have a 'role' that can be 'system', 'user', or 'assistant', and 'content' which is the content of the message from that role. |
api_key |
A string. Input your OpenAI API key. Defaults to the value of the environment variable "OPENAI_API_KEY". |
Model |
A string. The model to use for the chat completion. Default is "gpt-4o-mini". |
temperature |
The temperature to use for the chat completion. Default is 1. |
Chat History for R
A data frame containing the parsed response from the Web API server.
Satoshi Kume
## Not run:
Sys.setenv(OPENAI_API_KEY = "Your API key")
history <- list(list('role' = 'system', 'content' = 'You are a helpful assistant.'),
list('role' = 'user', 'content' = 'Who won the world series in 2020?'))
chat4R_history(history)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.