fix(examples): unbreak claude-query under anthropic 1.x - #1948
Open
shcheklein wants to merge 1 commit into
Open
Conversation
anthropic 1.0.0 (released 2026-08-20) removes temperature/top_p/top_k from messages.create/.stream/.parse and their beta counterparts, so the unpinned examples extra started resolving an SDK that rejects the call: TypeError: Messages.parse() got an unexpected keyword argument 'temperature' The llm_and_nlp examples job has failed on every branch since; it is in the check gate's allowed-failures, so it never blocked a merge. Also move off client.beta.messages.parse -- structured outputs is GA, and messages.parse exists on recent 0.x too, so the example works on both. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Deploying datachain with
|
| Latest commit: |
e3a1d82
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://bf9fea80.datachain-2g6.pages.dev |
| Branch Preview URL: | https://fix-anthropic-1x-example.datachain-2g6.pages.dev |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
There was a problem hiding this comment.
Pull request overview
Restores the Claude query example’s compatibility with Anthropic SDK 1.x.
Changes:
- Uses the GA
client.messages.parse()API. - Removes unsupported sampling configuration.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Problem
The
examples (ubuntu-latest, 3.14, llm_and_nlp)job has failed on every branch since 2026-08-21. Last green run: 32408870541 (08-20).anthropicis unpinned in theexamplesextra, and anthropic 1.0.0 shipped on 2026-08-20 (previous release 0.125.0, 08-19). The 1.x major removes the sampling parameterstemperature/top_p/top_kfrommessages.create()/.stream()/.parse()and theirbeta.messagescounterparts — passing one is now aTypeError. Current models don't use them and the SDK offers no escape hatch.This never blocked a merge because
examplesis in thecheckgate'sallowed-failures, so it has just been quietly red.Fix
temperature=TEMPERATURE(and the now-unused constant) from themessages.parsecall.client.beta.messages.parse(...)→client.messages.parse(...). Structured outputs is GA, so the beta path was churn risk for no benefit.output_format=Ratingis the helper argument and is unchanged in 1.x.Verification
Checked against a real
anthropic==1.0.0install: the exact kwarg set the example now passes binds cleanly tomessages.parse.messages.parsealso exists on 0.125.0, so the example still runs for anyone on a recent 0.x. File compiles and passes ruff.Nothing else in the repo touches the SDK —
tests/func/test_optional.pyonly mimicsanthropic.typesshapes without importing it, and thesetup()docstring indatachain.pypasses no sampling params.Not done here
Left
anthropicunbounded in theexamplesextra. Since thecheckgate already tolerates examples failures, letting upstream breakage surface looks deliberate. If you'd rather be warned by dependabot than by red CI, ananthropic<2bound in the litellm style is a one-liner — happy to add it.🤖 Generated with Claude Code