@draftor/tools
Version:
A simple TypeScript/Javascript functions to openai tool call format
32 lines (31 loc) • 685 B
TypeScript
export interface IParam {
type: 'object';
properties: Record<string, {
type: string;
description: string;
}>;
}
export interface ITools {
toOpenAI: (type?: string) => string | ITool[];
exec(input: IToolCall): any;
exec(func: string, params: object): any;
}
export interface ITool {
type: 'function';
function: IFunctionDescription;
}
export interface IToolCall {
index: number;
id: string;
type: 'function';
function: IFunctionCall;
}
export interface IFunctionDescription {
description?: string;
name: string;
parameters: object;
}
export interface IFunctionCall {
name: string;
arguments: string;
}