Migrate AzureOpenAI constructors to OpenAI client
Nadie ha tomado este issue todavía.
Evaluación
Este issue todavía no se ha evaluado.
Descripción
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.
- Lenguaje dominante
- Python
- Estrellas
- 505
- Forks
- 1.1k
- Merge medio
- 3 d 13 h
- PR fusionados (30 d)
- 1
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de Azure-Samples/rag-postgres-openai-python
-
Dificultad 3/5 1-2 días Aptitud para principiantes 35/100
Azure-Samples/rag-postgres-openai-python#288 · 1 comentario ·
-
Azure-Samples/rag-postgres-openai-python#273 · 1 asignado ·
-
Azure-Samples/rag-postgres-openai-python#261 · 1 reacción · 1 asignado ·
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
-
Question: Why are you installing `postgres-client` and `xdg-utils` in the backend docker image? Abierto
Azure-Samples/rag-postgres-openai-python#250 · 4 comentarios · 1 reacción · 1 asignado ·
Todos los issues de Azure-Samples/rag-postgres-openai-python
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
anthropics/skills#1811 · 1 comentario ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
speaches-ai/speaches#678 ·
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
datalayer/mcp-compose#42 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
conda-forge/spacy-feedstock#177 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
UKGovernmentBEIS/inspect_evals#2523 ·