%c% | R Documentation |
This function sends a message to the ChatGPT API using the 'chat()' function and returns the response in the specified output format.
message %c% output
message |
A character string containing the message to be sent to the ChatGPT API. |
output |
A character string specifying the output format. Valid options are "message_to_console", "message", or "response_object". Default is "message_to_console". |
Depending on the value of the 'output' argument, this function returns one of the following: * "message_to_console": a message containing the response text to be printed to the console. * "message": the response text as a character vector. * "response_object": the full response object from the ChatGPT API.
Ulrich Matter umatter@protonmail.com
## Not run:
# Send a message and assign the response to a variable
response_var <- "Hello, ChatGPT!" %c% "message"
# Print the response
print(response_var)
# Send a message and return the full response object
response_obj <- "Hello, ChatGPT!" %c% "response_object"
# Print the response
print(response_obj)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.