BotConnector
Sign in Workspace Open App

TypeScript tools

Beta

Tool calling is Experimental at the runtime level (see Tool use); model/template support varies. The source SDK is implemented, but its npm package is not published.

Target SDK design

typescript
import { BotConnectorClient } from "@botconnector/sdk";

const client = new BotConnectorClient();
const model = await client.llm("<publisher>/<model>");

const tools = [{
  type: "function",
  function: {
    name: "get_weather",
    description: "Get current weather",
    parameters: {
      type: "object",
      properties: { city: { type: "string" } },
      required: ["city"],
    },
  },
}];

const reply = await model.chat("What is the weather in Jakarta?", { tools });
if (reply.toolCalls?.length) {
  const result = await myWeatherImpl(reply.toolCalls[0].arguments.city);
  // feed result back and continue the conversation
}
Tool-call reliability depends on model + chat template. Use the source SDK or OpenAI-compatible API — see Tool use — with the caveats listed there.