Skip to content

Anthropic adaptive thinking#998

Open
GrahamCampbell wants to merge 2 commits intoprism-php:mainfrom
GrahamCampbell:adaptive-thinking
Open

Anthropic adaptive thinking#998
GrahamCampbell wants to merge 2 commits intoprism-php:mainfrom
GrahamCampbell:adaptive-thinking

Conversation

@GrahamCampbell
Copy link
Copy Markdown
Contributor

Description

Add support for Anthropic's adaptive thinking mode (thinking.type: "adaptive") and the effort parameter (output_config.effort), recommended for Claude 4.6+ models. The legacy thinking.enabled + budgetTokens configuration remains fully supported for older models.

New provider options:

->withProviderOptions([
    'thinking' => ['type' => 'adaptive'],
    'effort' => 'high', // low, medium, high (default), max (Opus 4.6 only)
])

Changes:

  • Text.php / Structured.php: Extract resolveThinking() helper to support both adaptive and legacy thinking payloads; add output_config.effort to the request payload
  • NativeOutputFormatStructuredStrategy.php: Merge output_config instead of overwriting, so effort and format coexist
  • ExtractsThinking.php: Extract thinking blocks from responses when adaptive thinking is active
  • ToolStructuredStrategy.php: Skip tool_choice for adaptive thinking (Anthropic restriction)
  • Tests restructured with adaptive thinking as the primary configuration and legacy as secondary
  • Documentation updated to recommend adaptive thinking for Claude 4.6+ models

Breaking Changes

None. The existing thinking.enabled + budgetTokens API is unchanged and continues to work.

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