ThinkingAccumulator
public class ThinkingAccumulator implements ContentAccumulator<ThinkingBlock>
io/agentscope/core/agent/accumulator/ThinkingAccumulator.java:36–121Thinking Accumulator,驱动智能体的推理、工具调用与会话执行。位于 io.agentscope.core.agent.accumulator 包,实现 ContentAccumulator<ThinkingBlock>。核心成员包括 add、hasContent、buildAggregated、reset、getAccumulated。
Thinking content accumulator for accumulating streaming thinking chunks.
This accumulator concatenates all thinking chunks in order to build the complete thinking content.
List-valued metadata (e.g. reasoning details) is accumulated in stream order: entries from each chunk are appended rather than replaced. Scalar metadata uses last-write-wins. List values are always copied to prevent caller mutation from affecting accumulator state.
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public void add(ThinkingBlock block) | 设置添加。 Performs the add operation. |
public boolean hasContent() | 判断是否具有内容。 Returns whether this has the content. |
public ContentBlock buildAggregated() | 构建 `buildAggregated`。 Builds the aggregated. |
public void reset() | 清空或重置内部状态。 Clears or resets internal state. |
public String getAccumulated() | 获取 `getAccumulated`。 Get the accumulated thinking content. |
方法详情Method Detail
add
public void add(ThinkingBlock block)
设置添加。
Performs the add operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
block | ThinkingBlock | 内容块(类型 `ThinkingBlock`)。The block. |
io/agentscope/core/agent/accumulator/ThinkingAccumulator.java:44–52hasContent
public boolean hasContent()
判断是否具有内容。
Returns whether this has the content.
booleanio/agentscope/core/agent/accumulator/ThinkingAccumulator.java:57–60buildAggregated
public ContentBlock buildAggregated()
构建 buildAggregated。
Builds the aggregated.
ContentBlockio/agentscope/core/agent/accumulator/ThinkingAccumulator.java:65–75reset
public void reset()
清空或重置内部状态。
Clears or resets internal state.
io/agentscope/core/agent/accumulator/ThinkingAccumulator.java:80–84getAccumulated
public String getAccumulated()
获取 getAccumulated。
Get the accumulated thinking content.
Stringio/agentscope/core/agent/accumulator/ThinkingAccumulator.java:118–120