blob: 65416bb404923584940f67c5838239be4582697d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
import type { ToolContract, ToolParameterSchema } from "@dispatch/kernel";
export interface OpenAITool {
readonly type: "function";
readonly function: {
readonly name: string;
readonly description: string;
readonly parameters: ToolParameterSchema;
};
}
export function convertTools(tools: readonly ToolContract[]): OpenAITool[] {
return tools.map(convertTool);
}
function convertTool(tool: ToolContract): OpenAITool {
return {
type: "function",
function: {
name: tool.name,
description: tool.description,
parameters: tool.parameters,
},
};
}
|