AS AgentScopeAPI 手册 / API Reference

ReasoningChunkEvent

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

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

Event fired during reasoning 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 output in real-time

  • Monitor reasoning progress

  • Log streaming content

Example:

`case ReasoningChunkEvent 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 ReasoningChunkEvent(Agent agent, String modelName, GenerateOptions generateOptions, Msg incrementalChunk, Msg accumulated)
初始化 `ReasoningChunkEvent` 实例。
Constructor for ReasoningChunkEvent.

方法摘要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

ReasoningChunkEvent

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

初始化 ReasoningChunkEvent 实例。

Constructor for ReasoningChunkEvent.

参数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/ReasoningChunkEvent.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/ReasoningChunkEvent.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/ReasoningChunkEvent.java:106–108

继承成员Inherited Members

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