chat + maps + ai + tools

This commit is contained in:
geoffsee
2025-07-08 13:53:36 -04:00
parent 24351b0be7
commit 5630a95f1a
14 changed files with 384 additions and 105 deletions

View File

@@ -0,0 +1,25 @@
export async function getWeather(latitude: any, longitude: any) {
const response = await fetch(
`https://api.open-meteo.com/v1/forecast?latitude=${latitude}&longitude=${longitude}&current=temperature_2m,wind_speed_10m&hourly=temperature_2m,relative_humidity_2m,wind_speed_10m`,
);
const data = await response.json();
return data.current.temperature_2m;
}
export const WeatherTool = {
type: 'function',
function: {
name: 'get_weather',
description: 'Get current temperature for provided coordinates in celsius.',
parameters: {
type: 'object',
properties: {
latitude: { type: 'number' },
longitude: { type: 'number' },
},
required: ['latitude', 'longitude'],
additionalProperties: false,
},
strict: true,
},
};