where do I declare the OPENAI_API_KEY #818
Replies: 3 comments
-
For stuff like this I encourage you to copy/paste the error into GPT4 and ask it for help. It's quite informative. |
Beta Was this translation helpful? Give feedback.
-
Thank you however GPT4 is up to 2021And this git is a few weeks old.I know where to declare a key, however, in the case of this app, there does not seem to be an environment, variables filePatrick EganBroker, Royal Lepage Locations North, Brokerage 519 599 2136 | 416 400 ***@***.*** 127 Arthur Street, Thornbury, Ontario. N0H 2P0On Apr 29, 2023, at 7:50 AM, qrdlgit ***@***.***> wrote:
For stuff like this I encourage you to copy/paste the error into GPT4 and ask it for help. It's quite informative.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
I wouldn't worry too much about the cutoff date. It's rarely an issue and it will be able to give you appropriate information for all technical problems you encounter, especially in this case. eg: The error you're encountering is an AuthenticationError, which means the script is unable to find a valid API key for OpenAI. To fix this issue, you can set your API key in one of the following ways: Set the API key directly in your code: Set the API key as an environment variable: For Unix/Linux/MacOS: bash cmd powershell Set the API key using a file: python Make sure you have a valid API key for OpenAI, which you can obtain from the OpenAI web interface (https://onboard.openai.com/) or by contacting [email protected]. |
Beta Was this translation helpful? Give feedback.
-
it mentions it in the readme.md . however, cannot locate it anywhere else in the format that I am used to.
I tried to declare it in the environment variables as well in several different formats but still getting the error.
Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in run_code
File "D:\Python\Scripts\oaieval.exe_main.py", line 7, in
File "D:\Python\Lib\site-packages\evals\cli\oaieval.py", line 164, in main
run(args)
File "D:\Python\Lib\site-packages\evals\cli\oaieval.py", line 141, in run
result = eval.run(recorder)
^^^^^^^^^^^^^^^^^^
File "D:\Python\Lib\site-packages\evals\elsuite\basic\match.py", line 53, in run
self.eval_all_samples(recorder, samples)
File "D:\Python\Lib\site-packages\evals\eval.py", line 155, in eval_all_samples
idx_and_result = list(tqdm(iter, total=len(work_items), disable=not show_progress))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python\Lib\site-packages\tqdm\std.py", line 1178, in iter
for obj in iterable:
File "D:\Python\Lib\multiprocessing\pool.py", line 873, in next
raise value
File "D:\Python\Lib\multiprocessing\pool.py", line 125, in worker
result = (True, func(*args, **kwds))
^^^^^^^^^^^^^^^^^^^
File "D:\Python\Lib\site-packages\evals\eval.py", line 143, in worker_thread
result = future.result(timeout=timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python\Lib\concurrent\futures_base.py", line 456, in result
return self.__get_result()
^^^^^^^^^^^^^^^^^^^
File "D:\Python\Lib\concurrent\futures_base.py", line 401, in __get_result
raise self._exception
File "D:\Python\Lib\concurrent\futures\thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python\Lib\site-packages\evals\eval.py", line 133, in eval_sample
return idx, self.eval_sample(sample, rng)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python\Lib\site-packages\evals\elsuite\basic\match.py", line 39, in eval_sample
result = self.completion_fn(
^^^^^^^^^^^^^^^^^^^
File "D:\Python\Lib\site-packages\evals\completion_fns\openai.py", line 130, in call
result = openai_chat_completion_create_retrying(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python\Lib\site-packages\backoff_sync.py", line 105, in retry
ret = target(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python\Lib\site-packages\evals\utils\api_utils.py", line 50, in openai_chat_completion_create_retrying
result = openai.ChatCompletion.create(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python\Lib\site-packages\openai\api_resources\chat_completion.py", line 25, in create
return super().create(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python\Lib\site-packages\openai\api_resources\abstract\engine_api_resource.py", line 149, in create
) = cls.__prepare_create_request(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python\Lib\site-packages\openai\api_resources\abstract\engine_api_resource.py", line 106, in __prepare_create_request
requestor = api_requestor.APIRequestor(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python\Lib\site-packages\openai\api_requestor.py", line 130, in init
self.api_key = key or util.default_api_key()
^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python\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 = ', or you can set the environment variable O
PENAI_API_KEY=). If your API key is stored in a file, you can point the openai module at it with 'openai.api_key_path = '. You can generate API keys in the OpenAI web interface. See https://onboard.openai.com for details, or email [email protected] if you have any questions.
Beta Was this translation helpful? Give feedback.
All reactions