AS AgentScopeAPI 手册 / API Reference

PreReasoningEvent

@Deprecated(forRemoval = true, since = "2.0.0") public final class PreReasoningEvent extends ReasoningEvent
源码Source 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.

参数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)
inputMessagesList<Msg>输入消息(类型 `List`)。The messages to send to LLM (must not be null)
抛出Throws
  • NullPointerException 可能抛出 `NullPointerException`。if agent, modelName, or inputMessages is null
源码Source 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.

返回Returns List<Msg>
输入消息。The input messages
源码Source io/agentscope/core/hook/PreReasoningEvent.java:80–82

setInputMessages

public void setInputMessages(List<Msg> inputMessages)

设置输入消息。

Modify the messages to send to LLM.

参数Parameters
名称Name类型Type说明Description
inputMessagesList<Msg>输入消息(类型 `List`)。The new message list (must not be null)
抛出Throws
  • NullPointerException 可能抛出 `NullPointerException`。if inputMessages is null
源码Source io/agentscope/core/hook/PreReasoningEvent.java:90–92

getEffectiveGenerateOptions

public GenerateOptions getEffectiveGenerateOptions()

获取 getEffectiveGenerateOptions。

Get the effective generation options.

返回Returns GenerateOptions
返回GenerateOptions。The effective generation options
源码Source io/agentscope/core/hook/PreReasoningEvent.java:102–106

setGenerateOptions

public void setGenerateOptions(GenerateOptions generateOptions)

设置 setGenerateOptions。

Set custom generation options for this reasoning call.

参数Parameters
名称Name类型Type说明Description
generateOptionsGenerateOptionsgenerate 选项(类型 `GenerateOptions`)。The custom generation options
源码Source io/agentscope/core/hook/PreReasoningEvent.java:116–118

继承成员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.