类 PreSummaryEvent
java.lang.Object
io.agentscope.core.hook.HookEvent
io.agentscope.core.hook.SummaryEvent
io.agentscope.core.hook.PreSummaryEvent
Event fired before summary generation when max iterations is reached.
Modifiable: Yes - setInputMessages(List), setGenerateOptions(GenerateOptions)
Context:
HookEvent.getAgent()- The agent instanceHookEvent.getMemory()- Agent's memorySummaryEvent.getModelName()- The model name (e.g., "qwen-plus")SummaryEvent.getGenerateOptions()- The generation options (temperature, etc.)getInputMessages()- Messages to send to LLM for summary (modifiable)getMaxIterations()- The maximum iterations configured for the agentgetCurrentIteration()- 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
-
构造器概要
构造器构造器说明PreSummaryEvent(Agent agent, String modelName, GenerateOptions generateOptions, List<Msg> inputMessages, int maxIterations, int currentIteration) Constructor for PreSummaryEvent. -
方法概要
修饰符和类型方法说明intGet the current iteration count when summary was triggered.Get the effective generation options.Get the messages that will be sent to LLM for summary generation.intGet the maximum iterations configured for the agent.voidsetGenerateOptions(GenerateOptions generateOptions) Set custom generation options for this summary call.voidsetInputMessages(List<Msg> inputMessages) Modify the messages to send to LLM for summary.从类继承的方法 io.agentscope.core.hook.SummaryEvent
getGenerateOptions, getModelName从类继承的方法 io.agentscope.core.hook.HookEvent
getAgent, getMemory, getTimestamp, getType
-
构造器详细资料
-
PreSummaryEvent
public PreSummaryEvent(Agent agent, String modelName, GenerateOptions generateOptions, List<Msg> inputMessages, int maxIterations, int currentIteration) Constructor for PreSummaryEvent.- 参数:
agent- The agent instance (must not be null)modelName- The model name (must not be null)generateOptions- The generation options (may be null)inputMessages- The messages to send to LLM for summary (must not be null)maxIterations- The maximum iterations configured for the agentcurrentIteration- The current iteration count when summary triggered- 抛出:
NullPointerException- if agent, modelName, or inputMessages is null
-
-
方法详细资料
-
getInputMessages
Get the messages that will be sent to LLM for summary generation.- 返回:
- The input messages
-
setInputMessages
Modify the messages to send to LLM for summary.- 参数:
inputMessages- The new message list (must not be null)- 抛出:
NullPointerException- if inputMessages is null
-
getMaxIterations
public int getMaxIterations()Get the maximum iterations configured for the agent.- 返回:
- The maximum iterations
-
getCurrentIteration
public int getCurrentIteration()Get the current iteration count when summary was triggered.- 返回:
- The current iteration count
-
getEffectiveGenerateOptions
Get the effective generation options.Returns the overridden options if set via
setGenerateOptions(GenerateOptions), otherwise returns the original options from the parent class.- 返回:
- The effective generation options
-
setGenerateOptions
Set custom generation options for this summary call.This allows hooks to override the default generation options.
- 参数:
generateOptions- The custom generation options
-