Skip to content

Conversation

@giles17
Copy link
Contributor

@giles17 giles17 commented Jan 23, 2026

Motivation and Context

This PR addresses issue #2567 by migrating AzureOpenAIChatClient and AzureOpenAIResponsesClient to use the Azure OpenAI v1 GA API, eliminating the need for api_version in these clients.

# Before
client = AzureOpenAIResponsesClient(
    endpoint="https://my-resource.openai.azure.com",
    deployment_name="gpt-4o",
    api_key="...",
    api_version="2024-10-21"  # ❌ Remove this
)

# After
client = AzureOpenAIResponsesClient(
    endpoint="https://my-resource.openai.azure.com",
    deployment_name="gpt-4o",
    api_key="..."
)

Note: AzureOpenAIAssistantsClient still requires api_version as Assistants API is not part of the v1 GA release.

Description

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

Copilot AI review requested due to automatic review settings January 23, 2026 17:22
@markwallace-microsoft markwallace-microsoft added documentation Improvements or additions to documentation python labels Jan 23, 2026
@github-actions github-actions bot changed the title [BREAKING] Migrate Azure OpenAI Chat and Responses Clients to v1 GA API Python: [BREAKING] Migrate Azure OpenAI Chat and Responses Clients to v1 GA API Jan 23, 2026
@markwallace-microsoft
Copy link
Member

markwallace-microsoft commented Jan 23, 2026

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
packages/core/agent_framework/azure
   _chat_client.py79494%277, 279, 292–293
   _responses_client.py35294%133, 172
   _shared.py79988%136–137, 223, 226, 242–245, 253
TOTAL17026256184% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
3327 213 💤 0 ❌ 0 🔥 1m 8s ⏱️

Copy link
Contributor

Copilot AI left a 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_version parameter from AzureOpenAIChatClient and AzureOpenAIResponsesClient constructors
  • Replaced AsyncAzureOpenAI with AsyncOpenAI client 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

@giles17 giles17 marked this pull request as draft January 26, 2026 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants