Migrate AzureOpenAI constructors to OpenAI client
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
-
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(orAsyncAzureOpenAI→AsyncOpenAI).azure_endpoint→base_url.azure_ad_token_provider(or similar Azure credential helpers) →api_key.
-
Remove
api_versionusage- Delete the
api_version=...argument from client construction. - Remove any
AZURE_OPENAI_VERSIONenvironment variables and references (including
.env, application settings, andinfra/main.bicepor other Bicep files).
- Delete the
-
Update package requirements
- Ensure
requirements.txtorpyproject.tomldeclaresopenai>=1.108.1.
This is the first version whereOpenAI/AsyncOpenAIfully replace the
Azure-specific constructors.
- Ensure
Follow-up Checklist
- All Python client instantiations use
OpenAI/AsyncOpenAI. - No
api_versionargument 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
Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus Azure-Samples/rag-postgres-openai-python
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 35/100
Azure-Samples/rag-postgres-openai-python#288 · 1 Kommentar ·
-
Azure-Samples/rag-postgres-openai-python#273 · 1 zugewiesene Person ·
-
Remove the pipeline: variables section from azure.yamlEvtl. vergeben @copilot-swe-agent hat das vor 396 Tagen übernommen. Offen
Azure-Samples/rag-postgres-openai-python#261 · 1 Reaktion · 1 zugewiesene Person ·
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 25/100
-
Question: Why are you installing `postgres-client` and `xdg-utils` in the backend docker image?Evtl. vergeben @copilot-swe-agent hat das vor 420 Tagen übernommen. Offen
Azure-Samples/rag-postgres-openai-python#250 · 4 Kommentare · 1 Reaktion · 1 zugewiesene Person ·
Alle Issues in Azure-Samples/rag-postgres-openai-python
Ähnliche Issues
-
[Bug]: Streamed /v1/chat/completions sends unredacted agent error text (keys) in the final chunkEvtl. vergeben @rodricksz4h5 hat das heute übernommen. Offenarea/streaming comp/gateway P2 type/security
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
NousResearch/hermes-agent#138245 ·
Maintainer antworten meist innerhalb von 1 Tag
-
[oblt-aw][autodoc] Update user onboarding guide for mandatory trigger CODEOWNERS stepEvtl. vergeben @github-actions hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 66/100
Maintainer antworten meist innerhalb von 1 Tag
-
correction metadata
Schwierigkeit 2/5 Unter einer Stunde Anfängerfreundlichkeit 68/100
acl-org/acl-anthology#10378 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
cloudtrail_multi_region_enabled_logging_management_events fails when the advanced event selector has a custom nameEvtl. vergeben @12YYCCYY16 hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
prowler-cloud/prowler#13033 ·
Maintainer antworten meist innerhalb von 1 Tag
-
enhancement
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 88/100
graygarbage/HermesKey#23 ·