Refactor chat-stream-provider to simplify tool structure. Optimize WeatherTool implementation with enriched function schema.

This commit is contained in:
geoffsee
2025-07-08 11:47:46 -04:00
committed by Geoff Seemueller
parent 06b6a68b9b
commit 858282929c
2 changed files with 21 additions and 30 deletions

View File

@@ -34,8 +34,23 @@ export const WeatherTool = {
required: ['location'],
additionalProperties: false,
},
function: async (params: { location: string }) => {
console.log('[WeatherTool] Getting weather for:', params.location);
return { temperature: '25°C' };
function: {
name: 'getCurrentTemperature',
description: 'Get the current temperature for a specific location',
parameters: {
type: 'object',
properties: {
location: {
type: 'string',
description: 'The city and state, e.g., San Francisco, CA',
},
unit: {
type: 'string',
enum: ['Celsius', 'Fahrenheit'],
description: "The temperature unit to use. Infer this from the user's location.",
},
},
required: ['location', 'unit'],
},
},
};