Skip to main content

Extended Thinking

Extended thinking exposes the model’s step-by-step reasoning as structured thinking_blocks. Unlike the plain-text reasoning_content field, thinking blocks carry cryptographic signatures — required to continue a reasoning chain across multiple turns.

Provider Support

Response Fields

Basic Usage

Streaming

Use the helper below to accumulate a stream into content, thinking_blocks, and tool_calls — ready to pass directly into the next turn.

Multi-Turn Conversations

Use model_dump(exclude_none=True) on the assistant message — it captures content, tool_calls, and thinking_blocks in one shot, so you don’t need to construct the dict manually.
Always echo thinking_blocks exactly as returned. Blocks with missing or modified signature fields are rejected by the provider.

Multi-Turn with Tool Calls

When thinking is enabled, Anthropic and Bedrock require the assistant message to include thinking_blocks alongside tool_calls. Use model_dump(exclude_none=True) — it captures both in one step.
Google Gemini support grounding with Google Search, which allows the model to augment its responses with real-time web results. When grounding is enabled, the model can call a search tool during generation to retrieve up-to-date information and incorporate it into the final answer.