ThinkingBlock
public final class ThinkingBlock extends ContentBlock
io/agentscope/core/message/ThinkingBlock.java:37–133Thinking 块,在智能体、模型与前端之间传递结构化消息和事件。位于 io.agentscope.core.message 包,继承自 ContentBlock。核心成员包括 getThinking、getMetadata、builder、METADATA_REASONING_DETAILS。
Represents reasoning or thinking content in a message.
This content block is used to capture the internal reasoning process of an agent before taking action. It provides transparency into how the agent arrived at its decisions or tool choices.
Thinking blocks are particularly useful in ReAct agents and other reasoning-intensive systems where understanding the agent's thought process is valuable for debugging and analysis.
The optional metadata field can store additional reasoning information such as OpenRouter's reasoning_details (reasoning.text, reasoning.encrypted, reasoning.summary) that need to be preserved and restored when formatting messages back to the API.
嵌套类摘要Nested Class Summary
| 类Class | 类型Kind | 说明Description |
|---|---|---|
Builder | 类class | 构建器,用于构建并配置目标实例。 Builder for constructing ThinkingBlock instances. |
字段摘要Field Summary
| 字段Field | 类型Type | 说明Description |
|---|---|---|
METADATA_REASONING_DETAILSstaticfinal | String | 元数据推理详情字段。 Metadata key for storing OpenRouter/Gemini reasoning details list. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public String getThinking() | 获取 `getThinking`。 Gets the thinking/reasoning content of this block. |
public Map<String, Object> getMetadata() | 获取元数据。 Gets the metadata associated with this thinking block. |
public static Builder builder()static | 返回构建器实例。 Creates a new builder for constructing ThinkingBlock instances. |
字段详情Field Detail
METADATA_REASONING_DETAILS
public static final String METADATA_REASONING_DETAILS
元数据推理详情字段。声明为 public static final String METADATA_REASONING_DETAILS。
Metadata key for storing OpenRouter/Gemini reasoning details list.
io/agentscope/core/message/ThinkingBlock.java:40方法详情Method Detail
getThinking
public String getThinking()
获取 getThinking。
Gets the thinking/reasoning content of this block.
Stringio/agentscope/core/message/ThinkingBlock.java:64–66getMetadata
public Map<String, Object> getMetadata()
获取元数据。
Gets the metadata associated with this thinking block.
Map<String, Object>io/agentscope/core/message/ThinkingBlock.java:80–82builder
public static Builder builder()
返回构建器实例。
Creates a new builder for constructing ThinkingBlock instances.
Builderio/agentscope/core/message/ThinkingBlock.java:89–91嵌套类详情Nested Class Detail
Builder
public static class Builder构建器,用于构建并配置目标实例。位于 io.agentscope.core.message 包。核心成员包括 thinking、metadata、build。
Builder for constructing ThinkingBlock instances.