Class AbstractToolParameter<T extends AbstractTool<?,?>>

java.lang.Object
uno.anahata.asi.agi.tool.spi.AbstractToolParameter<T>
Type Parameters:
T - The type of the tool this parameter belongs to.
Direct Known Subclasses:
BadToolParam, JavaMethodToolParameter

public abstract class AbstractToolParameter<T extends AbstractTool<?,?>> extends Object
A rich, self-documenting, abstract representation of a single parameter for a tool method. This is the base class for all tool parameters.
Author:
anahata-gemini-pro-2.5
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final @NonNull String
    A detailed description of the parameter's purpose and expected format.
    private final @NonNull String
    A pre-generated, language-agnostic JSON schema for this parameter.
    private final @NonNull String
    The name of the parameter.
    private final String
    An optional identifier for a custom UI renderer for this parameter.
    private final boolean
    Whether this parameter is required for the tool call.
    protected final T
    The tool this parameter belongs to.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Calculates the token count of this parameter on-the-fly using the active model's tokenizer.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • tool

      @NonNull protected final T extends AbstractTool<?,?> tool
      The tool this parameter belongs to.
    • name

      @NonNull private final @NonNull String name
      The name of the parameter.
    • description

      @NonNull private final @NonNull String description
      A detailed description of the parameter's purpose and expected format.
    • jsonSchema

      @NonNull private final @NonNull String jsonSchema
      A pre-generated, language-agnostic JSON schema for this parameter.
    • required

      private final boolean required
      Whether this parameter is required for the tool call.
    • rendererId

      private final String rendererId
      An optional identifier for a custom UI renderer for this parameter.
  • Constructor Details

    • AbstractToolParameter

      public AbstractToolParameter()
  • Method Details

    • getTokenCount

      public int getTokenCount(AbstractModel model)
      Calculates the token count of this parameter on-the-fly using the active model's tokenizer. The count is a provider-agnostic approximation of the token overhead, calculated by summing the tokens in its description and JSON schema.
      Parameters:
      model - The active model instance to use for tokenization.
      Returns:
      The total token count.