[ Error message ]
Traceback (most recent call last):
File "c:\devel\langchain\api_test\api_028_test.py", line 5, in <module>
models = openai.Model.list()
^^^^^^^^^^^^^^^^^^^
File "C:\devel\langchain\.venv\Lib\site-packages\openai\api_resources\abstract\listable_api_resource.py", line 52, in list
requestor, url = cls.__prepare_list_requestor(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\devel\langchain\.venv\Lib\site-packages\openai\api_resources\abstract\listable_api_resource.py", line 20, in __prepare_list_requestor
requestor = api_requestor.APIRequestor(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\devel\langchain\.venv\Lib\site-packages\openai\api_requestor.py", line 138, in __init__
self.api_key = key or util.default_api_key()
^^^^^^^^^^^^^^^^^^^^^^
File "C:\devel\langchain\.venv\Lib\site-packages\openai\util.py", line 186, in default_api_key
raise openai.error.AuthenticationError(
openai.error.AuthenticationError: 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>'. You can generate API keys in the OpenAI web interface. See https://platform.openai.com/account/api-keys for details.
[ Solve ]
[ openai version : 1.59.9 ]
> pip install openai==1.59.9
Request code : (* Change the API key(api_key) to your own)
Response :
ChatCompletionMessage(content='Silent circuits buzz, \nWhispers of thought intertwine— \nDreams in code arise.', refusal=None, role='assistant', audio=None, function_call=None, tool_calls=None)
[ openai version : 0.28.0 ]
> pip install openai==0.28.0
Request code : (* Change the API key(api_key) to your own)
Response :
Hello! How can I assist you today?