Content Block Types
ContentBlock
Union type of all content blocks.
python
ContentBlock = TextBlock | ThinkingBlock | ToolUseBlock | ToolResultBlockTextBlock
Text content block.
python
@dataclass
class TextBlock:
text: strThinkingBlock
Thinking content block (for models with thinking capability).
python
@dataclass
class ThinkingBlock:
thinking: str
signature: strToolUseBlock
Tool use request block.
python
@dataclass
class ToolUseBlock:
id: str
name: str
input: dict[str, Any]ToolResultBlock
Tool execution result block.
python
@dataclass
class ToolResultBlock:
tool_use_id: str
content: str | list[dict[str, Any]] | None = None
is_error: bool | None = None