PreSummaryEvent
@Deprecated(forRemoval = true, since = "2.0.0") public final class PreSummaryEvent extends SummaryEvent
io/agentscope/core/hook/PreSummaryEvent.java:51–146前置摘要事件,描述执行过程中的事件。位于 io.agentscope.core.hook 包,继承自 SummaryEvent。核心成员包括 getInputMessages、setInputMessages、getMaxIterations、getCurrentIteration、getEffectiveGenerateOptions、setGenerateOptions。
Event fired before summary generation when max iterations is reached.
Modifiable: Yes - #setInputMessages(List), #setGenerateOptions(GenerateOptions)
Context:
-
#getAgent()- The agent instance -
#getMemory()- Agent's memory -
#getModelName()- The model name (e.g., "qwen-plus") -
#getGenerateOptions()- The generation options (temperature, etc.) -
#getInputMessages()- Messages to send to LLM for summary (modifiable) -
#getMaxIterations()- The maximum iterations configured for the agent -
#getCurrentIteration()- The current iteration count when summary triggered
Use Cases:
-
Inject additional context into the summary prompt
-
Modify the summary system instructions
-
Change generation parameters for summary
-
Log summary generation input
构造器摘要Constructor Summary
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public List<Msg> getInputMessages() | 获取输入消息。 Get the messages that will be sent to LLM for summary generation. |
public void setInputMessages(List<Msg> inputMessages) | 设置输入消息。 Modify the messages to send to LLM for summary. |
public int getMaxIterations() | 获取最大迭代。 Get the maximum iterations configured for the agent. |
public int getCurrentIteration() | 获取当前迭代。 Get the current iteration count when summary was triggered. |
public GenerateOptions getEffectiveGenerateOptions() | 获取 `getEffectiveGenerateOptions`。 Get the effective generation options. |
public void setGenerateOptions(GenerateOptions generateOptions) | 设置 `setGenerateOptions`。 Set custom generation options for this summary call. |
构造器详情Constructor Detail
PreSummaryEvent
public PreSummaryEvent(Agent agent, String modelName, GenerateOptions generateOptions, List<Msg> inputMessages, int maxIterations, int currentIteration)
初始化 PreSummaryEvent 实例。
Constructor for PreSummaryEvent.
| 名称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) |
inputMessages | List<Msg> | 输入消息(类型 `List`)。The messages to send to LLM for summary (must not be null) |
maxIterations | int | 最大迭代(类型 `int`)。The maximum iterations configured for the agent |
currentIteration | int | 当前迭代(类型 `int`)。The current iteration count when summary triggered |
NullPointerException可能抛出 `NullPointerException`。if agent, modelName, or inputMessages is null
io/agentscope/core/hook/PreSummaryEvent.java:70–83方法详情Method Detail
getInputMessages
public List<Msg> getInputMessages()
获取输入消息。
Get the messages that will be sent to LLM for summary generation.
List<Msg>io/agentscope/core/hook/PreSummaryEvent.java:90–92setInputMessages
public void setInputMessages(List<Msg> inputMessages)
设置输入消息。
Modify the messages to send to LLM for summary.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
inputMessages | List<Msg> | 输入消息(类型 `List`)。The new message list (must not be null) |
NullPointerException可能抛出 `NullPointerException`。if inputMessages is null
io/agentscope/core/hook/PreSummaryEvent.java:100–102getMaxIterations
public int getMaxIterations()
获取最大迭代。
Get the maximum iterations configured for the agent.
intio/agentscope/core/hook/PreSummaryEvent.java:109–111getCurrentIteration
public int getCurrentIteration()
获取当前迭代。
Get the current iteration count when summary was triggered.
intio/agentscope/core/hook/PreSummaryEvent.java:118–120getEffectiveGenerateOptions
public GenerateOptions getEffectiveGenerateOptions()
获取 getEffectiveGenerateOptions。
Get the effective generation options.
GenerateOptionsio/agentscope/core/hook/PreSummaryEvent.java:130–134setGenerateOptions
public void setGenerateOptions(GenerateOptions generateOptions)
设置 setGenerateOptions。
Set custom generation options for this summary call.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
generateOptions | GenerateOptions | generate 选项(类型 `GenerateOptions`)。The custom generation options |
io/agentscope/core/hook/PreSummaryEvent.java:143–145