Chathive SDK
  • Chathive documentation
  • What's new in the Chathive docs?
  • Api
    • REST API
  • Crawler
    • Overview
    • Crawler config
      • Login
    • Attributes
  • SDK
    • Getting started
    • Chatbot
      • Methods
      • Events
      • Attributes
    • AI form
      • Configuration
      • Methods
      • Events
    • Attributes
  • Tools
    • Overview
    • Parameters
    • Format response
Powered by GitBook
On this page
  • Define Parameters in JSON Schema
  • How the AI Uses These Parameters
  • Returning the Response

Was this helpful?

  1. Tools

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.

PreviousOverviewNextFormat response

Last updated 3 months ago

Was this helpful?

Format response