chat | R Documentation |
chat Class
chat Class
openaistream::openai
-> chat
create()
Creates a model response for the given chat conversation.
chat$create(messages, model, stream = F, n = 1, num = 2, verbosity = 0, ...)
messages
list Required. A list of messages comprising the conversation so far.
model
character Required. The model to use for generating chat completions.
stream
logical. Whether to stream back partial progress. If set, tokens will be sent as data-only server-sent events as they become available.
n
integer. How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep n as 1 to minimize costs. NOTE: The parameter sometimes fails to work when 'num' is not assigned a value, and the reason for this is currently unclear. When failure occurs, try assigning any integer greater than 0 to the 'num' parameter.
num
The num parameter controls the number of text entries returned by a stream in one go. Note that this is different from the n parameter, which specifies the number of results returned. For detailed information on the n parameter, please refer to OpenAI's API documentation.
verbosity
numeric. Verbosity level for the API call(0:no output;1:show headers; 2:show headers and bodies;3: show headers, bodies, and curl status messages.).
...
Additional parameters as required by the OpenAI API.For example:max_tokens;n;stop;temperature......
Returns a chat completion object, or a streamed sequence of chat completion chunk objects if the request is streamed.
clone()
The objects of this class are cloneable with this method.
chat$clone(deep = FALSE)
deep
Whether to make a deep clone.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.