EmergenceAI / Agent-E

Agent driven automation starting with the web. Discord: https://discord.gg/wgNfmFuqJF
MIT License
345 stars 46 forks source link

Add support for configuring AutoGen's `api_type` and `api_version` in order to support Azure models #63

Closed cedricvidal closed 14 hours ago

cedricvidal commented 3 days ago

This PR adds the possibility to configure AutoGen's api_type and api_version through the following environment variables:

This allows to configure an Azure AI Model, for example GPT-4o with the following .env:

AUTOGEN_MODEL_NAME=gpt-4o
AUTOGEN_MODEL_API_KEY=<REPLACE_ME>
AUTOGEN_MODEL_BASE_URL=https://<REPLACE_ME>.openai.azure.com
AUTOGEN_MODEL_API_TYPE=azure
AUTOGEN_MODEL_API_VERSION=2023-03-15-preview

This PR also updates the README to explain how to use models on Azure.

Note

This PR was developed and tested successfully against a26b870. I stumbled upon #62 while trying to merge this PR on master so I haven't been able to test this PR on master.

teaxio commented 2 days ago

changed your base branch to dev, will call that out explicitly in the readme

teaxio commented 14 hours ago

@cedricvidal We added prompt improvement as the way that gpt4 responds on azure is quite a bit different from openai’s. I do see timeouts like this quite a bit: INFO:openai._base_client:Retrying request to /chat/completions in 40.000000 seconds

@deepak-akkil merged some changes to your PR so we can see it work end to end. It eventually works once the timeouts are overcome, but it leaves much to be desired. Let's collaborate on trying to figure out what's going on so that the timeouts are not happening. This is something between autogen and azure for sure.