24 lines
566 B
TypeScript
24 lines
566 B
TypeScript
import { weatherTool } from './weather.js';
|
|
import { calculatorTool } from './calculator.js';
|
|
import { Tool } from '../types/index.js';
|
|
|
|
const tools: Tool[] = [weatherTool, calculatorTool];
|
|
|
|
export function getTools(): Tool[] {
|
|
return tools;
|
|
}
|
|
|
|
export function getOpenAITools() {
|
|
return tools.map((t) => ({
|
|
type: 'function' as const,
|
|
function: {
|
|
name: t.name,
|
|
description: t.description,
|
|
parameters: t.parameters,
|
|
},
|
|
}));
|
|
}
|
|
|
|
export function findTool(name: string): Tool | undefined {
|
|
return tools.find((t) => t.name === name);
|
|
} |