You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
when i run the scripts code, I alwys got the following:No API key provided. You can set your API key in code using 'openai.api_key = <API-KEY>', or you can set the environment variable OPENAI_API_KEY=<API-KEY>). If your API key is stored in a file, you can point the openai module at it with 'openai.api_key_path = <PATH>'.
#29
Open
xiaohai-AI opened this issue
Jul 3, 2024
· 2 comments
The text was updated successfully, but these errors were encountered:
xiaohai-AI
changed the title
when i run the scripts code, I alwys got the following:
when i run the scripts code, I alwys got the following:No API key provided. You can set your API key in code using 'openai.api_key = <API-KEY>', or you can set the environment variable OPENAI_API_KEY=<API-KEY>). If your API key is stored in a file, you can point the openai module at it with 'openai.api_key_path = <PATH>'.
Jul 3, 2024
I encountered the same issue and found the reason behind it. In the LLM.py file, the script retrieves the API key using the following line:
openai.api_key=os.getenv("OPENAI_KEY")
This means the script is designed to use the OPENAI_KEY environment variable, not the commonly used OPENAI_API_KEY. If you have set the API key as OPENAI_API_KEY, it won't work with the current script configuration.
To resolve this, you can either:
Set your API key using the OPENAI_KEY environment variable, or
Modify the script to retrieve the key using os.getenv("OPENAI_API_KEY").
No description provided.
The text was updated successfully, but these errors were encountered: