8000 feat: add Azure OpenAI support to auto_client.py by jxnl · Pull Request #1633 · 567-labs/instructor · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: add Azure OpenAI support to auto_client.py #1633

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 27, 2025

Conversation

jxnl
Copy link
Collaborator
@jxnl jxnl commented Jun 27, 2025

This PR adds Azure OpenAI support to the auto_client.py file, enabling external packages to use the `.from_provider()* method with Azure OpenAI models.

Changes

  • Added azure_openai to supported providers list
  • Implemented Azure OpenAI client creation with environment variable support
  • Added support for azure_openai/model format in from_provider()
  • Updated tests to include azure_openai provider
  • Updated Azure documentation with auto_client usage examples

Usage

import instructor
client = instructor.from_provider("azure_openai/gpt-4o-mini")

Resolves #1622

Generated with Claude Code


Important

Adds Azure OpenAI support to auto_client.py, enabling from_provider() usage with Azure models, and updates tests and documentation.

  • Behavior:
    • Adds azure_openai to supported providers in auto_client.py.
    • Implements Azure OpenAI client creation in from_provider() with environment variable support for api_key and azure_endpoint.
    • Supports azure_openai/model format in from_provider().
  • Documentation:
    • Updates azure.md with examples for using from_provider() with Azure OpenAI.
  • Testing:
    • Updates test_auto_client.py to include azure_openai in provider tests.

This description was created by Ellipsis for 29c85ad. You can customize this summary. It will automatically update as commits are pushed.

- Add azure_openai provider to supported_providers list
- Implement Azure OpenAI client creation with environment variable support
- Support both AZURE_OPENAI_API_KEY and AZURE_OPENAI_ENDPOINT env vars
- Add azure_openai/model format support for from_provider() function
- Update tests to include azure_openai provider
- Update Azure documentation with auto_client usage examples

Resolves #1622

Co-authored-by: Jason Liu <jxnl@users.noreply.github.com>
Copy link
cloudflare-workers-and-pages bot commented Jun 27, 2025

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
instructor 167181d Commit Preview URL Jun 27 2025, 06:10 PM

@github-actions github-actions bot added documentation Improvements or additions to documentation enhancement New feature or request python Pull requests that update python code size:M This PR changes 30-99 lines, ignoring generated files. labels Jun 27, 2025
Copy link
Contributor
@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

Looks good to me! 👍

Reviewed everything up to 29c85ad in 53 seconds. Click for details.
  • Reviewed 139 lines of code in 3 files
  • Skipped 0 files when reviewing.
  • Skipped posting 4 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. docs/integrations/azure.md:55
  • Draft comment:
    Excellent and clear examples for using Azure OpenAI with the auto_client. The sync and async code samples are instructive.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 85% None
2. instructor/auto_client.py:129
  • Draft comment:
    Consider extracting the default API version ('2024-02-01') as a constant to avoid magic strings and improve maintainability.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 85% None
3. instructor/auto_client.py:129
  • Draft comment:
    A brief inline comment explaining the retrieval of environment variables (api_key, azure_endpoint) for Azure OpenAI could improve readability.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 85% None
4. tests/test_auto_client.py:24
  • Draft comment:
    Azure OpenAI ('azure_openai/gpt-4o-mini') is correctly added to the list of providers. Ensure that CI is configured to skip or supply Azure credentials to avoid false test failures.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 85% None

Workflow ID: wflow_wM4jjb5Dm2Zz3FPL

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@jxnl jxnl merged commit cac233a into main Jun 27, 2025
15 of 16 checks passed
@jxnl jxnl deleted the claude/issue-1622-20250620_171733 branch June 27, 2025 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request python Pull requests that update python code size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Azure OpenAI models to auto_client.py
1 participant
0