Package com.tnsai.reasoning.react
Interface ActionHandler
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Handles action execution in a ReAct loop.
Implementations define how actions identified by the LLM reasoning step are actually executed. This decouples the ReAct loop from specific execution mechanisms (tool execution, API calls, local methods, etc.).
-
Method Summary
Modifier and TypeMethodDescriptionExecutes an action and returns the observation.static ActionHandlerwithFallback(ActionHandler primary, String fallbackMessage) Creates an action handler that always returns a fixed message for unknown actions.
-
Method Details
-
execute
Executes an action and returns the observation.- Parameters:
actionName- the name of the action to executeactionInput- the input/arguments for the action- Returns:
- the observation result, or empty if the action is unknown
-
withFallback
Creates an action handler that always returns a fixed message for unknown actions.
-