UNPKG

@draftor/tools

Version:

A simple TypeScript/Javascript functions to openai tool call format

23 lines (22 loc) 821 B
import { ITools, ITool, IToolCall } from './types'; export declare class Tools implements ITools { private queue; private isProcessing; funcs: Function[] | undefined; constructor(funcs: Function[]); private extractFirstJsDocComment; private transformDoctrineToOpenAITool; toOpenAI(type?: string): ITool[] | string; /** * Processes the queue of function calls * @returns Array of results from executed functions */ private processQueue; /** * Adds function calls to queue and processes them * @param toolCalls Array of tool calls or function names * @param args Optional arguments for each call */ executeAll(toolCalls: Array<IToolCall | string>, args?: object[]): Promise<any[]>; exec(toolCall: IToolCall | string, args?: object): any; }