Class ParamDescriptor

java.lang.Object
org.machanism.machai.ai.tools.ParamDescriptor

public class ParamDescriptor extends Object
Descriptor for a parameter used in tool or prompt definitions within the AI provider framework.

The ParamDescriptor class encapsulates metadata about a parameter, including its name, type, whether it is required, and a description of its purpose or usage.

  • name: The parameter's name.
  • type: The parameter's data type (e.g., "String", "Integer", "JsonNode").
  • required: Indicates whether the parameter is mandatory.
  • description: A brief description of the parameter's purpose or usage.

This class is typically used to document and validate parameters for tool functions, prompts, or other callable entities within the framework.

  • Field Details

    • name

      String name
      The parameter's name.
    • type

      String type
      The parameter's data type.
    • required

      boolean required
      Indicates whether the parameter is required.
    • description

      String description
      Description of the parameter's purpose or usage.
    • defaultValue

      private Object defaultValue
      Default value supplied when the corresponding parameter is omitted.
  • Constructor Details

    • ParamDescriptor

      public ParamDescriptor(String name, String type, boolean required, String description, Object defaultValue)
      Constructs a new ParamDescriptor with the specified properties.
      Parameters:
      name - the parameter's name
      type - the parameter's data type
      required - whether the parameter is mandatory
      description - a brief description of the parameter's purpose or usage
      defaultValue - default value supplied when the parameter is omitted
  • Method Details

    • getName

      public String getName()
      Returns the parameter's name.
      Returns:
      the name of the parameter
    • getType

      public String getType()
      Returns the parameter's data type.
      Returns:
      the data type of the parameter
    • getDescription

      public String getDescription()
      Returns a description of the parameter's purpose or usage.
      Returns:
      the parameter description
    • isRequired

      public boolean isRequired()
      Indicates whether the parameter is required.
      Returns:
      true if the parameter is mandatory; false otherwise
    • getDefaultValue

      public Object getDefaultValue()
      Returns the configured default value, translating the Param.NULL and Param.NOT_DEFINED sentinel values to null.
      Returns:
      the default value, or null when no default is defined
    • setDefaultValue

      public void setDefaultValue(Object defaultValue)
      Sets the value used when the corresponding parameter is omitted.
      Parameters:
      defaultValue - the default value to store