Migrate from deprecated AzureOpenAI to standard OpenAI client constructors#340
Draft
Migrate from deprecated AzureOpenAI to standard OpenAI client constructors#340
Conversation
Co-authored-by: pamelafox <297042+pamelafox@users.noreply.github.com>
Co-authored-by: pamelafox <297042+pamelafox@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Migrate AzureOpenAI constructors to OpenAI client
Migrate from deprecated AzureOpenAI to standard OpenAI client constructors
Sep 23, 2025
pamelafox
reviewed
Sep 24, 2025
| !infra/**/main.parameters.json | ||
|
|
||
| # Pip artifacts and temporary files | ||
| =* |
Collaborator
There was a problem hiding this comment.
Remove this from gitignore, no changes to gitignore should be needed
pamelafox
requested changes
Sep 24, 2025
| azure_ad_token_provider=token_provider, | ||
| # Create the Asynchronous OpenAI client | ||
| bp.openai_client = AsyncOpenAI( | ||
| base_url=os.getenv("AZURE_OPENAI_ENDPOINT"), |
Collaborator
There was a problem hiding this comment.
This URL needs "/openai/v1" at the end
| # This file is autogenerated by pip-compile with Python 3.12 | ||
| # by the following command: | ||
| # | ||
| # pip-compile --output-file=src/requirements.txt src/pyproject.toml |
Collaborator
There was a problem hiding this comment.
This change shouldnt be needed, as long as you run the file from inside the src folder
Collaborator
There was a problem hiding this comment.
Add an AGENTS.md that shows how to run pip-compile from inside the src folder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR migrates the repository from the deprecated Azure-specific OpenAI client constructors (
AsyncAzureOpenAI) to the standard OpenAI client constructors (AsyncOpenAI) to maintain compatibility with current and future OpenAI SDK versions.Changes Made
Core Application Updates
src/quartapp/chat.py:AsyncAzureOpenAItoAsyncOpenAIazure_endpoint→base_urlazure_ad_token_provider→api_keyapi_versionparameter entirelyInfrastructure Updates
infra/main.bicep: RemovedopenAiApiVersionparameter and related outputinfra/aca.bicep: RemovedAZURE_OPENAI_API_VERSIONenvironment variable.env.sample: RemovedAZURE_OPENAI_API_VERSIONconfigurationDependencies
src/pyproject.toml: Changed OpenAI requirement from"openai"to"openai>=1.108.1"src/requirements.txt: Now uses OpenAI 1.109.0Testing
tests/test_app.py: Modified test assertion to checkapi_keyproperty instead of the deprecated_azure_ad_token_providerMigration Example
Before:
After:
Validation
This migration ensures the codebase uses the supported OpenAI SDK API surface while maintaining full compatibility with Azure OpenAI services.
Fixes #339.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.