autogen
autogen copied to clipboard
[Bug]: Local Models try to connect to OpenAi
Describe the bug
After setting up Agents and workflow with local endpoints. Getting this error message 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
when running in PlayGround.
Steps to reproduce
- Install then run
Ollama
with mistral model Mistral - Install then run
litellm
and upgradegunicorn
- Endpoint for
litellm
will behttp://0.0.0.0:8000/
- Create New agent named
mistral
and base url to behttp://0.0.0.0:8000/
give it any system prompt, then save - Create New Workflow, change the model's base urls to
http://0.0.0.0:8000/
for both the Sender and Receiver in the Workflow. Then Save - Go to Playground, create new chat with newly create workflow. Say hi, then error message will appear in app and console screen will display full error log
Expected Behavior
When I try hello there
I expect a response, not an error message from the application.
Screenshots and logs
Traceback (most recent call last): File "/home/bear/.pyenv/versions/3.11.6/lib/python3.11/site-packages/autogenstudio/web/app.py", line 68, in add_message response_message: Message = chatmanager.chat( ^^^^^^^^^^^^^^^^^ File "/home/bear/.pyenv/versions/3.11.6/lib/python3.11/site-packages/autogenstudio/chatmanager.py", line 22, in chat flow = AutoGenWorkFlowManager(config=flow_config, history=history, work_dir=scratch_dir) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/bear/.pyenv/versions/3.11.6/lib/python3.11/site-packages/autogenstudio/workflowmanager.py", line 35, in init self.sender = self.load(config.sender) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/bear/.pyenv/versions/3.11.6/lib/python3.11/site-packages/autogenstudio/workflowmanager.py", line 156, in load agent = self.load_agent_config(agent_spec.config, agent_spec.type) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/bear/.pyenv/versions/3.11.6/lib/python3.11/site-packages/autogenstudio/workflowmanager.py", line 175, in load_agent_config agent = autogen.UserProxyAgent(**agent_config.dict()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/bear/.pyenv/versions/3.11.6/lib/python3.11/site-packages/autogen/agentchat/user_proxy_agent.py", line 83, in init super().init( File "/home/bear/.pyenv/versions/3.11.6/lib/python3.11/site-packages/autogen/agentchat/conversable_agent.py", line 126, in init self.client = OpenAIWrapper(**self.llm_config) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/bear/.pyenv/versions/3.11.6/lib/python3.11/site-packages/autogen/oai/client.py", line 105, in init self._clients = [self._client(extra_kwargs, openai_config)] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/bear/.pyenv/versions/3. 11.6/lib/python3.11/site-packages/autogen/oai/client.py", line 162, in _client client = OpenAI(**openai_config) ^^^^^^^^^^^^^^^^^^^^^^^ File "/home/bear/.pyenv/versions/3.11.6/lib/python3.11/site-packages/openai/_client.py", line 97, 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
Additional Information
AutoGen Version: autogenstudio-0.0.25a0 Operating System: Windows and Linux Python Version: 3.11