jcrodriguez1989/chatgpt

No output

mbjohnsonmn opened this issue · 7 comments

Thanks for your work on this package. I've installed the addin to RStudio per the instructions. The addin menu and functions are availble, but I'm not getting any response back from chatGPT.

chatgpt_output

Any suggestions?

Hi @mbjohnsonmn !
I received the same feedback from another {chatgpt} user, but I am not being able to reproduce this bug.
Sometimes, ChatGPT has high demand and stops working. However, it is interesting that it doesn't even return a message in the API saying so. Could you try running the same function at different times of the day?

Also, could you try this code, and let me know if you get any further error messages (it is the backend code of how the package works)?

library("httr")
openai_api_key <- Sys.getenv("OPENAI_API_KEY")
prompt <- paste0(
  'Create a full testthat file, with test cases for the following R code: "squared_numbers <- function(numbers) {\n  numbers ^ 2\n}"'
)
params <- list(
  model = Sys.getenv("OPENAI_MODEL", "text-davinci-003"),
  max_tokens = as.numeric(Sys.getenv("OPENAI_MAX_TOKENS", 256)),
  temperature = as.numeric(Sys.getenv("OPENAI_TEMPERATURE", 0.7)),
  top_p = as.numeric(Sys.getenv("OPENAI_TOP_P", 1)),
  frequency_penalty = as.numeric(Sys.getenv("OPENAI_FREQUENCY_PENALTY", 0)),
  presence_penalty = as.numeric(Sys.getenv("OPENAI_PRESENCE_PENALTY", 0))
)
content(POST(
  "https://api.openai.com/v1/completions",
  add_headers("Authorization" = paste("Bearer", openai_api_key)),
  content_type_json(),
  body = jsonlite::toJSON(c(params, list(prompt = prompt)), auto_unbox = TRUE)
))

Best,

Thanks for this. Here is the result of the code above:

$error
$error$message
[1] "You exceeded your current quota, please check your plan and billing details."

$error$type
[1] "insufficient_quota"

$error$param
NULL

$error$code
NULL

Thank you very much!!
I will be able to output error messages when happen :)
So, it seems it is not returning output, because of issues with your chatgpt account.

Oh no, you can use any type of ChatGPT account.
But it seems that your account reached the free tokens limit.
I guess you are not able to use https://chat.openai.com/ either.