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

[Bug]: Autogen with Azure OpenAI throws an error #1716

Open
amit-dingare opened this issue Feb 18, 2024 · 3 comments
Open

[Bug]: Autogen with Azure OpenAI throws an error #1716

amit-dingare opened this issue Feb 18, 2024 · 3 comments
Labels
bug Something isn't working studio Related to AutoGen Studio.

Comments

@amit-dingare
Copy link

Describe the bug

Autogenstudio in with Azure OpenAI model is tested successfully. Also, didn't see this error with older version of Pyautogen and autogenstudio. Started seeing this error when versions are upgraded to the latest versions.

Traceback

Traceback (most recent call last):
File "C:\Users\dingarea\AppData\Local\anaconda3\envs\autogenenv\Lib\site-packages\autogenstudio\web\app.py", line 70, in add_message
response_message: Message = chatmanager.chat(
^^^^^^^^^^^^^^^^^
File "C:\Users\dingarea\AppData\Local\anaconda3\envs\autogenenv\Lib\site-packages\autogenstudio\chatmanager.py", line 29, in chat
flow.run(message=f"{message_text}", clear_history=False)
File "C:\Users\dingarea\AppData\Local\anaconda3\envs\autogenenv\Lib\site-packages\autogenstudio\workflowmanager.py", line 219, in run
self.sender.initiate_chat(
File "C:\Users\dingarea\AppData\Local\anaconda3\envs\autogenenv\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 816, in initiate_chat
self.send(self.generate_init_message(**context), recipient, silent=silent)
File "C:\Users\dingarea\AppData\Local\anaconda3\envs\autogenenv\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 516, in send
recipient.receive(message, self, request_reply, silent)
File "C:\Users\dingarea\AppData\Local\anaconda3\envs\autogenenv\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 691, in receive
reply = self.generate_reply(messages=self.chat_messages[sender], sender=sender)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\dingarea\AppData\Local\anaconda3\envs\autogenenv\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 1646, in generate_reply
final, reply = reply_func(self, messages=messages, sender=sender, config=reply_func_tuple["config"])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\dingarea\AppData\Local\anaconda3\envs\autogenenv\Lib\site-packages\autogen\agentchat\groupchat.py", line 547, in run_chat
speaker = groupchat.select_speaker(speaker, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\dingarea\AppData\Local\anaconda3\envs\autogenenv\Lib\site-packages\autogen\agentchat\groupchat.py", line 383, in select_speaker
final, name = selector.generate_oai_reply(messages)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\dingarea\AppData\Local\anaconda3\envs\autogenenv\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 1064, in generate_oai_reply
extracted_response = self._generate_oai_reply_from_client(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\dingarea\AppData\Local\anaconda3\envs\autogenenv\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 1083, in _generate_oai_reply_from_client
response = llm_client.create(
^^^^^^^^^^^^^^^^^^
File "C:\Users\dingarea\AppData\Local\anaconda3\envs\autogenenv\Lib\site-packages\autogen\oai\client.py", line 624, in create
response = client.create(params)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\dingarea\AppData\Local\anaconda3\envs\autogenenv\Lib\site-packages\autogen\oai\client.py", line 278, in create
response = completions.create(**params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\dingarea\AppData\Local\anaconda3\envs\autogenenv\Lib\site-packages\openai_utils_utils.py", line 271, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\dingarea\AppData\Local\anaconda3\envs\autogenenv\Lib\site-packages\openai\resources\chat\completions.py", line 659, in create
return self._post(
^^^^^^^^^^^
File "C:\Users\dingarea\AppData\Local\anaconda3\envs\autogenenv\Lib\site-packages\openai_base_client.py", line 1200, in post
return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\dingarea\AppData\Local\anaconda3\envs\autogenenv\Lib\site-packages\openai_base_client.py", line 889, in request
return self._request(
^^^^^^^^^^^^^^
File "C:\Users\dingarea\AppData\Local\anaconda3\envs\autogenenv\Lib\site-packages\openai_base_client.py", line 980, in _request
raise self._make_status_error_from_response(err.response) from None
openai.AuthenticationError: Error code: 401 - {'statusCode': 401, 'message': 'Unauthorized. Access token is missing, invalid, audience is incorrect (https://cognitiveservices.azure.com), or have expired.'}

Steps to reproduce

No response

Expected Behavior

oai should take Azure OpenAI credentials. Testing of model worked successfully.

image

Screenshots and logs

No response

Additional Information

Current versions:
autogenstudio=0.0.44a0=pypi_0
pyautogen=0.2.14=pypi_0

@amit-dingare amit-dingare added the bug Something isn't working label Feb 18, 2024
@sonichi sonichi added the studio Related to AutoGen Studio. label Feb 18, 2024
@victordibia
Copy link
Collaborator

Hi,

If you have made any changes to your model, you will need to remove the previous version of the model from your agents and add the new model in your workflows.

@amit-dingare
Copy link
Author

Hi,

If you have made any changes to your model, you will need to remove the previous version of the model from your agents and add the new model in your workflows.

Hi, no changes to the model have been made. All I did is update the pyautogen and autogenstudio libraries.

@victordibia
Copy link
Collaborator

victordibia commented Mar 14, 2024

Can you take a screenshot of your model ..
The error suggests an issue with your endpoint token being invalid, not with autogen or autogenstudio.

See this related issue.

openai.AuthenticationError: Error code: 401 - {'statusCode': 401, 'message': 'Unauthorized. Access token is missing, invalid, audience is incorrect (https://cognitiveservices.azure.com/), or have expired.'}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working studio Related to AutoGen Studio.
Projects
None yet
Development

No branches or pull requests

3 participants