Skip to content

feat(anthropic): stream thinking summaries, fix haiku thinking budget, dynamic-filtering web search#297

Merged
Kamilbenkirane merged 1 commit into
mainfrom
fix/anthropic-thinking
Jul 3, 2026
Merged

feat(anthropic): stream thinking summaries, fix haiku thinking budget, dynamic-filtering web search#297
Kamilbenkirane merged 1 commit into
mainfrom
fix/anthropic-thinking

Conversation

@Kamilbenkirane

Copy link
Copy Markdown
Member

What

Three Anthropic text improvements:

  1. Stream thinking summaries. ThinkingLevelMapper now emits thinking: {type: "adaptive", display: "summarized"}. On Opus 4.8 / Sonnet 5 / Opus 4.7 the API defaults display to "omitted", which streams thinking blocks with empty text (no thinking_delta events) — so adaptive-thinking summaries never surfaced to callers that stream reasoning.

  2. Fix haiku thinking budget. claude-haiku-4-5 THINKING_BUDGET floor -1 → 1024. Haiku 4.5 has no dynamic/adaptive thinking mode (only a fixed budget_tokens, min 1024); the -1 → "auto" translation was then re-validated against the numeric Range and raised ConstraintViolationError: "Must be numeric, got str" at request build.

  3. Dynamic-filtering web search. Select web_search_20260209 (dynamic filtering) for models that support it (Opus 4.6+ / Sonnet 4.6+ / Fable 5), basic web_search_20250305 otherwise. The supported-model list lives in the Anthropic text catalog (DYNAMIC_FILTERING_MODELS); a plain conditional in the text ToolsMapper picks the version. No model IDs in the mapper, nothing added to core.

Verification

  • ruff + mypy (344 files) clean; unit tests pass.
  • Confirmed against the live Anthropic API: adaptive thinking now streams summaries; haiku runs without the constraint error; web_search_20260209 streams interleaved reasoning with populated grounding on supporting models (note: dynamic filtering runs search inside code execution, so inline web_search_result_location citations are not emitted on those turns — an API behavior, not a regression here).

🤖 Generated with Claude Code

…, dynamic-filtering web search

- ThinkingLevelMapper sets display="summarized" so adaptive-thinking summaries stream; the API default "omitted" returns empty thinking blocks on Opus 4.8 / Sonnet 5 / 4.7.
- claude-haiku-4-5 THINKING_BUDGET floor -1 -> 1024: haiku has no dynamic thinking mode, and the -1 -> "auto" translation raised ConstraintViolationError against the numeric Range.
- Select web_search_20260209 (dynamic filtering) for models that support it, basic web_search_20250305 otherwise; the supported-model list lives in the anthropic catalog.
@Kamilbenkirane Kamilbenkirane merged commit 7698e46 into main Jul 3, 2026
11 checks passed
@claude

claude Bot commented Jul 3, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

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.

1 participant