-1
---------------------------------------------------------------------------

AuthenticationError                       Traceback (most recent call last)
\<ipython-input-38-579a3aebb84c\> in \<cell line: 1\>()
\----\> 1 llms = llm.predict("hi!")
2 print(llm)
3 c_llm = chat_model.predict("hi!")
4 print(c_llm)

18 frames
/usr/local/lib/python3.10/dist-packages/openai/api_requestor.py in \_interpret_response_line(self, rbody, rcode, rheaders, stream)
763         stream_error = stream and "error" in resp.data
764         if stream_error or not 200 \<= rcode \< 300:
\--\> 765             raise self.handle_error_response(
766                 rbody, rcode, resp.data, rheaders, stream_error=stream_error
767             )

AuthenticationError: Incorrect API key provided: OPENAI_A\*\*\_KEY. You can find your API key at https://platform.openai.com/account/api-keys.

I have tried this but it is not working. My Open API key is correct but it is generating error. If anyone have idea how to solve this error.

llms = llm.predict("hi!")
print(llm)
c_llm = chat_model.predict("hi!")
print(c_llm)
  • 1
    You should share a snippet showing how you provide the key – opeonikute Aug 28 '23 at 11:48
  • IIRC, OpenAI keys start with `sk-` and yours appears to be `OPENAI_A\*\*\_KEY`. That's not a valid key. Make sure you're actually providing a variable instead of string or use environment variables and `os.environ` for the best security practices. – 5px Aug 28 '23 at 11:49

0 Answers0