regenerate | R Documentation |
This function removes the last response in a chatlog, generates a new response based on the updated chatlog, and updates the chatlog accordingly. The output can be displayed as a message in the console, returned as a message, or returned as a response object.
regenerate(chatlog_id = ".__CURRENTCHAT__", output = "message_to_console")
chatlog_id |
A character string specifying the ID of the chatlog (default: '.__CURRENTCHAT__') |
output |
A character string specifying the output format. Options are 'message_to_console', 'message', or 'response_object' (default: 'message_to_console') |
If output is 'message_to_console', the function returns NULL and prints the message to the console. If output is 'message', the function returns a character string containing the message. If output is 'response_object', the function returns the full response object.
## Not run:
# Start a new chat and save the chatlog ID
chatlog_id <- chat("Hello, how are you?")
# Regenerate the last response in the chat and display it in the console
regenerate(chatlog_id)
# Regenerate the last response in the chat and return it as a message
message <- regenerate(chatlog_id, output = "message")
print(message)
# Regenerate the last response in the chat and return it as a response object
response_object <- regenerate(chatlog_id, output = "response_object")
print(response_object)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.