Autogen Studio 2 - api_key is not present in llm_config or OPENAI_API_KEY env variable for agent ** primary_assistant

626 views Asked by At

Running autogen studio 2, I have my model setup and tested successful - when I run the travel demo I get the following error:

api_key is not present in llm_config or OPENAI_API_KEY env variable for agent ** primary_assistant**. Update your workflow to provide an api_key to use the LLM.

I have tested the model successfully and the agent is pointing to the correct model.

enter image description here

enter image description here

2

There are 2 answers

1
mwoertler On BEST ANSWER

I am using a conda environment and was able to resolve the issue by setting my env variable and deactivating / reactivating my environment. I used the command below to set my API key:

conda env config vars set OPENAI_API_KEY=value

conda deactivate envName conda activate envName

Hope this helps!

0
Yash Thakker On

For Python Venv:

Deactivate

  1. source pyautogen/bin/activate

  2. cmd+shift+p Select Interpreter

ensure correct interpreter is selected (use the virtual environment one)

  1. export OPENAI_API_KEY=sk-

  2. autogenstudio ui --port 8081

Ensure all previous windows are closed.