Parameters
When you configure your tool, you can define the parameters your AI model should provide. These parameters follow a JSON schema, ensuring structured and validated inputs.
Define Parameters in JSON Schema
Each parameter should include:
name: The parameter's key.
type: The expected data type (
string,number,boolean, etc.).description: A brief explanation of the parameter.
required: Whether the parameter is mandatory.
Here’s an example schema for the get_weather tool:
{
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The name of the city or geographic coordinates for weather lookup."
},
"unit": {
"type": "string",
"enum": ["metric", "imperial"],
"description": "The temperature unit: 'metric' for Celsius, 'imperial' for Fahrenheit."
}
},
"required": ["location"],
"additionalProperties": false,
}How the AI Uses These Parameters
When the AI calls the get_weather tool, it provides values based on the defined schema. For example, the AI might generate the following request:
{
"location": "New York",
"unit": "metric"
}If a parameter is marked as required, the AI will always provide it.
Optional parameters, like
unit, will only be included if the AI model thinks it is necessary.
Returning the Response
Once the tool processes the request, it should return a structured response, which can also be formatted before passing it back to the AI.
Format responseLast updated
Was this helpful?