Package org.machanism.machai.ai.tools
Class FunctionToolsLoader
java.lang.Object
org.machanism.machai.ai.tools.FunctionToolsLoader
Discovers and applies
FunctionTools implementations using Java's
ServiceLoader mechanism.
This class serves as the host-side entry point for registering a curated set
of local capabilities (such as file access, command execution, and HTTP
retrieval) with a Genai provider. Implementations are discovered from
the classpath (typically via META-INF/services provider
configuration) and then applied to the provider in discovery order.
Usage
Configurator conf = ...;
Genai provider = ...;
FunctionToolsLoader loader = new FunctionToolsLoader();
loader.setConfiguration(conf);
loader.applyTools(provider);
Alternatively, you may use a singleton pattern if desired.
- Author:
- Viktor Tovstyi
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a newFunctionToolsLoaderand discovers availableFunctionToolsimplementations usingServiceLoader. -
Method Summary
Modifier and TypeMethodDescriptionvoidapplyTools(Genai provider, Configurator configurator) Applies all discoveredFunctionToolsinstallers to the given provider.
-
Constructor Details
-
FunctionToolsLoader
public FunctionToolsLoader()Constructs a newFunctionToolsLoaderand discovers availableFunctionToolsimplementations usingServiceLoader.
-
-
Method Details
-
applyTools
Applies all discoveredFunctionToolsinstallers to the given provider.- Parameters:
provider- theGenaiprovider instance to augment with tool functions
-