Interface ReplanningToolFactory
-
- All Implemented Interfaces:
public interface ReplanningToolFactoryFactory interface for creating replanning tool decorators. Extended by Tool.Companion to provide Tool.replanAlways, Tool.replanWhen, etc.
-
-
Method Summary
Modifier and Type Method Description ToolreplanAlways(Tool tool)Make this tool always replan after execution, adding the artifact to the blackboard. <T extends Any> DelegatingToolconditionalReplan(Tool tool, Function2<T, ReplanContext, ReplanDecision> decider)When the decider returns a ReplanDecision, replan after execution, adding the artifact to the blackboard along with any additional updates from the decision. <T extends Any> DelegatingToolreplanWhen(Tool tool, Function1<T, Boolean> predicate)When the predicate matches the tool result artifact, replan, adding the artifact to the blackboard. <T extends Any> DelegatingToolreplanAndAdd(Tool tool, Function1<T, Object> valueComputer)Replan and add the object returned by the valueComputer to the blackboard. -
-
Method Detail
-
replanAlways
Tool replanAlways(Tool tool)
Make this tool always replan after execution, adding the artifact to the blackboard.
-
conditionalReplan
<T extends Any> DelegatingTool conditionalReplan(Tool tool, Function2<T, ReplanContext, ReplanDecision> decider)
When the decider returns a ReplanDecision, replan after execution, adding the artifact to the blackboard along with any additional updates from the decision. The decider receives the artifact cast to type T and the replan context. If the artifact is null or cannot be cast to T, the decider is not called.
-
replanWhen
<T extends Any> DelegatingTool replanWhen(Tool tool, Function1<T, Boolean> predicate)
When the predicate matches the tool result artifact, replan, adding the artifact to the blackboard. The predicate receives the artifact cast to type T. If the artifact is null or cannot be cast to T, returns normally.
-
replanAndAdd
<T extends Any> DelegatingTool replanAndAdd(Tool tool, Function1<T, Object> valueComputer)
Replan and add the object returned by the valueComputer to the blackboard.
- Parameters:
tool- The tool to wrapvalueComputer- Function that takes the artifact of type T and returns an object to add to the blackboard, or null to not replan
-
-
-
-