-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
openai.error.AuthenticationError: <empty message> #464
Comments
Hey @talperetz, |
I am still getting the same error, even with this version. I am actually trying to use |
I am getting the same error when trying to use the SQL Database Agent. This is my code,
I am running the latest versions of Python, langchain and openai. |
LangChain uses the OpenAI Python SDK so that's the main issue. I had as described problems with several libraries. |
same error here with |
does anyone managed to workaround this? |
not work even downgraded to 0.26 |
In our case, we generated another token, and that fixed the issue |
Create and use another api key fixed the problem for me. |
update: it just works for a few prompts and then the bug appears again |
Not working ! |
Hi! Does anyone have a request ID we could use to look into this issue? |
Actually, that might not help. Could we instead ask for more debugging information? The Authentication Error should have more details. Something like this as a wrapper around your code might do the trick:
|
i had this problem. When i checked my API key on platform.openai.com, it had disappeared. I know i havent deleted it, but suddenly it had been lost. So i just created a new API key and continued using without problems. Hope this will also solve you problems guys )) |
I am having the same issue, even though I was running the same code some weeks prior to this without any problems. It seems that there is something wrong with the API key. So like others have suggested here, I did delete my old one and created a new one, and even made sure that it was updated correctly. I run the same code, but still get the same error and in addition to that, the new API key displays that it was "never" used so far.
|
never mind, I just saw that for me my 3-month free trial just expired. I didn't know about this.
So, somehow the api key is still invalid and it cannot be that it was exposed in a public repo, because I just created it. |
this also can happen when you API-key is on public. Such as a github public repository |
can you try the solution in this order? 1- open .env file (in project root directory) & add OPENAI_API_KEY 2- implement this lines in your python file:
3- call langchain method (implicitly openai method) I saw that LangChain read the wrong key from os's environment value |
Ty, I will try it out. However, could you explain step 3 a bit more? Sorry, I never worked with langchain before, so not sure, how you mean this. How do I call the langchain method implicitly? What I'm doing atm is, I am saving my api key as an os environment variable, like you said and then simply read it from there and then call the openai.ChatCompletion.create-method. |
@stanstan86 I responded that way because the person who asked the question mentioned using LangChain. You don't have to use LangChain. |
@mehmetkoca thank you! Your solution works for me! I still don't know, why my old code stopped working, but I'm just glad, it works now:) |
@grumpyp can you check if the environment variable Just given your description of the issue, I'm unable to reproduce it. The code openai.api_key = OPENAI_KEY or os.getenv("OPENAI_API_KEY")
# where texts can be a list of strings like
texts = ["test", "foo"]
for i in texts:
response = openai.Embedding.create(
input=i,
model="text-embedding-ada-002"
)
embeddings = response['data'][0]['embedding'] Works for me and I have my API key under the |
Hi, I guess the issue is a bit trickier. I usually had the key's stored in my IDE-settings. Right now it actually also does work for me using my posted example. |
|
Hello @haomengqi00709, did you read my comment here? If you don't have multiple API keys clobbering one another, can you provide more precise steps for reproducing this issue? |
THank you so much for your help! I was previously using getenv from envar ( I saw Andrew was using it I think), it stopped working as soon as I tried to post it on github repo. I tried to update the new API in envar or rename another envar in the system, they both don't work... I have no clue what's going on lol. |
that's what I am saying. I have no clue about your infrastructure but is it possible that several locations sometimes have this issue? |
When this shows up again, can you wrap your code in this
|
Hi @jhallard there you go.
Another hint: The exception falls here: the same key works here tho ;)
It's a good start for you to investigate 🍀 |
Possible cause (we have other problems so it's not clear that this is the solution): comment out any |
@grumpyp I'm able to reproduce this on the For some reason, only for the embeddings endpoint are we returning an empty error message instead of the one that we expect. We expect this error message
But we get this one
However, they're the same underlying error. I'll continue to look into this, but for anyone who finds this thread:
And seeing what the response is |
Hi @jhallard, I just tested it again... and it worked... I have no idea what happened, I didn't change anything lol, thanks for your help! |
I just ran into this problem out of the blue on GAE even though it was working locally, turns out on GAE env vars from secrets get single quotes places around them for some reason, and openai wasn't handling that. So the following fixed it for me
Hopefully this helps someone else |
I just ran into this problem today. |
@iiSmiley Can you tell me how to use openai key without organization? |
how you overcome this? |
because me also issuing the same error |
@Amar1701 can you try a different endpoint besides embeddings, for instance, completions? E.g.
And let me know what the output is? |
@jhallard thankyou! I'll try this one! Btw could you please text me through WhatsApp! Bcoz I'm facing other issues too ! My WhatsApp number: 8072046960 |
I FACE THIS ISSUE AFTER WRITING THE CODE YOU SENT C:\Users\AMARNATH.C\OneDrive\Documents\newChatbot\chatbotSRM>python manage.py runserver System check identified no issues (0 silenced). [21/Jun/2023 12:00:45] "GET / HTTP/1.1" 200 4438 |
This problem has been bothering me for a week. Finally, I found out that when you pass your openai-api-key to a public space(such as github), your openai-api-key on the OpenAI website(https://platform.openai.com/account/api-keys) will be automatically deleted, and then you will have this error report. So you must regenerate a key and ensure that it is not transferred to the public space. |
Describe the bug
Since yesterday 24.05.2023 around your outage I am facing this errors:
I tried several approaches, thought LangChain would be the problem, thought a vectorstore is it, but now I think it must be something with the API as I rebuilt with several options and it all leads to the same error.
To Reproduce
Code snippets
No response
OS
macOS, m1-chip
Python version
Python 3.10.9
Library version
openai==0.27.7
The text was updated successfully, but these errors were encountered: