Skip to content

Migrate AzureOpenAI constructors to OpenAI client #65

@pamelafox

Description

@pamelafox

Issue Description

This repository is using the Azure-specific client constructors from the OpenAI SDK:
AzureOpenAI or AsyncAzureOpenAI.

These constructors are deprecated in the latest SDKs. Migrate to the standard
OpenAI / AsyncOpenAI constructors instead so the code stays compatible with the
current API surface.

Required Updates

  1. Replace constructors

    # Before
    client = openai.AzureOpenAI(
        api_version=os.environ["AZURE_OPENAI_VERSION"],
        azure_endpoint=os.environ["AZURE_OPENAI_ENDPOINT"],
        azure_ad_token_provider=token_provider,
    )
    
    # After
    client = openai.OpenAI(
        base_url=os.environ["AZURE_OPENAI_ENDPOINT"],
        api_key=token_provider,
    )
    • AzureOpenAIOpenAI (or AsyncAzureOpenAIAsyncOpenAI).
    • azure_endpointbase_url.
    • azure_ad_token_provider (or similar Azure credential helpers) → api_key.
  2. Remove api_version usage

    • Delete the api_version=... argument from client construction.
    • Remove any AZURE_OPENAI_VERSION environment variables and references (including
      .env, application settings, and infra/main.bicep or other Bicep files).
  3. Update package requirements

    • Ensure requirements.txt or pyproject.toml declares openai>=1.108.1.
      This is the first version where OpenAI / AsyncOpenAI fully replace the
      Azure-specific constructors.

Follow-up Checklist

  • All Python client instantiations use OpenAI / AsyncOpenAI.
  • No api_version argument or related environment variables remain.
  • Dependency metadata requires openai>=1.108.1.

Addressing these items will keep the repository aligned with the supported OpenAI SDK usage.

Details

Pattern: \b(?:AzureOpenAI|AsyncAzureOpenAI)\s*\(

File: src/quartapp/chat.py

Found matches:

Line 65:

bp.openai_client = openai.AsyncAzureOpenAI(

Repository: https://github.com/Azure-Samples/openai-chat-vision-quickstart


This issue was automatically created by the GitHub Repo Maintainer Agent.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions