Skip to content
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

Getting issue in OpenAI key #8

Open
hasnainhakim opened this issue Nov 4, 2024 · 1 comment
Open

Getting issue in OpenAI key #8

hasnainhakim opened this issue Nov 4, 2024 · 1 comment

Comments

@hasnainhakim
Copy link

Getting Below error

I have added the apikey to env file, change the name from .env.example to .env still same error

C:\Users\hhakim\Desktop\Hasnain_Personal\jobber-main>python -u -m jobber_fsm
Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in run_code
File "C:\Users\Desktop\jobber-main\jobber_fsm_main
.py", line 21, in
asyncio.run(main())
File "C:\Users\AppData\Local\Programs\Python\Python311\Lib\asyncio\runners.py", line 190, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "C:\Users\AppData\Local\Programs\Python\Python311\Lib\asyncio\runners.py", line 118, in run
return self.loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 653, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "C:\Users\Desktop\jobber-main\jobber_fsm_main
.py", line 12, in main
State.PLAN: PlannerAgent(),
^^^^^^^^^^^^^^
File "C:\Users\Desktop\jobber-main\jobber_fsm\core\agent\planner_agent.py", line 15, in init
super().init(
File "C:\Users\Desktop\jobber-main\jobber_fsm\core\agent\base.py", line 41, in init
self.client = wrap_openai(openai.Client())
^^^^^^^^^^^^^^^
File "C:\Users\hhakim\AppData\Local\Programs\Python\Python311\Lib\site-packages\openai_client.py", line 105, in init
raise OpenAIError(
openai.OpenAIError: The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable

@Amoghk04
Copy link

run the following commands, if using Linux

export OPENAI_API_KEY="your_api_key"
source ~/.bashrc

If using windows, then run this in the powershell
[System.Environment]::SetEnvironmentVariable("OPENAI_API_KEY", "your_api_key", "User")
hope this works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants