Skip to content

docs(examples): update Anthropic examples to claude-sonnet-5-5 - #1173

Merged
marandaneto merged 2 commits into
PostHog:mainfrom
pcbeingused333:c0767-anthropic-model
Nov 4, 2026
Merged

marandaneto merged 2 commits into
PostHog:mainfrom
pcbeingused333:c0767-anthropic-model

Conversation

@pcbeingused333

Copy link
Copy Markdown
Contributor

The three Anthropic examples (chat.py, streaming.py, extended_thinking.py) use claude-sonnet-4-5-20250929, a model that Anthropic is retiring (scheduled 2026-11-30). Anyone running them after that date gets a model-not-found error.

Change. Point the three examples at claude-sonnet-5-5. In extended_thinking.py the request used thinking={"type": "enabled", "budget_tokens": 10000}, the fixed-budget form, so it now uses the adaptive form recommended for current models, thinking={"type": "adaptive", "display": "summarized"} (on Sonnet 5.x the thinking text is omitted by default, so display is needed for the example to print it).

Testing. Examples only, no library code touched. The three examples were run against a local mock of the Messages API (ANTHROPIC_BASE_URL), asserting model=claude-sonnet-5-5, the adaptive thinking parameter with no budget_tokens, and that the thinking text is printed. The same check fails on the old examples. They were not run against the live API.

This change was prepared with the assistance of an AI coding tool (Claude).

@pcbeingused333
pcbeingused333 requested a review from a team as a code owner November 3, 2026 21:47

@marandaneto marandaneto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The code looks good; no qualifying findings. Verdict: correct.

@marandaneto
marandaneto enabled auto-merge (squash) November 4, 2026 14:14
@marandaneto
marandaneto merged commit ff90d0b into PostHog:main Nov 4, 2026
45 checks passed
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.

2 participants