Annotation Interface AiService
Registers an AI service.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classThe default no-op customizer. -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionClass<? extends AiServiceCustomizer<?>> A customizer can be registered to customize its creation.String[]The names of the LangChain4jMcpClientbeans whose tools are provided to the service, for example the clients configured with the Micronaut MCP LangChain4j client.The name of a configured AI model.The name of the LangChain4jSkillsbean whose Agent Skills are offered to the service, for example the skills configured withlangchain4j.skills.<name>.String[]The names of theToolProviderbeans that provide dynamic tools, for example the tools of MCP servers.Class<?>[]The types of the tools to include.Defines the service name.
-
Element Details
-
value
-
named
The name of a configured AI model.- Returns:
- The model name.
- Default:
""
-
tools
Class<?>[] toolsThe types of the tools to include. Can be set to an empty array to include none.- Returns:
- The tool types
- Default:
{}
-
toolProviders
String[] toolProvidersThe names of theToolProviderbeans that provide dynamic tools, for example the tools of MCP servers.When this member is not set, the
ToolProviderbean qualified with thenameof the service is used, otherwise the defaultToolProviderbean if there is one. Set it to an empty array to use no tool provider.- Returns:
- The names of the tool provider beans
- Since:
- 2.4.0
- Default:
{}
-
mcpClients
String[] mcpClientsThe names of the LangChain4jMcpClientbeans whose tools are provided to the service, for example the clients configured with the Micronaut MCP LangChain4j client.Requires
dev.langchain4j:langchain4j-mcpon the classpath. When this member is set andtoolProviders()is not, noToolProviderbean is applied implicitly, so that the service only receives the tools of the named MCP clients.- Returns:
- The names of the MCP client beans
- Since:
- 2.4.0
- Default:
{}
-
skills
String skillsThe name of the LangChain4jSkillsbean whose Agent Skills are offered to the service, for example the skills configured withlangchain4j.skills.<name>.Requires
dev.langchain4j:langchain4j-skillson the classpath. The service receives theactivate_skilltool and its system message lists the available skills.- Returns:
- The name of the skills bean
- Since:
- 2.4.0
- Default:
""
-
customizer
Class<? extends AiServiceCustomizer<?>> customizerA customizer can be registered to customize its creation.Normally these are picked up automatically if declared as beans, using this members allows the chosen customizer to be overridden.
- Returns:
- The customizer
- Default:
io.micronaut.langchain4j.annotation.AiService.NoOpCustomizer.class
-