Skip to main content

Adding Tools

Adaline enables you to add tools to LLMs that support function calling. Tools are part of the prompt and are sent to the LLM alongside your messages. You can add multiple tools in your prompt, each representing a unique call to an external service that the LLM can invoke. To add tools, follow the steps below:
1

Choose a supported LLM

Select an LLM that supports tool calling.Selecting an LLM in Adaline
2

Write a prompt

Write a prompt (that needs a tool call).Create a prompt that needs tool calling
3

Enable tool choice

Enable the tool choice feature.Enabling tool choice
4

Configure tool choice

Ensure the tool choice feature is properly set in the LLM settings to allow the LLM to generate tool calls effectively.Configuring the tool choiceDepending on the LLM, choose among the following:
  • none: Instructs the LLM to not invoke any tool.
  • auto: Lets the LLM decide which tool and how many to use, based on the content of the message or the conversation.
  • required: Forces the LLM to invoke at least one tool.
  • any: Allows the LLM to call any of the available tools.
5

Add a tool

Add a tool by clicking on Add Tool.Adding a tool role

Tools Schema Definition

Adaline supports tools with JSON schema format, giving you precise control over tool definitions and parameter validation. Define your tool’s schema within the schema property of the tool definition. When clicking on Add tool, the system will show a new section where you can define the schema of the tool you want to call: Defining the schema for a new tool
NOTE: Refer to the OpenAI JSON schema for more examples.
Below is the complete JSON for defining the schema of the tool calls:
tools' JSON schema structure

{
  "type": "function",
  "definition": {
    "schema": {
      "name": "get_weather",
      "description": "Get the current weather in a given location",
      "parameters": {
        "type": "object",
        "properties": {
          "location": {
            "type": "string",
            "description": "The city and state, e.g. San Francisco, CA"
          },
          "unit": {
            "type": "string",
            "enum": [
              "celsius",
              "fahrenheit"
            ]
          }
        },
        "required": [
          "location"
        ]
      }
    }
  }
}

The following table describes the schema structure:
ParameterTypeDescriptionRequired
typeStringAlways set it to “function”Yes
nameStringThe name of the toolYes
descriptionStringDescribes what the tool doesYes
parameters.typeObjectThe parameter structure (“object” is a typical choice)No
parameters.propertiesObjectDefines individual parameter’s definitions with types and descriptions.No
requiredArrayLists the mandatory parameter namesNo

Request Structure

Optionally, you can configure the tool’s HTTP request endpoint, headers, etc. By adding a request object to a tool you configure it for ‘Auto Tool Calls’ in the Playground. If the LLM invokes this tool, the Playground will fetch a response from the custom backend configured and continue the conversation with LLM. The JSON below shows the complete schema when adding request parameters:
tools' JSON schema structure with request
{
  "type": "function",
  "definition": {
    "schema": {
      "name": "get_weather",
      "description": "Get the current weather in a given location",
      "parameters": {
        "type": "object",
        "properties": {
          "location": {
            "type": "string",
            "description": "The city and state, e.g. San Francisco, CA"
          },
          "unit": {
            "type": "string",
            "enum": [
              "celsius",
              "fahrenheit"
            ]
          }
        },
        "required": [
          "location"
        ]
      }
    }
  },
  "request": {
    "type": "http",
    "method": "get",
    "url": "https://api.my-tool-backend.com/get_weather",
    "headers": {
      "Content-Type": "application/json",
      "Authorization": "Bearer <your-api-key>"
    },
    "retry": {
      "maxAttempts": 3,
      "initialDelay": 1000,
      "exponentialFactor": 2
    }
  }
}
The table below describes the request structure:
ParameterTypeDescriptionRequired
typeStringAlways set it to “http”Yes
methodStringThe HTTP method used for the call (GET or POST)Yes
urlStringThe URL of the endpoint to callYes
retryObjectDefine a retry mechanism for failed requestsNo