Skip to content

Implement standardized provider interface and registry #1535

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

Closed
wants to merge 1 commit into from

Conversation

jxnl
Copy link
Collaborator

@jxnl jxnl commented May 16, 2025

Addresses #1534 by implementing a standardized provider interface and registry system.

Changes

  • Created providers package with base module and registry
  • Implemented ProviderProtocol and ProviderBase classes
  • Created sample implementation for OpenAI provider
  • Added documentation for provider system in docs/concepts/providers.md

This is the first step toward reorganizing the provider architecture as outlined in #1532 and #1533.

Testing

This PR only introduces the interface and registry without modifying existing functionality, so no extensive testing is required. The actual provider implementations will be added in subsequent PRs.

Documentation

Added a new documentation page that explains the provider system and how to implement new providers.


Important

Introduces a standardized provider interface and registry system with a sample OpenAI provider implementation and accompanying documentation.

  • Provider Interface and Registry:
    • Introduces ProviderProtocol and ProviderBase in base.py for standardized provider interfaces.
    • Implements provider registry in __init__.py with register_provider, get_provider, and list_providers functions.
  • OpenAI Provider:
    • Adds OpenAIProvider in oai_provider.py as a sample implementation using the new interface.
  • Documentation:
    • Adds providers.md to explain the provider system and guide new provider implementations.
    • Updates mkdocs.yml to include the new documentation page.

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

Addresses issue #1534 by creating:
- Provider protocol and base class implementation
- Provider registry system for registration and discovery
- Sample implementation for OpenAI provider
- Documentation for provider system

This is the first step toward reorganizing the provider architecture.
@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 May 16, 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 852648e in 1 minute and 8 seconds. Click for details.
  • Reviewed 494 lines of code in 5 files
  • Skipped 0 files when reviewing.
  • Skipped posting 5 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/concepts/providers.md:125
  • Draft comment:
    The validate_mode example is clear. Consider adding a brief note that provider implementations may customize error handling for unsupported modes or include additional logging to assist debugging.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 85% None
2. instructor/providers/__init__.py:25
  • Draft comment:
    Consider checking for duplicate provider registrations in the register_provider decorator to avoid silent overwrites if a provider name is registered more than once.
  • Reason this comment was not posted:
    Confidence changes required: 66% <= threshold 85% None
3. instructor/providers/base.py:83
  • Draft comment:
    The capabilities() method uses hasattr to detect features, which might pick up inherited abstract methods. Consider explicitly verifying that the subclass properly overrides these methods to ensure accurate capability detection.
  • Reason this comment was not posted:
    Confidence changes required: 66% <= threshold 85% None
4. instructor/providers/oai_provider.py:110
  • Draft comment:
    The create() and create_stream() methods currently raise NotImplementedError as placeholders. Adding explicit TODO comments to mark these areas can guide future development, especially regarding handling of non-JSON modes (e.g., function calling) and streaming.
  • Reason this comment was not posted:
    Confidence changes required: 66% <= threshold 85% None
5. mkdocs.yml:258
  • Draft comment:
    The mkdocs configuration has been updated to include the new Providers documentation page. Great job ensuring that the documentation stays in sync with the code changes!
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 85% None

Workflow ID: wflow_NOgwxqoavQTlqrAG

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

Copy link

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 852648e Visit preview May 16 2025, 05:53 PM

@jxnl jxnl closed this May 16, 2025
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.

1 participant