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

public class ToolCall extends Object
Represents a tool call requested by the model as part of an Assistant message. Based on the 'ToolCall' definition in the Mistral AI API specification.
  • Constructor Details

    • ToolCall

      public ToolCall()
    • ToolCall

      public ToolCall(@Nullable String id, ToolType type, FunctionCall function, int index)
      Creates a new ToolCall instance.
      Parameters:
      id - The tool call ID.
      type - The tool type.
      function - The function call details.
      index - The index of the tool call.
  • Method Details

    • getId

      @Nullable public String getId()
      The unique identifier for this specific tool call. This ID is required when sending a response back using a ToolMessage.
      Returns:
      The tool call ID, or null if not provided by the API.
    • getType

      public ToolType getType()
      The type of the tool being called. Currently only 'function' is supported. Defaults to FUNCTION if not specified.
      Returns:
      The tool type.
    • getFunction

      public FunctionCall getFunction()
      The details of the function to be called. Required.
      Returns:
      The function call details.
    • getIndex

      public int getIndex()
      The index of the tool call in the list, if multiple calls are made. Defaults to 0 if not specified by the API.
      Returns:
      The index.
    • setId

      public void setId(@Nullable String id)
      The unique identifier for this specific tool call. This ID is required when sending a response back using a ToolMessage.
      Parameters:
      id - The tool call ID.
    • setType

      public void setType(ToolType type)
      The type of the tool being called. Currently only 'function' is supported. Defaults to FUNCTION if not specified.
      Parameters:
      type - The tool type.
    • setFunction

      public void setFunction(FunctionCall function)
      The details of the function to be called. Required.
      Parameters:
      function - The function call details.
    • setIndex

      public void setIndex(int index)
      The index of the tool call in the list, if multiple calls are made. Defaults to 0 if not specified by the API.
      Parameters:
      index - The index of the tool call.
    • 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