Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .github/workflows/test-sdk-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,11 @@ jobs:
with:
python-version: "3.13"

# 1.x still lists the vendor SDKs as dependencies, so they are removed again here;
# from 2.0 the plain install brings none and the uninstall step can go.
- name: Install the package without vendor SDKs
# The plain install, as a caller who brings their own provider has it.
- name: Install the package without extras
run: |
python -m pip install --upgrade pip
pip install . pytest pytest-asyncio
pip uninstall -y openai anthropic google-genai

- name: Every evaluator without them
run: python -m pytest tests/unit/test_without_vendor_sdks.py -p no:cacheprovider
Expand Down
4 changes: 2 additions & 2 deletions sdks/python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Python SDK for [Learning Commons evaluators](https://docs.learningcommons.org/ev
## Dependencies

- Python 3.11+
- `pydantic`, `httpx`, `pillow`, and `textstat`, plus the provider clients (`openai`, `anthropic`, `google-genai`), each also available as an extra (see [Installation](#installation)).
- `pydantic`, `httpx`, `pillow`, and `textstat`. The provider clients (`openai`, `anthropic`, `google-genai`) are extras: install the ones your evaluators use (see [Installation](#installation)).
- Credentials are constructor arguments. The SDK reads no provider keys from the environment, so a shell `GOOGLE_API_KEY` leaves `google_api_key` unset. A missing key raises `ConfigurationError` at construction, before any I/O.

## Installation
Expand All @@ -52,7 +52,7 @@ pip install "learning-commons-evaluators[all]" # every provider

A `model_override` needs the extra for its provider instead. An evaluator whose provider's SDK is not installed raises `ConfigurationError` at construction, naming the extra to add.

Version 1.x still installs all three provider clients without an extra, so these lines change nothing today. Version 2.0 will install them only through their extras, and the plain `pip install learning-commons-evaluators` will be for [bringing your own provider](#bring-your-own-provider), which needs none.
The plain `pip install learning-commons-evaluators` installs no provider client. It is for [bringing your own provider](#bring-your-own-provider), which needs none.

Pass the key each evaluator's default provider requires ([which keys](https://docs.learningcommons.org/evaluators/getting-started/quickstart#required-api-keys)):

Expand Down
27 changes: 12 additions & 15 deletions sdks/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,8 @@ classifiers = [
dependencies = [
"pydantic>=2.0.0,<3",
"textstat>=0.7.0,<1",
# Native provider SDKs (D10): one adapter per SDK under providers/. httpx is what
# google-genai transports over and what the error taxonomy reads transport failures
# from. openai (since 2.47.0) and anthropic (since 1.0.0) transport over httpx 2,
# published as the separate httpx2 package, which they bring themselves; the lower
# bounds are the first versions to do so, so httpx2 is always present for the error
# classifier and the tests that build the SDKs' exceptions.
"openai>=2.47.0,<4",
"anthropic>=1.0.0,<2",
# 1.39.0 is the first to let a client be closed (Client.close, AsyncClient.aclose).
"google-genai>=1.39.0,<3",
# What the Knowledge Graph client and google-genai transport over, and what the error
# taxonomy reads transport failures from. The provider SDKs are extras, below.
"httpx>=0.27.0,<1",
# Image inputs (features/image_source.py): reads an attached file's format and
# dimensions from its header, without decoding pixels, to enforce the contract's
Expand All @@ -65,13 +57,18 @@ dependencies = [
]

[project.optional-dependencies]
# One extra per provider, named by its `Provider` value, so the error for a missing SDK
# names the extra mechanically. Each repeats its pin from `dependencies` above, where the
# SDKs still sit so that no 1.x install changes; 2.0 drops them from there (DSCR-2625),
# leaving the base install for callers who inject their own `llm_provider`. Bump a pin in
# both places until then.
# Native provider SDKs (D10), one extra per adapter under providers/, named by its
# `Provider` value so the error for a missing SDK names the extra mechanically. None is
# in the base install: a caller who injects their own `llm_provider` needs none of them,
# and most evaluators call one provider. The caps follow the rule above.
#
# openai (since 2.47.0) and anthropic (since 1.0.0) transport over httpx 2, published as
# the separate httpx2 package, which they bring themselves; the lower bounds are the first
# versions to do so, so httpx2 is present for the error classifier wherever their errors
# can be raised, and for the tests that build those errors.
openai = ["openai>=2.47.0,<4"]
anthropic = ["anthropic>=1.0.0,<2"]
# 1.39.0 is the first to let a client be closed (Client.close, AsyncClient.aclose).
google = ["google-genai>=1.39.0,<3"]
all = ["learning-commons-evaluators[openai,anthropic,google]"]
dev = [
Expand Down
Loading