Skip to content

fix(python-sdk): accept older openai and anthropic releases - #409

Open
czi-fsisenda wants to merge 6 commits into
mainfrom
fsisenda/sdk-python-widen-vendor-ranges
Open

czi-fsisenda wants to merge 6 commits into
mainfrom
fsisenda/sdk-python-widen-vendor-ranges

Conversation

@czi-fsisenda

@czi-fsisenda czi-fsisenda commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Why

The vendor SDK floors (openai>=2.47.0, anthropic>=1.0.0) were set where openai and anthropic moved to the httpx2 transport. They weren't the oldest versions our adapters work with. So a caller pinned to an older release couldn't install the package at all. A partner pinned to openai 1.109.1 hit exactly this. This is step 1 of the three-PR plan on DSCR-2625, and it ships in 1.x with no breaking change.

Ticket: DSCR-2625.

Changes

Three commits.

test(python-sdk): drive each adapter through its real vendor client

  • The existing adapter tests use fake clients. They pass even if the installed SDK would reject our request arguments, so they can't tell us where the floors really are.
  • The new tests/unit/providers/test_vendor_sdk_wire.py builds each adapter on the real vendor async client, with only the HTTP transport mocked. There's no network and the key is fake.
  • It checks the request each adapter sends, parsing of the response, truncation, generate_text and attachments.
  • It checks that 401, 429 (with retry-after), timeout and connection failures from the real client are classified correctly.
  • It checks that a client the adapter built itself closes.

fix(python-sdk): accept older openai and anthropic releases, and anthropic 2.x (the 2.x part is undone below)

SDK Was Now Why this bound
openai >=2.47.0,<4 >=1.108.1,<4 1.108.1 is the first to export omit
anthropic >=1.0.0,<2 >=0.77.0,<2 0.77.0 is the first whose messages.create takes output_config
google-genai >=1.39.0,<3 unchanged 1.39.0 is the first with Client.close / aclose
  • The full suite passes at each floor and on the newest releases: openai 3.42, anthropic 1.17 and google-genai 2.34, with mypy clean on the newest.
  • dev now declares httpx2. The tests build vendor errors on httpx 2 types, and at the new floors nothing else installs it.
  • New CI job, "Lowest vendor SDKs": it reads the lower bounds from pyproject.toml, installs exactly those versions on the oldest Python requires-python allows, and runs the tests, so the floors stay true. It runs tests only. At these versions mypy flags test code that passes httpx 2 types to vendor errors typed for httpx 1. Nothing in src/ is affected.

For reviewers

  • Going lower needs code changes, so they're not in this PR:

    • openai 1.85: fall back to NOT_GIVEN when omit is missing.
    • anthropic 0.73: send output_config through extra_body. Not verified against the live API.
    • google-genai 1.22: skip closing clients on versions that can't, which would leak connections the 1.39 floor exists to avoid.

    Worth doing only if a partner needs it. The openai fallback is the cheap one.

  • fix(python-sdk): accept openai from 1.108.1 follows review: the first search sampled 1.99.9 and 2.0.0 only. The real floor is 1.108.1, which covers the partner's 1.109.1.

  • fix(python-sdk): keep anthropic below 2 follows review. The live Anthropic tests fail on anthropic 2.3.0: 2.0 moved the default anthropic-version header from 2023-06-01 to 2026-10-21, and that API version refuses the temperature the Math Standards Alignment contract pins. The mocked wire tests can't see it, because the API refuses it, not the SDK. Every 1.x release still sends 2023-06-01. Admitting 2.x is a separate change: deciding what the adapter sends under the new API version.

  • Conflicts with the extras PR feat(python-sdk): add per-provider extras and report a missing vendor SDK #410 (stacked on feat(python-sdk): add llm_provider to inject a caller-supplied LLM provider #405): it repeats these pins in its new extras. Whichever merges second updates both places.

Testing

  • make verify passes on the newest allowed SDKs: 1724 passed, 107 skipped.
  • Live Anthropic integration tests (Critical Thinking, Math Standards Alignment, the anthropic repeated-calls case: 10 tests): all 10 pass on anthropic 0.77.0. On anthropic 2.3.0, 7 fail, all with temperature: Extra inputs are not permitted, which is why the cap stays <2. OpenAI's were run on 1.108.1 in review.
  • The "Lowest vendor SDKs" job's script, run locally in a fresh Python 3.11 venv, installs openai 1.108.1, anthropic 0.77.0 and google-genai 1.39.0, and 1724 tests pass.
  • Each floor was found by testing published versions. The first failing version below each:
    • openai 1.108.0: omit import.
    • anthropic 0.76.0: output_config is rejected.
    • google-genai 1.38.0: no Client.close.
  • scripts/check.py passes.

🤖 Generated with Claude Code

czi-fsisenda and others added 2 commits October 30, 2026 18:43
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ropic 2.x

The floors were where openai and anthropic moved to the httpx2 transport,
not the oldest versions the adapters work with. That forced callers
pinned to an older release out of the package. They are now the oldest
versions the suite, including the new wire-level adapter tests, passes
on:

- openai >=2.0.0 (was 2.47.0): the first to export `omit`
- anthropic >=0.77.0 (was 1.0.0): the first whose `messages.create`
  takes `output_config`
- google-genai stays at 1.39.0: the first with Client.close/aclose

The anthropic cap moves to <3. The suite and mypy pass on anthropic
2.3, openai 3.42 and google-genai 2.34.

The `dev` extra now declares httpx2, which the tests use to build vendor
errors and which nothing else installs at the new floors. A new CI job,
"Lowest vendor SDKs", installs each SDK at the bound pyproject.toml
declares and runs the tests, so the floors stay accurate.

Refs: DSCR-2625

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are identified for the Python SDK vendor compatibility changes.

No open issues 🎉

What changed in this PR

This PR widens Python SDK vendor compatibility so callers pinned to older releases can install the package without adapter changes. It adds compatibility tests and CI coverage to validate the supported minimum versions.

Changes:

  • Lowers the OpenAI minimum to 2.0.0 and Anthropic minimum to 0.77.0, while allowing Anthropic 2.x.
  • Tests real vendor clients over mocked HTTP transports, covering requests, responses, errors, attachments, and client lifecycle.
  • Adds a CI job that installs vendor SDKs at their declared minimum versions and runs the tests.
File Description
sdks/​python/​tests/​unit/​providers/​test_vendor_sdk_wire.py Adds transport-level compatibility tests for all three vendor adapters.
sdks/​python/​pyproject.toml Widens vendor version ranges and adds httpx2 as a development dependency.
.github/​workflows/​test-sdk-python.yml Adds test coverage against the declared minimum vendor SDK versions.

Review effort: Balanced

Comment thread sdks/python/pyproject.toml Resolved
1.108.1 is the first openai release to export `omit`, so it is the real
floor. The search behind the previous floor of 2.0.0 sampled 1.99.9 and
2.0.0 and nothing between them. The full suite passes on 1.108.1 with
anthropic 0.77.0 and google-genai 1.39.0, and mypy is clean on `src/`.
The range now covers a partner on openai 1.109.1.

Refs: DSCR-2625

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread sdks/python/pyproject.toml Resolved
anthropic 2.0 moved its default `anthropic-version` header from 2023-06-01
to 2026-10-21, and that API version refuses `temperature`, which the Math
Standards Alignment contract pins: on anthropic 2.3.0 its live tests fail
with "temperature: Extra inputs are not permitted". The mocked wire tests
can't see this, since the API is what refuses it. The 0.77.0 floor passes
the Anthropic integration tests live.

Refs: DSCR-2625

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@czi-fsisenda czi-fsisenda changed the title fix(python-sdk): accept older openai and anthropic releases, and anthropic 2.x fix(python-sdk): accept older openai and anthropic releases Nov 2, 2026

@adnanrhussain adnanrhussain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM. Some minor feedback

Comment thread .github/workflows/test-sdk-python.yml Resolved
Comment thread sdks/python/pyproject.toml Resolved
Comment thread sdks/python/pyproject.toml Resolved
czi-fsisenda and others added 2 commits November 2, 2026 15:33
…thon

The `Lowest vendor SDKs` job now reads its Python from `requires-python`
instead of fixing 3.13, so the oldest SDKs run on the oldest interpreter a
caller may have. The dependency comment drops its list of verified versions,
which went stale with every Dependabot bump, and says that only the vendor
SDK lower bounds are tested at their floor.

Refs: DSCR-2625

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants