Start or continue a chat conversation
chat.Rd
This function starts or continues a chat conversation by adding the user's message to the conversation. If the conversation does not exist, a new one will be initiated. The response can be displayed in the console, returned as a character vector, or returned as a full response object from the ChatGPT API.
Arguments
- message
A character string representing the message to be added to the chat conversation.
- chatlog_id
A character string representing the ID of the chat conversation to start or continue. Default is ".__CURRENTCHAT__".
- output
A character string indicating the output format of the response. Default is "message_to_console". Valid options are "message_to_console", "message", or "response_object".
- ...
Additional arguments to pass to the chat_completion() function.
Value
Depending on the value of the 'output' argument, this function returns one of the following: * "message_to_console": a message containing the response text is printed to the console (default). * "message": the response text as a character vector. * "response_object": the full response object from the ChatGPT API.