Class ToolSpecification
java.lang.Object
dev.langchain4j.agent.tool.ToolSpecification
Describes a tool that language model can execute.
Can be generated automatically from methods annotated with Tool using ToolSpecifications helper.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classToolSpecificationbuilder static inner class. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic ToolSpecification.Builderbuilder()Creates builder to buildToolSpecification.Returns the description of the tool.booleanstatic ToolSpecificationDeserializes aToolSpecificationfrom a JSON string.inthashCode()metadata()Returns the metadata relevant to the tool.name()Returns the name of the tool.Returns the parameters of the tool.toJson()Serializes thisToolSpecificationto a JSON string.toString()
-
Field Details
-
METADATA_SEARCH_BEHAVIOR
- See Also:
-
-
Method Details
-
name
-
description
Returns the description of the tool.- Returns:
- the description of the tool.
-
parameters
Returns the parameters of the tool. -
metadata
Returns the metadata relevant to the tool.NOTE: this metadata is not sent to the LLM provider API by default, you must explicitly specify which metadata keys should be sent when creating a
ChatModel.NOTE: Currently, tool metadata is supported only by the
langchain4j-anthropicmodule. -
equals
-
hashCode
-
toString
-
toJson
Serializes thisToolSpecificationto a JSON string.- Returns:
- a JSON string representing this tool specification.
- See Also:
-
fromJson
Deserializes aToolSpecificationfrom a JSON string.- Parameters:
json- the JSON string to deserialize.- Returns:
- the deserialized
ToolSpecification. - See Also:
-
toBuilder
-
builder
Creates builder to buildToolSpecification.- Returns:
- created builder
-