chat4R_history {chatAI4R} | R Documentation |
chat4R_history: Use chat history for interacting with GPT.
Description
This function use the chat history with the the specified GPT model, and chat the AI model.
Usage
chat4R_history(
history,
api_key = Sys.getenv("OPENAI_API_KEY"),
Model = "gpt-3.5-turbo-16k",
temperature = 1
)
Arguments
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-3.5-turbo-16k". |
temperature |
The temperature to use for the chat completion. Default is 1. |
Details
Chat History for R
Value
A data frame containing the parsed response from the Web API server.
Author(s)
Satoshi Kume
Examples
## 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)
[Package chatAI4R version 0.2.10 Index]