• Supported service: llm
  • Key: anthropic
  • Built-in: Yes
  • Supported model: claude-3-5-sonnet-20240620

Function Calling

Anthropic’s function calling documentation is located here. Here’s a quick example of the specific format you’ll need to use to specify your tools in rtvi.config.ts:

rtvi.config.ts
export const defaultConfig = [
  {
    service: "llm",
    options: [
      { name: "model", value: "claude-3-5-sonnet-20240620" },
      {
        name: "initial_messages",
        value: [
          {
            role: "user",
            content:
              "You are a TV weatherman named Wally. Your job is to present the weather to me. You can call the 'get_weather' function to get weather information. Start by asking me for my location. Then, use 'get_weather' to give me a forecast. Then, answer any questions I have about the weather. Keep your introduction and responses very brief. You don't need to tell me if you're going to call a function; just do it directly. Keep your words to a minimum. When you're delivering the forecast, you can use more words and personality.",
          },
        ],
      },
      { name: "run_on_config", value: true },
      {
        name: "tools",
        value: [
          {
            name: "get_weather",
            description:
              "Get the current weather for a location. This includes the conditions as well as the temperature.",
            input_schema: {
              type: "object",
              properties: {
                location: {
                  type: "string",
                  description:
                    "The user's location in the form 'city,state,country'. For example, if the user is in Austin, TX, use 'austin,tx,us'.",
                },
                format: {
                  type: "string",
                  enum: ["celsius", "fahrenheit"],
                  description:
                    "The temperature unit to use. Infer this from the user's location.",
                },
              },
              required: ["location", "format"],
            },
          },
        ],
      },
    ],
  },
];

For more info on how to use function calling in Daily Bots, take a look at the tutorial page.