Class ToolRegistry
java.lang.Object
io.micronaut.langchain4j.tools.ToolRegistry
- All Implemented Interfaces:
io.micronaut.context.processor.ExecutableMethodProcessor<dev.langchain4j.agent.tool.Tool>
@Singleton
public class ToolRegistry
extends Object
implements io.micronaut.context.processor.ExecutableMethodProcessor<dev.langchain4j.agent.tool.Tool>
Register of tools.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@NonNull List<dev.langchain4j.service.tool.AiServiceTool> getAiServiceTools(@NonNull Set<?> toolTypes) Get the tools of the beans of the given types, asAiServiceTools invoking theToolmethods through their MicronautExecutableMethod: unlike the tool objects ofgetToolsTyped(Set), they let LangChain4j call the tools without scanning and invoking the methods reflectively.@NonNull List<dev.langchain4j.service.tool.AiServiceTool> Get all available tools, asAiServiceTools invoking theToolmethods through their MicronautExecutableMethod.Get all available tools.getToolsTyped(Set<?> toolTypes) Get tools for the given types.<B> voidprocess(io.micronaut.inject.BeanDefinition<B> beanDefinition, io.micronaut.inject.ExecutableMethod<B, ?> method)
-
Constructor Details
-
ToolRegistry
public ToolRegistry(io.micronaut.context.BeanContext beanContext)
-
-
Method Details
-
process
public <B> void process(io.micronaut.inject.BeanDefinition<B> beanDefinition, io.micronaut.inject.ExecutableMethod<B, ?> method) - Specified by:
processin interfaceio.micronaut.context.processor.ExecutableMethodProcessor<dev.langchain4j.agent.tool.Tool>
-
getAllTools
-
getToolsTyped
-
getAiServiceTools
public @NonNull List<dev.langchain4j.service.tool.AiServiceTool> getAiServiceTools(@NonNull Set<?> toolTypes) Get the tools of the beans of the given types, asAiServiceTools invoking theToolmethods through their MicronautExecutableMethod: unlike the tool objects ofgetToolsTyped(Set), they let LangChain4j call the tools without scanning and invoking the methods reflectively.- Parameters:
toolTypes- The tool types- Returns:
- The tools
- Since:
- 2.4.0
-
getAllAiServiceTools
Get all available tools, asAiServiceTools invoking theToolmethods through their MicronautExecutableMethod.- Returns:
- The tools
- Since:
- 2.4.0
-