Package org.machanism.machai.ai.tools
Class ParamDescriptor
java.lang.Object
org.machanism.machai.ai.tools.ParamDescriptor
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 Summary
FieldsModifier and TypeFieldDescriptionprivate ObjectDefault value supplied when the corresponding parameter is omitted.(package private) StringDescription of the parameter's purpose or usage.(package private) StringThe parameter's name.(package private) booleanIndicates whether the parameter is required.(package private) StringThe parameter's data type. -
Constructor Summary
ConstructorsConstructorDescriptionParamDescriptor(String name, String type, boolean required, String description, Object defaultValue) Constructs a newParamDescriptorwith the specified properties. -
Method Summary
Modifier and TypeMethodDescriptionReturns the configured default value, translating theParam.NULLandParam.NOT_DEFINEDsentinel values tonull.Returns a description of the parameter's purpose or usage.getName()Returns the parameter's name.getType()Returns the parameter's data type.booleanIndicates whether the parameter is required.voidsetDefaultValue(Object defaultValue) Sets the value used when the corresponding parameter is omitted.
-
Field Details
-
name
String nameThe parameter's name. -
type
String typeThe parameter's data type. -
required
boolean requiredIndicates whether the parameter is required. -
description
String descriptionDescription of the parameter's purpose or usage. -
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 newParamDescriptorwith the specified properties.- Parameters:
name- the parameter's nametype- the parameter's data typerequired- whether the parameter is mandatorydescription- a brief description of the parameter's purpose or usagedefaultValue- default value supplied when the parameter is omitted
-
-
Method Details
-
getName
Returns the parameter's name.- Returns:
- the name of the parameter
-
getType
Returns the parameter's data type.- Returns:
- the data type of the parameter
-
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:
trueif the parameter is mandatory;falseotherwise
-
getDefaultValue
Returns the configured default value, translating theParam.NULLandParam.NOT_DEFINEDsentinel values tonull.- Returns:
- the default value, or
nullwhen no default is defined
-
setDefaultValue
Sets the value used when the corresponding parameter is omitted.- Parameters:
defaultValue- the default value to store
-