{{ message }}
[FIX] Strip deprecated sampling params for Claude Opus 4.7 onwards - #2103
Open
praveen-formido wants to merge 5 commits into
Open
[FIX] Strip deprecated sampling params for Claude Opus 4.7 onwards#2103praveen-formido wants to merge 5 commits into
praveen-formido wants to merge 5 commits into
Conversation
Extend the Anthropic sampling-param deprecation detector beyond Opus 4.7 to cover every Opus release from 4.7 onwards: 4.7, 4.8, 4.9 and Opus 5+. The previous single pattern matched only `claude-opus-4-7`, so callers on `claude-opus-4-8` (and future Opus ids) still sent `temperature` / `top_p` / `top_k` and 400'd with "temperature is deprecated for this model". Replace the lone pattern with two anchored ones — `claude-opus-4-[789]` and `claude-opus-[5-9]` — keeping the existing trailing-edge boundary so prefix collisions (`claude-opus-4-70`, `claude-opus-4-7verbose`) and the sampling-supporting `claude-opus-4-1..4-6` still do not match. Extend test_sampling_strip.py with 4.8/4.9/Opus 5+ positives and Opus 5 boundary negatives. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
Contributor
|
| Filename | Overview |
|---|---|
| unstract/sdk1/src/unstract/sdk1/adapters/base1.py | Replaces individual Opus stems with bounded family patterns while preserving literal detection for non-Opus families; the previously reported documentation issue is fixed. |
| unstract/sdk1/tests/test_sampling_strip.py | Expands positive and negative cases for later Opus identifiers and their provider-specific encodings. |
Reviews (5): Last reviewed commit: "Merge branch 'main' into fix/opus-sampli..." | Re-trigger Greptile
praveen-formido
requested review from
chandrasekharan-zipstack and
harini-venkataraman
and removed request for
chandrasekharan-zipstack
June 22, 2026 07:07
…pus id Address review feedback: the _has_deprecated_sampling_params docstring cited `claude-opus-4-7` as the Azure AI Foundry deployment-name example, which is stale now that the strip covers Opus 4.7 onwards. Reference the relevant model id generally (e.g. claude-opus-4-8). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
chandrasekharan-zipstack
approved these changes
Jun 22, 2026
harini-venkataraman
approved these changes
Jun 22, 2026
Reconcile the Opus 4.7+ sampling-param detector with main's UN-3709 stem list (#2165): keep main's literal stems for Sonnet 5 / Fable 5 / Mythos 5 and replace the literal opus-4-7 / opus-4-8 stems with this PR's Opus version-range patterns (opus-4-[789], opus-[5-9]) so every Opus release from 4.7 onwards is covered by a single implementation. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Contributor
Unstract test resultsPer-group resultsCritical paths❌ Regressions (must be zero)
|
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.




What
unstract/sdk1/.../adapters/base1.pyto cover every Opus release from 4.7 onwards — Opus 4.7, 4.8, 4.9 and Opus 5+ — instead of onlyclaude-opus-4-7.test_sampling_strip.pywith 4.8 / 4.9 / Opus 5+ positives and Opus 5 boundary negatives.Why
PR #1934 added the strip but keyed it to a single literal —
claude-opus-4-7. Anthropic has since shipped Opus 4.8, which deprecates the same sampling parameters (temperature,top_p,top_k). Becauseclaude-opus-4-8does not match the old pattern, those calls reach the provider withtemperaturestill set and 400:litellm cannot fix this for us — upstream
get_supported_openai_params()still reportstemperatureas supported for these models (open bug BerriAI/litellm#26444, unshipped), sodrop_params=Trueis a no-op. The strip inbase1.pyremains the only thing preventing the 400, and it must track each new Opus id.Reference: https://platform.claude.com/docs/en/about-claude/models/whats-new-claude-4-7
How
base1.py:claude-opus-4-7pattern becomes two patterns coveringclaude-opus-4-[789]andclaude-opus-[5-9]. The existing trailing-edge lookahead ($, a-/:/@//delimiter, orv<digit>) is preserved, so:claude-opus-4-8), Bedrock foundation models / cross-region profiles / ARNs (us.anthropic.claude-opus-4-8-<date>-v1:0), Vertex (vertex_ai/claude-opus-4-8@<date>), Azure deployments embedding the id, and dot/underscore variants.claude-opus-4-70,claude-opus-4-7verbose), the sampling-supportingclaude-opus-4-1..4-6, and Opus 5 boundary cases (claude-opus-50,claude-opus-5verbose)._strip_deprecated_sampling_params, themodel/model_idAIP fallback, or the four adapter call sites — only the detection table widened.test_sampling_strip.py:anthropic/, Bedrock id + ARN, cross-region, Vertex, Azure, dotted), 4.9, and Opus 5/6.claude-opus-50,claude-opus-5verbose,claude-opus-4-1,anthropic.claude-opus-4-1-....Known limitation
claude-opus-4-[789]covers 4.7–4.9 but not a hypotheticalclaude-opus-4-10. Anthropic's cadence (4-5 → 4-6 → 4-7 → 4-8) makes an Opus 5 jump far more likely than a 4-10, and Opus 5+ is already covered. Fable 5 / Mythos 5 (claude-fable-5,claude-mythos-5) also forbid these params but are out of scope here (this change is Opus-only, per the "4.7 onwards" scope); they would each need a pattern if routed through this SDK.Can this PR break any existing features. If yes, please list possible items. If no, please explain why. (PS: Admins do not merge the PR without this section filled)
No.
temperature/top_p/top_kare unaffected — verified by negative tests forclaude-opus-4-1..4-6,claude-sonnet-4-7,claude-haiku-4-5,claude-3-5-sonnet, and non-Anthropic providers (gpt-4o,gemini-2.0-flash), which all keep their sampling params.claude-opus-4-70,claude-opus-4-7verbose) still hold._strip_deprecated_sampling_paramscontract, AIPmodel_idfallback, and adapter wiring are untouched.🤖 Generated with Claude Code