java.lang.Object
nl.dannyj.mistral.models.completion.tool.Function

public class Function extends Object
Represents the definition of a function that can be called by the model. This is used when defining tools available to the model in a ChatCompletionRequest.
  • Constructor Details

    • Function

      public Function()
    • Function

      public Function(String name, String description, String parameters, boolean strict)
      Creates a new Function instance.
      Parameters:
      name - The name of the function.
      description - The description of the function.
      parameters - A JSON string representing the parameters schema.
      strict - Whether strict schema adherence is enabled.
  • Method Details

    • builder

      public static Function.FunctionBuilder builder()
    • getName

      public String getName()
      The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
      Returns:
      The name of the function.
    • getDescription

      public String getDescription()
      A description of what the function does, used by the model to choose when and how to call the function.
      Returns:
      The description of the function.
    • getParameters

      public String getParameters()
      The parameters the function accepts, described as a JSON Schema object. See the guide for more information. The user of this SDK should provide a valid JSON string representing the schema.
      Returns:
      A JSON string representing the parameters schema.
    • isStrict

      public boolean isStrict()
      Whether to enable strict schema adherence for the function parameters. When true, the model will make a best effort to adhere to the JSON schema. See the guide for more details. Defaults to false.
      Returns:
      True if strict schema adherence is enabled, false otherwise.
    • setName

      public void setName(String name)
      The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
      Parameters:
      name - The name of the function.
    • setDescription

      public void setDescription(String description)
      A description of what the function does, used by the model to choose when and how to call the function.
      Parameters:
      description - The description of the function.
    • setParameters

      public void setParameters(String parameters)
      The parameters the function accepts, described as a JSON Schema object. See the guide for more information. The user of this SDK should provide a valid JSON string representing the schema.
      Parameters:
      parameters - A JSON string representing the parameters schema.
    • setStrict

      public void setStrict(boolean strict)
      Whether to enable strict schema adherence for the function parameters. When true, the model will make a best effort to adhere to the JSON schema. See the guide for more details. Defaults to false.
      Parameters:
      strict - Whether strict schema adherence is enabled.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object