Skip to content

Commit 77977b9

Browse files
committed
refactor(mavrochat): remove unused weather and temperature conversion tools from chat API
1 parent c112aa1 commit 77977b9

File tree

1 file changed

+1
-53
lines changed

1 file changed

+1
-53
lines changed

apps/mavrochat/src/app/api/chat/route.ts

Lines changed: 1 addition & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { openai, createOpenAI } from '@ai-sdk/openai';
22
import { createAnthropic } from '@ai-sdk/anthropic';
3-
import { streamText, tool } from 'ai';
3+
import { streamText } from 'ai';
44
import { z } from 'zod';
55
import { NextResponse } from 'next/server';
66
import { checkRateLimit } from '@/lib/rate-limit';
@@ -184,58 +184,6 @@ export async function POST(req: Request) {
184184
system: 'You are a helpful assistant. Respond to the user in Markdown format.',
185185
model: getModelProvider(model, customApiKey),
186186
messages,
187-
tools: {
188-
weather: tool({
189-
description: 'Get the weather in a location (fahrenheit)',
190-
parameters: z.object({
191-
location: z
192-
.string()
193-
.describe('The location to get the weather for'),
194-
}),
195-
execute: async ({ location }) => {
196-
try {
197-
// In a real app, this would call a weather API
198-
const temperature = Math.round(
199-
Math.random() * (90 - 32) + 32,
200-
);
201-
return {
202-
location,
203-
temperature,
204-
};
205-
} catch (error) {
206-
console.error('Weather tool error:', error);
207-
throw new Error('Failed to get weather data');
208-
}
209-
},
210-
}),
211-
convertFahrenheitToCelsius: tool({
212-
description:
213-
'Convert a temperature in fahrenheit to celsius',
214-
parameters: z.object({
215-
temperature: z
216-
.number()
217-
.describe(
218-
'The temperature in fahrenheit to convert',
219-
),
220-
}),
221-
execute: async ({ temperature }) => {
222-
try {
223-
const celsius = Math.round(
224-
(temperature - 32) * (5 / 9),
225-
);
226-
return {
227-
celsius,
228-
};
229-
} catch (error) {
230-
console.error(
231-
'Temperature conversion error:',
232-
error,
233-
);
234-
throw new Error('Failed to convert temperature');
235-
}
236-
},
237-
}),
238-
},
239187
onFinish: ({ usage, finishReason }) => {
240188
// Log completion metrics
241189
console.log('Chat completion:', {

0 commit comments

Comments
 (0)