Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

Migrate AzureOpenAI constructors to OpenAI client

Offen
#269 0 Kommentare 1 Reaktion 1 zugewiesene Person Auf GitHub ansehen

@copilot-swe-agent arbeitet bereits daran.

Seit 23.9.2025.

  • #270 von @copilot-swe-agent — offen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Beschreibung

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,
    )
    
    • AzureOpenAI → OpenAI (or AsyncAzureOpenAI → AsyncOpenAI).
    • azure_endpoint → base_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*\(

Found matches in 2 file(s) with 6 total match(es):

File: evals/generate_ground_truth.py

  • Line 88: openai_client = AzureOpenAI(

  • Line 97: openai_client = AzureOpenAI(

File: src/backend/fastapi_app/openai_clients.py

  • Line 26: openai_chat_client = openai.AsyncAzureOpenAI(

  • Line 41: openai_chat_client = openai.AsyncAzureOpenAI(

  • Line 85: openai_embed_client = openai.AsyncAzureOpenAI(

  • Line 100: openai_embed_client = openai.AsyncAzureOpenAI(

Repository: https://github.com/Azure-Samples/rag-postgres-openai-python


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

Vorherrschende Sprache
Python
Sterne
505
Forks
1.1k
Ø Merge
13 Min.
Gemergte PRs (30 T.)
1

Entwicklungsumgebung

In Codespaces öffnen

Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus Azure-Samples/rag-postgres-openai-python

Alle Issues in Azure-Samples/rag-postgres-openai-python

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.