ask_chatgpt | R Documentation |
Opens a browser with OpenAI's ChatGPT interface and your query. This function allows you to ask questions, get code help, or search for information using ChatGPT.
ask_chatgpt(query = geterrmessage(), prompt = NULL)
query |
Contents of string to send to AI Service. Default is the last error message. |
prompt |
Optional prompt prefix to add before your query to guide how the AI Service responds. If NULL, uses the service-specific default prompt option. |
The generated search URL or an empty string.
Other AI assistants:
ask_bing_copilot()
,
ask_claude()
,
ask_grok()
,
ask_meta_ai()
,
ask_mistral()
,
ask_perplexity()
# Basic query
ask_chatgpt("How to join two dataframes in R?")
# Using a custom prompt
ask_chatgpt("Error: object 'mtcrs' not found",
prompt = "Debug this error step by step:")
# Searching the last error
## Not run:
tryCatch(
median("not a number"),
error = function(e) ask_chatgpt()
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.