microsoft / autogen

A programming framework for agentic AI 🤖
https://microsoft.github.io/autogen/
Creative Commons Attribution 4.0 International
32.38k stars 4.72k forks source link

[Bug]: openai.NotFoundError: Error code: 404 - {'error': {'code': 'DeploymentNotFound', 'message': 'The API deployment for this resource does not exist. If you created the deployment within the last 5 minutes, please wait a moment and try again.'}} #3328

Open tyler-suard-parker opened 2 months ago

tyler-suard-parker commented 2 months ago

Describe the bug

AutoGen was working just fine. Then, we switched to a new Azure OpenAI deployment. Now, I am getting this error but only when using AutoGen. When I use the OpenAI client directly, I do not get the error.

openai.NotFoundError: Error code: 404 - {'error': {'code': 'DeploymentNotFound', 'message': 'The API deployment for this resource does not exist. If you created the deployment within the last 5 minutes, please wait a moment and try again.'}}

Steps to reproduce

This code works:

client = AzureOpenAI( azure_endpoint="https://myendpoint.openai.azure.com/", api_key="aldsjfasdf", api_version="2024-02-01", )

response = client.chat.completions.create( model="gpt-4",
messages=[ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Does Azure OpenAI support customer managed keys?"}, { "role": "assistant", "content": "Yes, customer managed keys are supported by Azure OpenAI.", }, {"role": "user", "content": "Do other Azure AI services support this too?"}, ], )

print(response.choices[0].message.content)

Model Used

gpt-4

Expected Behavior

Autogen should work

Screenshots and logs

No response

Additional Information

No response

LittleLittleCloud commented 2 months ago

Here is a config that I use to connect to azure oai.

{
        "base_url": "https://xxx-openai-canada-east.openai.azure.com/",
        "api_key": "apikey",
        "api_version": "2024-05-01-preview",
        "model": "<deploy_name>",
        "api_type": "azure",
    }