AS AgentScopeAPI 手册 / API Reference

ContentAccumulator

public interface ContentAccumulator<T extends ContentBlock>
源码Source io/agentscope/core/agent/accumulator/ContentAccumulator.java:29–60

定义内容 Accumulator契约的接口。位于 io.agentscope.core.agent.accumulator 包。核心成员包括 add、hasContent、buildAggregated、reset。

Content accumulator interface for accumulating streaming content blocks.

This interface defines the contract for accumulating content blocks from streaming responses. Different content types (text, thinking, tool calls) have different accumulation strategies.

方法摘要Method Summary

方法Method说明Description
public void add(T block)
设置添加。
Add a content block chunk to the accumulator.
public boolean hasContent()
判断是否具有内容。
Check if the accumulator has any accumulated content.
public ContentBlock buildAggregated()
构建 `buildAggregated`。
Build the aggregated content block from all accumulated chunks.
public void reset()
清空或重置内部状态。
Clears or resets internal state.

方法详情Method Detail

add

public void add(T block)

设置添加。

Add a content block chunk to the accumulator.

参数Parameters
名称Name类型Type说明Description
blockT内容块分块到添加。The content block chunk to add
源码Source io/agentscope/core/agent/accumulator/ContentAccumulator.java:37

hasContent

public boolean hasContent()

判断是否具有内容。

Check if the accumulator has any accumulated content.

返回Returns boolean
返回布尔值,表示判断结果。true if there is accumulated content, false otherwise
源码Source io/agentscope/core/agent/accumulator/ContentAccumulator.java:45

buildAggregated

public ContentBlock buildAggregated()

构建 buildAggregated。

Build the aggregated content block from all accumulated chunks.

返回Returns ContentBlock
返回ContentBlock。The aggregated content block, or null if no content
源码Source io/agentscope/core/agent/accumulator/ContentAccumulator.java:53

reset

public void reset()

清空或重置内部状态。

Clears or resets internal state.

源码Source io/agentscope/core/agent/accumulator/ContentAccumulator.java:59
基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.