Class BindexFunctionTools
java.lang.Object
org.machanism.machai.bindex.ai.tools.BindexFunctionTools
- All Implemented Interfaces:
org.machanism.machai.ai.tools.FunctionTools
public class BindexFunctionTools
extends Object
implements org.machanism.machai.ai.tools.FunctionTools
Registers Bindex-related function tools for a
Genai.
The tools exposed by this type are intended to be consumed by LLM-assisted workflows so they can retrieve additional context (a Bindex document or the Bindex JSON schema) on demand.
Exposed tools
get_bindex: Fetches a registeredBindexby its id.get_bindex_schema: Returns the JSON schema that defines theBindexdocument shape.
A BindexRepository is created when
setConfigurator(Configurator) is invoked.
- Since:
- 0.0.2
- Author:
- Viktor Tovstyi
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidapplyTools(org.machanism.machai.ai.provider.Genai provider) Registers Bindex function tools with the providedGenai.Implementation for theget_bindexfunction tool.getBindexSchema(com.fasterxml.jackson.databind.JsonNode props, File workingDir) Implementation for theget_bindex_schemafunction tool.getRecommendedLibraries(com.fasterxml.jackson.databind.JsonNode props, File workingDir) registerBindex(com.fasterxml.jackson.databind.JsonNode props, File workingDir) voidsetConfigurator(Configurator configurator) Supplies configuration used to initialize the underlyingBindexRepository.
-
Field Details
-
MODEL_PROP_NAME
- See Also:
-
-
Constructor Details
-
BindexFunctionTools
public BindexFunctionTools()
-
-
Method Details
-
applyTools
public void applyTools(org.machanism.machai.ai.provider.Genai provider) Registers Bindex function tools with the providedGenai.- Specified by:
applyToolsin interfaceorg.machanism.machai.ai.tools.FunctionTools- Parameters:
provider- the provider to register tools with
-
getBindex
public String getBindex(com.fasterxml.jackson.databind.JsonNode props, File workingDir) throws com.fasterxml.jackson.core.JsonProcessingException Implementation for theget_bindexfunction tool.- Parameters:
params- tool invocation parameters; the first element is expected to be a JSON node containing the tool arguments- Returns:
- the serialized
Bindexas JSON, or the literalnullwhen not found - Throws:
com.fasterxml.jackson.core.JsonProcessingExceptionIllegalStateException- if the repository has not been configured yet
-
getBindexSchema
public String getBindexSchema(com.fasterxml.jackson.databind.JsonNode props, File workingDir) throws IOException Implementation for theget_bindex_schemafunction tool.- Parameters:
params- tool invocation parameters (not used)- Returns:
- the Bindex schema resource content as JSON string
- Throws:
IOException
-
getRecommendedLibraries
public List<BindexFunctionTools.BindexElement> getRecommendedLibraries(com.fasterxml.jackson.databind.JsonNode props, File workingDir) throws IOException - Throws:
IOException
-
registerBindex
public String registerBindex(com.fasterxml.jackson.databind.JsonNode props, File workingDir) throws com.fasterxml.jackson.core.JsonProcessingException - Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
setConfigurator
Supplies configuration used to initialize the underlyingBindexRepository.- Specified by:
setConfiguratorin interfaceorg.machanism.machai.ai.tools.FunctionTools- Parameters:
configurator- configurator to use (may benull)
-