feat(openai): add Azure OpenAI client support - #482
Conversation
|
No linked issues found. Please link an issue in your pull request description or title. Per our Contributing Guidelines, all PRs must:
You can also use cross-repo references like |
|
Your branch is 1 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
8e8073e to
4b49dc6
Compare
|
Your branch is 2 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
Allow Azure OpenAI clients to initialize with Azure AD token credentials instead of requiring an API key. Document Azure OpenAI usage and cover token-based auth paths in tests.
4b49dc6 to
194a73e
Compare
|
Your branch is 1 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
Description
Fixes #49. Related to #99.
Feature
Adds native Azure OpenAI client initialization to the existing OpenAI provider.
When callers provide Azure OpenAI client kwargs such as
azure_endpoint,api_version,azure_ad_token,azure_ad_token_provider, orazure_deployment,OpenAILanguageModelnow initializesopenai.AzureOpenAIinstead of the standard
openai.OpenAIclient. These Azure-specific kwargs arekept as client configuration and are not forwarded as chat completions request
parameters.
This preserves the existing OpenAI-compatible
base_urlpath when Azure kwargsare not provided. It also allows Azure OpenAI authentication with either an API
key, an Azure AD token, or an Azure AD token provider.
How Has This Been Tested?
Additional local verification: I installed
langextractfrom this PR branch ina downstream sample project and ran an Azure OpenAI extraction smoke check,
verifying a successful Azure OpenAI response with exact text alignment.
Checklist:
Code of conduct.
Contributing
page, and I either signed the Google
Individual CLA
or am covered by my company's
Corporate CLA.
issue(s) and we have agreed upon the general approach.
issue(s) that documentation elsewhere needs updating.
Google's Python Style Guide
and ran
pylintover the affected code.