ben-aaron188 / rgpt3

Making requests from R to the GPT models
GNU General Public License v3.0
101 stars 16 forks source link

Keep getting Error code: 401 #12

Closed gunawebs closed 1 year ago

gunawebs commented 1 year ago

When I do

> gpt3_authenticate("./access_key.txt")

I get two rows in the output

[1] "Will use --> sk-xxxxxx for authentication."
[2] "Will use -->  for authentication."   

And when I try and run the chatgpt function, I get this error:

Request completed with error. Code: 401, message: You didn't provide an API key. You need to provide your API key in an Authorization header using Bearer auth (i.e. Authorization: Bearer YOUR_KEY), or as the password field (with blank username) if you're accessing the API from your browser and are prompted for a username and password. You can obtain an API key from https://platform.openai.com/account/api-keys.

I think somewhere it is setting the key to empty string.

gunawebs commented 1 year ago

Also, BTW, I am not able to run this

> gpt3_endsession()
Error in gpt3_endsession() : could not find function "gpt3_endsession"
gunawebs commented 1 year ago

Also unable to run this

> check_apikey_form()
Error in check_apikey_form() : 
  could not find function "check_apikey_form"
gunawebs commented 1 year ago

Note: Once I restarted rstudio a few times, it worked

ben-aaron188 commented 1 year ago

OK thanks.