Class Function
java.lang.Object
nl.dannyj.mistral.models.completion.tool.Function
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.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Function.FunctionBuilder
builder()
protected boolean
boolean
A description of what the function does, used by the model to choose when and how to call the function.getName()
The name of the function to be called.The parameters the function accepts, described as a JSON Schema object.int
hashCode()
boolean
isStrict()
Whether to enable strict schema adherence for the function parameters.void
setDescription
(String description) A description of what the function does, used by the model to choose when and how to call the function.void
The name of the function to be called.void
setParameters
(String parameters) The parameters the function accepts, described as a JSON Schema object.void
setStrict
(boolean strict) Whether to enable strict schema adherence for the function parameters.toString()
-
Constructor Details
-
Function
public Function() -
Function
Creates a newFunction
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
-
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
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
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
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
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
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
-
canEqual
-
hashCode
public int hashCode() -
toString
-