Sahil
02/18/2025, 10:06 AMSlaviSavanovic
02/18/2025, 4:00 PMSlaviSavanovic
02/18/2025, 4:01 PMPraveen
02/18/2025, 8:41 PMSahil
02/19/2025, 5:01 AMHello, I'm Marie, your dedicated assistant. You can ask me about weather updates!
,
},
],
tools: [{
"type": "function",
"function": {
"name": "get_weather",
"description": "Retrieves current weather for the given location.",
"strict": true,
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "City and country e.g. Bogotá, Colombia"
},
"units": {
"type": ["string", "null"],
"enum": ["celsius", "fahrenheit"],
"description": "Units the temperature will be returned in."
}
},
"required": ["location", "units"],
"additionalProperties": false
}
},
"async":false
}]
},
};Sahil
02/19/2025, 5:04 AMFetching weather for ${location} with units in ${units}...
);
let temperature = units === "fahrenheit" ? "77°F" : "25°C";
let condition = "Sunny";
return {
results: [
{
result: ${location}'s weather today is ${temperature}, ${condition}.
,
},
],
};
};Sahil
02/19/2025, 6:19 AMCalling get_weather for location: ${location}, units: ${units}
);
const weatherData = await get_weather({ location, units });
console.log("Responding with weather data:", weatherData);
vapi.respondToToolCall(toolCall, weatherData);
}
});SlaviSavanovic
02/19/2025, 4:17 PMSahil
02/20/2025, 4:49 AMShubham Bajaj
02/21/2025, 7:02 AMSahil
02/25/2025, 4:22 AM