SummaryChunkEvent
@Deprecated(forRemoval = true, since = "2.0.0") public final class SummaryChunkEvent extends SummaryEvent
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.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
agent | Agent | 智能体(类型 `Agent`)。The agent instance (must not be null) |
modelName | String | 模型名称(类型 `String`)。The model name (must not be null) |
generateOptions | GenerateOptions | generate 选项(类型 `GenerateOptions`)。The generation options (may be null) |
incrementalChunk | Msg | incremental 分块(类型 `Msg`)。Only the new content generated in this streaming event (must not be null) |
accumulated | Msg | accumulated(类型 `Msg`)。The full accumulated message containing all content generated so far (must not be null) |
NullPointerException可能抛出 `NullPointerException`。if agent, modelName, incrementalChunk, or accumulated is null
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.
Msgio/agentscope/core/hook/SummaryChunkEvent.java:97–99getAccumulated
public Msg getAccumulated()
获取 getAccumulated。
Get the full accumulated message containing all content generated so far.
Msgio/agentscope/core/hook/SummaryChunkEvent.java:106–108