Repository navigation
feat(python-sdk): add per-provider extras and report a missing vendor SDK - #410
Open
czi-fsisenda wants to merge 1 commit into
Open
czi-fsisenda wants to merge 1 commit into
czi-fsisenda wants to merge 1 commit into
Conversation
… SDK Adds the extras `openai`, `anthropic`, `google` and `all`, each installing its provider's SDK. The SDKs stay in the base dependencies for now, so no 1.x install changes; 2.0 will drop them from there (DSCR-2625), leaving the plain install for callers who inject their own `llm_provider`. An evaluator now checks at construction that the SDK of every built-in adapter it will build is installed. It raises a ConfigurationError that names the evaluator and every extra to add, before the key check and any I/O, rather than a bare ImportError from inside the first evaluation. An injected llm_provider needs none. create_provider makes the same check for direct callers. A new test runs every evaluator in a child process where no vendor SDK can be imported. Each one refuses to build its own adapters, runs on an injected provider, and imports no vendor module. A new CI job runs that test with the SDKs actually uninstalled. The README, root README and Python demo now install with the extras. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 31, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This branch has not been deployed
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.
Why
Every Python install brings
openai,anthropicandgoogle-genai, with their version pins, even though 18 of our 19 evaluators call one vendor, and a caller who injects their ownllm_provider(#405) calls none. This is step 1 of the two-PR plan on DSCR-2648 (#412 is the 2.0 draft). #409 widens the version ranges separately, under DSCR-2625. It adds the extras and a clear error without removing anything from the base install, so no 1.x install changes. Users can move to the new install lines before 2.0 requires them.Ticket: DSCR-2648 (split from DSCR-2625). Stacked on #405, which it needs: the new test runs every evaluator on an injected
llm_provider. The base branch moves tomainonce #405 merges.What users see
If a provider's SDK isn't installed (from 2.0, or after an uninstall), construction fails before any I/O, naming every extra that's missing:
Changes
pyproject.toml:openai,anthropic,googleandall, named by theProvidervalues so the error can name the extra directly.dependenciesfor now, so each pin appears in both places until 2.0.devdepends on[all].providers/factory.py:sdk_installed(provider)checks withimportlib.util.find_spec, without importing the SDK.missing_sdk_error(...)builds the message.create_providermakes the same check for direct callers.BaseEvaluator._validate_sdks:model_overrideneeds its own provider's SDK, and an injectedllm_providerneeds none.tests/unit/test_without_vendor_sdks.py:demos/python/requirements.txt([all]) anddocs/local-development.mdare updated.For reviewers
edu-aidt-mintlify-docsneed the same update when this releases. That will be a separate PR there.[all]works against the current 1.1.0 on PyPI. pip only warns about the unknown extra until this releases.Testing
make verifypasses (1783 passed, 107 skipped), with coverage at 98.75%.scripts/check.pypasses._validate_sdksfails it and the evaluator-level tests.sys.moduleswithout a spec now counts as installed.🤖 Generated with Claude Code