Class ToolSpecification.Builder

java.lang.Object
dev.langchain4j.agent.tool.ToolSpecification.Builder
Enclosing class:
ToolSpecification

public static final class ToolSpecification.Builder extends Object
ToolSpecification builder static inner class.
  • Method Details

    • name

      public ToolSpecification.Builder name(String name)
      Sets the name.
      Parameters:
      name - the name
      Returns:
      this
    • description

      public ToolSpecification.Builder description(String description)
      Sets the description.
      Parameters:
      description - the description
      Returns:
      this
    • parameters

      public ToolSpecification.Builder parameters(ToolParameters parameters)
      Sets the parameters.
      Parameters:
      parameters - the parameters
      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

      public ToolSpecification build()
      Returns a ToolSpecification built from the parameters previously set.
      Returns:
      a ToolSpecification built with parameters of this ToolSpecification.Builder