AS AgentScopeAPI 手册 / API Reference

SummaryChunkEvent

@Deprecated(forRemoval = true, since = "2.0.0") public final class SummaryChunkEvent extends SummaryEvent
源码Source io/agentscope/core/hook/SummaryChunkEvent.java:62–109

摘要分块事件,描述执行过程中的事件。位于 io.agentscope.core.hook 包,继承自 SummaryEvent。核心成员包括 getIncrementalChunk、getAccumulated、SummaryChunkEvent。

Event fired during summary streaming.

Modifiable: No (notification-only)

Context:

  • #getAgent() - The agent instance

  • #getMemory() - Agent's memory

  • #getModelName() - The model name

  • #getGenerateOptions() - The generation options

  • #getIncrementalChunk() - Only the new content in this chunk

  • #getAccumulated() - The full accumulated message so far

Use Cases:

  • Use #getIncrementalChunk() for incremental display (append-only)

  • Use #getAccumulated() for full context display (replace entire text)

  • Display streaming summary output in real-time

  • Monitor summary generation progress

  • Log streaming content

Example:

`case SummaryChunkEvent e -> {
// Incremental mode: print only new content
System.out.print(extractText(e.getIncrementalChunk()));

// OR Cumulative mode: update entire display
ui.setText(extractText(e.getAccumulated()));

yield Mono.just(e);
}
`

构造器摘要Constructor Summary

构造器Constructor说明Description
public SummaryChunkEvent(Agent agent, String modelName, GenerateOptions generateOptions, Msg incrementalChunk, Msg accumulated)
初始化 `SummaryChunkEvent` 实例。
Constructor for SummaryChunkEvent.

方法摘要Method Summary

方法Method说明Description
public Msg getIncrementalChunk()
获取 `getIncrementalChunk`。
Get only the new content generated in this streaming event.
public Msg getAccumulated()
获取 `getAccumulated`。
Get the full accumulated message containing all content generated so far.

构造器详情Constructor Detail

SummaryChunkEvent

public SummaryChunkEvent(Agent agent, String modelName, GenerateOptions generateOptions, Msg incrementalChunk, Msg accumulated)

初始化 SummaryChunkEvent 实例。

Constructor for SummaryChunkEvent.

参数Parameters
名称Name类型Type说明Description
agentAgent智能体(类型 `Agent`)。The agent instance (must not be null)
modelNameString模型名称(类型 `String`)。The model name (must not be null)
generateOptionsGenerateOptionsgenerate 选项(类型 `GenerateOptions`)。The generation options (may be null)
incrementalChunkMsgincremental 分块(类型 `Msg`)。Only the new content generated in this streaming event (must not be null)
accumulatedMsgaccumulated(类型 `Msg`)。The full accumulated message containing all content generated so far (must not be null)
抛出Throws
  • NullPointerException 可能抛出 `NullPointerException`。if agent, modelName, incrementalChunk, or accumulated is null
源码Source io/agentscope/core/hook/SummaryChunkEvent.java:80–90

方法详情Method Detail

getIncrementalChunk

public Msg getIncrementalChunk()

获取 getIncrementalChunk。

Get only the new content generated in this streaming event.

返回Returns Msg
返回消息。The incremental chunk
源码Source io/agentscope/core/hook/SummaryChunkEvent.java:97–99

getAccumulated

public Msg getAccumulated()

获取 getAccumulated。

Get the full accumulated message containing all content generated so far.

返回Returns Msg
返回消息。The accumulated message
源码Source io/agentscope/core/hook/SummaryChunkEvent.java:106–108

继承成员Inherited Members

继承自Methods inherited from SummaryEvent
基于官方固定版本源码静态生成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.