PreReasoningEvent
@Deprecated(forRemoval = true, since = "2.0.0") public final class PreReasoningEvent extends ReasoningEvent
io/agentscope/core/hook/PreReasoningEvent.java:49–119前置推理事件,描述执行过程中的事件。位于 io.agentscope.core.hook 包,继承自 ReasoningEvent。核心成员包括 getInputMessages、setInputMessages、getEffectiveGenerateOptions、setGenerateOptions、PreReasoningEvent。
Event fired before LLM reasoning.
Modifiable: Yes - #setInputMessages(List)
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 (modifiable)
Use Cases:
-
Inject hints or additional context into the prompt
-
Filter or modify existing messages
-
Add system instructions dynamically
-
Log reasoning input
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public PreReasoningEvent(Agent agent, String modelName, GenerateOptions generateOptions, List<Msg> inputMessages) | 初始化 `PreReasoningEvent` 实例。 Constructor for PreReasoningEvent. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public List<Msg> getInputMessages() | 获取输入消息。 Get the messages that will be sent to LLM for reasoning. |
public void setInputMessages(List<Msg> inputMessages) | 设置输入消息。 Modify the messages to send to LLM. |
public GenerateOptions getEffectiveGenerateOptions() | 获取 `getEffectiveGenerateOptions`。 Get the effective generation options. |
public void setGenerateOptions(GenerateOptions generateOptions) | 设置 `setGenerateOptions`。 Set custom generation options for this reasoning call. |
构造器详情Constructor Detail
PreReasoningEvent
public PreReasoningEvent(Agent agent, String modelName, GenerateOptions generateOptions, List<Msg> inputMessages)
初始化 PreReasoningEvent 实例。
Constructor for PreReasoningEvent.
| 名称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 (must not be null) |
NullPointerException可能抛出 `NullPointerException`。if agent, modelName, or inputMessages is null
io/agentscope/core/hook/PreReasoningEvent.java:64–73方法详情Method Detail
getInputMessages
public List<Msg> getInputMessages()
获取输入消息。
Get the messages that will be sent to LLM for reasoning.
List<Msg>io/agentscope/core/hook/PreReasoningEvent.java:80–82setInputMessages
public void setInputMessages(List<Msg> inputMessages)
设置输入消息。
Modify the messages to send to LLM.
| 名称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/PreReasoningEvent.java:90–92getEffectiveGenerateOptions
public GenerateOptions getEffectiveGenerateOptions()
获取 getEffectiveGenerateOptions。
Get the effective generation options.
GenerateOptionsio/agentscope/core/hook/PreReasoningEvent.java:102–106setGenerateOptions
public void setGenerateOptions(GenerateOptions generateOptions)
设置 setGenerateOptions。
Set custom generation options for this reasoning call.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
generateOptions | GenerateOptions | generate 选项(类型 `GenerateOptions`)。The custom generation options |
io/agentscope/core/hook/PreReasoningEvent.java:116–118