类 PreReasoningEvent
java.lang.Object
io.agentscope.core.hook.HookEvent
io.agentscope.core.hook.ReasoningEvent
io.agentscope.core.hook.PreReasoningEvent
Event fired before LLM reasoning.
Modifiable: Yes - setInputMessages(List)
Context:
HookEvent.getAgent()- The agent instanceHookEvent.getMemory()- Agent's memoryReasoningEvent.getModelName()- The model name (e.g., "qwen-plus")ReasoningEvent.getGenerateOptions()- The generation options (temperature, etc.)getInputMessages()- Messages to send to LLM (modifiable)
Use Cases:
- Inject hints or additional context into the prompt
- Filter or modify existing messages
- Add system instructions dynamically
- Log reasoning input
-
构造器概要
构造器构造器说明PreReasoningEvent(Agent agent, String modelName, GenerateOptions generateOptions, List<Msg> inputMessages) Constructor for PreReasoningEvent. -
方法概要
修饰符和类型方法说明Get the effective generation options.Get the messages that will be sent to LLM for reasoning.voidsetGenerateOptions(GenerateOptions generateOptions) Set custom generation options for this reasoning call.voidsetInputMessages(List<Msg> inputMessages) Modify the messages to send to LLM.从类继承的方法 io.agentscope.core.hook.ReasoningEvent
getGenerateOptions, getModelName从类继承的方法 io.agentscope.core.hook.HookEvent
getAgent, getMemory, getTimestamp, getType
-
构造器详细资料
-
PreReasoningEvent
public PreReasoningEvent(Agent agent, String modelName, GenerateOptions generateOptions, List<Msg> inputMessages) Constructor for PreReasoningEvent.- 参数:
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 (must not be null)- 抛出:
NullPointerException- if agent, modelName, or inputMessages is null
-
-
方法详细资料
-
getInputMessages
Get the messages that will be sent to LLM for reasoning.- 返回:
- The input messages
-
setInputMessages
Modify the messages to send to LLM.- 参数:
inputMessages- The new message list (must not be null)- 抛出:
NullPointerException- if inputMessages is null
-
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 reasoning call.This allows hooks to override the default generation options, for example to set a specific tool_choice for structured output.
- 参数:
generateOptions- The custom generation options
-