Package dev.langchain4j.agent.tool
Class ToolSpecification.Builder
java.lang.Object
dev.langchain4j.agent.tool.ToolSpecification.Builder
- Enclosing class:
ToolSpecification
ToolSpecification
builder static inner class.-
Method Summary
Modifier and TypeMethodDescriptionaddOptionalParameter
(String name, JsonSchemaProperty... jsonSchemaProperties) Adds an optional parameter to the tool.addOptionalParameter
(String name, Iterable<JsonSchemaProperty> jsonSchemaProperties) Adds an optional parameter to the tool.addParameter
(String name, JsonSchemaProperty... jsonSchemaProperties) Adds a parameter to the tool.addParameter
(String name, Iterable<JsonSchemaProperty> jsonSchemaProperties) Adds a parameter to the tool.build()
Returns aToolSpecification
built from the parameters previously set.description
(String description) Sets thedescription
.Sets thename
.parameters
(ToolParameters parameters) Sets theparameters
.
-
Method Details
-
name
Sets thename
.- Parameters:
name
- thename
- Returns:
this
-
description
Sets thedescription
.- Parameters:
description
- thedescription
- Returns:
this
-
parameters
Sets theparameters
.- Parameters:
parameters
- theparameters
- Returns:
this
-
addParameter
public ToolSpecification.Builder addParameter(String name, JsonSchemaProperty... jsonSchemaProperties) Adds a parameter to the tool.- Parameters:
name
- the name of the parameter.jsonSchemaProperties
- the properties of the parameter.- Returns:
this
-
addParameter
public ToolSpecification.Builder addParameter(String name, Iterable<JsonSchemaProperty> jsonSchemaProperties) Adds a parameter to the tool.- Parameters:
name
- the name of the parameter.jsonSchemaProperties
- the properties of the parameter.- Returns:
this
-
addOptionalParameter
public ToolSpecification.Builder addOptionalParameter(String name, JsonSchemaProperty... jsonSchemaProperties) Adds an optional parameter to the tool.- Parameters:
name
- the name of the parameter.jsonSchemaProperties
- the properties of the parameter.- Returns:
this
-
addOptionalParameter
public ToolSpecification.Builder addOptionalParameter(String name, Iterable<JsonSchemaProperty> jsonSchemaProperties) Adds an optional parameter to the tool.- Parameters:
name
- the name of the parameter.jsonSchemaProperties
- the properties of the parameter.- Returns:
this
-
build
Returns aToolSpecification
built from the parameters previously set.- Returns:
- a
ToolSpecification
built with parameters of thisToolSpecification.Builder
-