Class AiServiceTool
java.lang.Object
dev.langchain4j.service.tool.AiServiceTool
Represents a tool managed by an AI Service, combining:
ToolSpecification— what is sent to the LLMToolExecutor— what is called when the LLM invokes the tool- Metadata that controls how the AI Service handles this tool (e.g.,
ReturnBehavior)
- Since:
- 1.13.0
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic AiServiceTool.Builderbuilder()booleaninthashCode()booleanDeprecated.name()Returns theToolInputGuardrails of this tool.Returns theToolOutputGuardrails of this tool.Returns where this tool comes from.toString()The guardrails are shown by their class names, not by their owntoString, which may print what they hold (a token, an API key).
-
Method Details
-
name
-
toolSpecification
-
toolExecutor
-
returnBehavior
- Since:
- 1.14.0
-
toolSource
Returns where this tool comes from. It is trusted information, set by the framework or by the application, and exposed to tool guardrails. Without an explicit source, a tool backed by aDefaultToolExecutorislocal(the original method of the executor), and any other tool isprogrammatic.- Returns:
- where this tool comes from
- Since:
- 1.25.0
-
toolInputGuardrails
Returns theToolInputGuardrails of this tool. They run after the guardrails set on theAiServicesbuilder, after the guardrails of the class annotation and after the ones of the method annotation, if any.- Returns:
- the tool input guardrails of this tool, empty if it has none
- Since:
- 1.25.0
-
toolOutputGuardrails
Returns theToolOutputGuardrails of this tool. They run first, before the guardrails of the method annotation, the ones of the class annotation, if any, and the guardrails set on theAiServicesbuilder, which run last.- Returns:
- the tool output guardrails of this tool, empty if it has none
- Since:
- 1.25.0
-
immediateReturn
Deprecated.usereturnBehavior()instead -
equals
-
hashCode
-
toString
-
toBuilder
-
builder
-
returnBehavior()instead