Package org.machanism.machai.ai.tools
Class FunctionToolsLoader
java.lang.Object
org.machanism.machai.ai.tools.FunctionToolsLoader
Discovers and applies
FunctionTools implementations using ServiceLoader.
This class is the host-side entry point for registering a curated set of local capabilities (for example,
file access, command execution, and HTTP retrieval) with a Genai. 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 = FunctionToolsLoader.getInstance();
loader.setConfiguration(conf);
loader.applyTools(provider);
- Author:
- Viktor Tovstyi
-
Method Summary
Modifier and TypeMethodDescriptionvoidapplyTools(Genai provider) Applies all discovered tool installers to the given provider.static FunctionToolsLoaderReturns the singleton instance.voidsetConfiguration(Configurator configurator) Supplies configuration to all discovered tool installers.
-
Method Details
-
getInstance
Returns the singleton instance.- Returns:
- singleton loader
-
applyTools
Applies all discovered tool installers to the given provider.- Parameters:
provider- provider instance to augment with tool functions
-
setConfiguration
Supplies configuration to all discovered tool installers.Not all
FunctionToolsimplementations use configuration, but the loader provides a centralized way to propagate aConfiguratorto all tool installers (for example, for resolving header placeholders in web requests).- Parameters:
configurator- configuration source used by tool installers
-