-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Python: [BREAKING] Migrate Azure OpenAI Chat and Responses Clients to v1 GA API #3416
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
base: main
Are you sure you want to change the base?
Conversation
Python Test Coverage Report •
Python Unit Test Overview
|
||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR migrates Azure OpenAI Chat and Responses clients from using the Azure-specific OpenAI SDK to the standard v1 GA API, eliminating the need for the api_version parameter. This is a breaking change that simplifies the API and aligns with Azure OpenAI's GA offering.
Changes:
- Removed
api_versionparameter fromAzureOpenAIChatClientandAzureOpenAIResponsesClientconstructors - Replaced
AsyncAzureOpenAIwithAsyncOpenAIclient for Chat and Responses - Added automatic v1 API path construction for standard Azure OpenAI endpoints
- Updated all samples and documentation to reflect the API changes
- Migrated authentication to use standard OpenAI client patterns
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| python/packages/core/agent_framework/azure/_shared.py | Core changes: Added _construct_v1_base_url helper, updated AzureOpenAIConfigMixin to use AsyncOpenAI and construct v1 API URLs automatically |
| python/packages/core/agent_framework/azure/_chat_client.py | Removed api_version parameter, updated type hints from AsyncAzureOpenAI to AsyncOpenAI, updated docstrings |
| python/packages/core/agent_framework/azure/_responses_client.py | Removed api_version parameter, updated type hints from AsyncAzureOpenAI to AsyncOpenAI, removed temporary v1 URL hack, updated docstrings |
| python/packages/core/tests/azure/test_azure_chat_client.py | Updated tests to use AsyncOpenAI instead of AsyncAzureOpenAI, removed assertions for api_version in serialization tests |
| python/packages/core/tests/azure/test_azure_responses_client.py | Added tests for _check_model_presence method |
| python/packages/core/tests/azure/conftest.py | Updated test endpoint to use standard Azure OpenAI domain pattern |
| python/samples/getting_started/agents/azure_openai/README.md | Updated documentation to clarify api_version is only for Assistants client |
| python/samples/getting_started/multimodal_input/README.md | Added note about v1 API not requiring api_version |
| python/samples/getting_started/devui/in_memory_mode.py | Updated to use new parameter names (endpoint and deployment_name instead of azure_endpoint and model_id) |
| python/samples/getting_started/devui/azure_responses_agent/agent.py | Removed api_version parameter from client initialization |
| python/samples/getting_started/agents/azure_openai/azure_responses_client_with_local_mcp.py | Updated comments to remove api_version references |
| python/samples/getting_started/agents/azure_openai/azure_responses_client_with_hosted_mcp.py | Updated to use to_function_approval_response instead of deprecated create_response method |
| python/samples/getting_started/agents/azure_openai/azure_responses_client_with_file_search.py | Updated to use Content.from_hosted_vector_store instead of HostedVectorStoreContent |
| python/samples/getting_started/agents/azure_openai/azure_responses_client_with_explicit_settings.py | Added print statement for better output clarity |
| python/samples/getting_started/agents/azure_openai/azure_responses_client_image_analysis.py | Updated to use Content.from_text and Content.from_uri factory methods, changed image URL |
| python/samples/getting_started/agents/azure_openai/azure_chat_client_with_explicit_settings.py | Added print statement for better output clarity |
Motivation and Context
This PR addresses issue #2567 by migrating
AzureOpenAIChatClientandAzureOpenAIResponsesClientto use the Azure OpenAI v1 GA API, eliminating the need forapi_versionin these clients.Note: AzureOpenAIAssistantsClient still requires api_version as Assistants API is not part of the v1 GA release.
Description
Contribution Checklist