Class ModelHook
java.lang.Object
com.alibaba.cloud.ai.graph.agent.hook.ModelHook
- All Implemented Interfaces:
Hook,Prioritized
- Direct Known Subclasses:
HumanInTheLoopHook,InterruptionHook,ModelCallLimitHook,ToolCallLimitHook
-
Field Summary
Fields inherited from interface com.alibaba.cloud.ai.graph.agent.Prioritized
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionafterModel(OverAllState state, RunnableConfig config) beforeModel(OverAllState state, RunnableConfig config) getAgent()Gets the ReactAgent instance that owns this hook.Gets the name of the agent that owns this hook.intgetOrder()Returns the order value for this object.voidsetAgent(ReactAgent agent) Sets the ReactAgent instance that owns this hook.voidsetAgentName(String agentName) Sets the name of the agent that owns this hook.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.alibaba.cloud.ai.graph.agent.hook.Hook
canJumpTo, getHookPositions, getKeyStrategys, getModelInterceptors, getName, getToolInterceptors, getTools
-
Constructor Details
-
ModelHook
public ModelHook()
-
-
Method Details
-
beforeModel
-
afterModel
-
setAgentName
Description copied from interface:HookSets the name of the agent that owns this hook. This is typically called by the framework during agent initialization.- Specified by:
setAgentNamein interfaceHook- Parameters:
agentName- the agent name, must not be null
-
getAgentName
Description copied from interface:HookGets the name of the agent that owns this hook.- Specified by:
getAgentNamein interfaceHook- Returns:
- the agent name, or null if not set
-
getAgent
Description copied from interface:HookGets the ReactAgent instance that owns this hook. This allows hooks to access the agent's state and configuration. -
setAgent
Description copied from interface:HookSets the ReactAgent instance that owns this hook. This is typically called by the framework during agent initialization. -
getOrder
public int getOrder()Description copied from interface:PrioritizedReturns the order value for this object.The order value determines the priority of this object when sorted with other
Prioritizedobjects. Objects with smaller order values will be sorted before objects with larger order values (ascending order).For example:
- An object with order 1 will be placed before an object with order 5
- An object with order 10 will be placed before an object with order 20
- Specified by:
getOrderin interfacePrioritized- Returns:
- the order value (smaller values indicate higher priority)
-