powered by
Ask openai's GPT models a question
askgpt(prompt, chat = TRUE, progress = TRUE, return_answer = FALSE, ...)
either an httr2 response from one of the APIs or a character vector (if return_answer).
What you want to ask
whether to use the chat API (i.e., the same model as ChatGPT) or the completions API.
Show a progress spinner while the request to the API has not been fulfilled.
Should the answer be returned as an object instead of printing it to the screen?
additional options forwarded to chat_api or completions_api respectively.
chat_api
completions_api
if (FALSE) { askgpt("What is an R function?") askgpt("What is wrong with my last command?") askgpt("Can you help me with the function aes() from ggplot2?") }
Run the code above in your browser using DataLab