• Supported service: llm
  • Key: openai
  • Built-in: No. See BYO Keys for more details.
  • Supported models: Any listed here

Function calling

OpenAI’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: "gpt-4o" },
      {
        name: "initial_messages",
        value: [
          {
            role: "system",
            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: [
          {
            type: "function",
            function: {
              name: "get_current_weather",
              description:
                "Get the current weather for a location. This includes the conditions as well as the temperature.",
              parameters: {
                type: "object",
                properties: {
                  location: {
                    type: "string",
                    description: "The city and state, e.g. San Francisco, CA",
                  },
                  format: {
                    type: "string",
                    enum: ["celsius", "fahrenheit"],
                    description:
                      "The temperature unit to use. Infer this from the users location.",
                  },
                },
                required: ["location", "format"],
              },
            },
          },
        ],
      },
    ],
  },
];

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