UNPKG

box-node-sdk

Version:

Official SDK for Box Plaform APIs

78 lines 3.74 kB
"use strict"; var __rest = (this && this.__rest) || function (s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; var url_path_1 = __importDefault(require("../util/url-path")); /** */ var AIManager = /** @class */ (function () { /** * @param {BoxClient} client The Box API Client that is responsible for making calls to the API */ function AIManager(client) { this.client = client; } /** * Send AI question request * * Sends an AI request to supported LLMs and returns an answer specifically focused on the user's question given the provided context. * @param {schemas.AiAsk} body * @param {object} [options] Options for the request * @param {Function} [callback] Passed the result if successful, error otherwise * @returns {Promise<schemas.AiResponseFull>} A promise resolving to the result or rejecting with an error */ AIManager.prototype.ask = function (body, options, callback) { var queryParams = __rest(options, []), apiPath = (0, url_path_1.default)('ai', 'ask'), params = { qs: queryParams, body: body, }; return this.client.wrapWithDefaultHandler(this.client.post)(apiPath, params, callback); }; /** * Send AI request to generate text * * Sends an AI request to supported LLMs and returns an answer specifically focused on the creation of new text. * @param {schemas.AiTextGen} body * @param {object} [options] Options for the request * @param {Function} [callback] Passed the result if successful, error otherwise * @returns {Promise<schemas.AiResponse>} A promise resolving to the result or rejecting with an error */ AIManager.prototype.textGen = function (body, options, callback) { var queryParams = __rest(options, []), apiPath = (0, url_path_1.default)('ai', 'text_gen'), params = { qs: queryParams, body: body, }; return this.client.wrapWithDefaultHandler(this.client.post)(apiPath, params, callback); }; /** * Get AI agent default configuration * * Get the AI agent default config * @param {object} options Options for the request * @param {"ask" | "text_gen"} options.mode The mode to filter the agent config to return. * @param {string} [options.language] The ISO language code to return the agent config for. If the language is not supported the default agent config is returned. * @param {string} [options.model] The model to return the default agent config for. * @param {Function} [callback] Passed the result if successful, error otherwise * @returns {Promise<schemas.AiAgentAsk | schemas.AiAgentTextGen>} A promise resolving to the result or rejecting with an error */ AIManager.prototype.getAiAgentDefaultConfig = function (options, callback) { var queryParams = __rest(options, []), apiPath = (0, url_path_1.default)('ai_agent_default'), params = { qs: queryParams, }; return this.client.wrapWithDefaultHandler(this.client.get)(apiPath, params, callback); }; return AIManager; }()); module.exports = AIManager; //# sourceMappingURL=ai.generated.js.map