Package org.machanism.machai.gw.tools
Class CommandSpecFunctionTools
java.lang.Object
org.machanism.machai.gw.tools.CommandSpecFunctionTools
- All Implemented Interfaces:
FunctionTools
Provides function tools for task and execution control within the
AIFileProcessor context.
This class registers tools for terminating execution and ending tasks in a
controlled manner. It is intended for use with AIFileProcessor and
integrates with the Genai provider.
- Author:
- Viktor Tovstyi
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAI functional tool that completes the current task by throwing anEndTaskException.terminateExecution(String message, int exitCode, File projectDir) AI functional tool that terminates the application by throwing aProcessTerminationException.
-
Field Details
-
TASK_TERMINATED_BY_FUNCTION_TOOL_MESSAGE
- See Also:
-
-
Constructor Details
-
CommandSpecFunctionTools
public CommandSpecFunctionTools()
-
-
Method Details
-
terminateExecution
AI functional tool that terminates the application by throwing aProcessTerminationException.Reads
messageandexitCodefrom the suppliedJsonNodeand throws aProcessTerminationException. This mechanism allows a tool invocation to abort the overall workflow with an explicit exit code.- Parameters:
message- message exposed to the hostexitCode- exit code associated with terminationprojectDir- project directory associated with the invocation- Throws:
ProcessTerminationException- always, to request process termination
-
endTask
AI functional tool that completes the current task by throwing anEndTaskException.This method is intended to be used as a function tool for terminating a process when requested by the user or dictated by process logic. It logs the task completion and uses a custom message if provided in the properties.
- Parameters:
message- message describing task completion- Throws:
EndTaskException- always, to request task completion
-