A tool that can be called from an LLM during the conversation. See https://docs.syllable.ai/Resources/Tools.

Example Usage

import { ToolDefinition } from "syllable-sdk/models/components";

let value: ToolDefinition = {
  tool: {
    function: {
      name: "weather_fetcher",
      description: "Fetches weather data",
      parameters: "<value>",
    },
  },
  endpoint: {
    url: "https://api.example.com",
    method: "get",
    argumentLocation: "body",
  },
  defaults: {
    "key": {
      transform: {
        action: "default",
        when: {
          key: "key",
          value: "value",
        },
      },
    },
  },
};

Fields

FieldTypeRequiredDescription
typecomponents.TypeFALSEThe action to take when the LLM calls the tool.
toolcomponents.InternalToolTRUEA tool definition to be used by the OpenAI API.
endpointcomponents.ToolHttpEndpointFALSEThe configuration for an HTTP API call.
defaultscomponents.DefaultsFALSEThe default values for the parameters of the function/tool call.
staticParameterscomponents.StaticToolParameter[]FALSEParameters for the tool whose values should be set at config time (i.e., not provided by the LLM).
resultanyFALSEThe optional result of the tool call. Only used for context tools.