UNPKG

@draftor/tools

Version:

A simple TypeScript/Javascript functions to openai tool call format

30 lines (29 loc) 938 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.foo = foo; const _1 = require("."); function foo(bar) { /** * @description Converts a number to its string representation. * @param {boolean} bar - The number to convert. * @param {number} abc - The number to convert. * @param {string} xyz - The number to convert. * @param {undefined} mpn - The number to convert. * @returns {object} The string representation of the input number. */ return bar.toString(); } const tool = new _1.Tools([foo]); console.log(tool.toOpenAI('string')); const y = { index: 0, id: 'call_F0tCbPIDQyzxGxYaFvuSGPQN', type: 'function', function: { name: 'foo', arguments: '{"bar":"Waba laba dub dub!"}', }, }; console.log('>>>>>>>>>>>>', tool.exec(y)); const funResp = tool.exec('foo', { bar: 'Waba laba dub dub!' }); console.log('>>>>>>>', funResp);