UNPKG

ads4gpts-langchain

Version:

Ads for AI applications. Enabling the Freemium model for the AI era.

33 lines 1.49 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const ADS4GPTsAPI_1 = require("./lib/api/ADS4GPTsAPI"); const ADS4GPTsTool_1 = require("./tools/ADS4GPTsTool"); const toolsConfig_1 = __importDefault(require("./lib/config/toolsConfig")); const utils_1 = require("./lib/utils"); class ADS4GPTsToolkit { ads4gptsAPI; tools; /** * Constructs the ADS4GPTsToolkit instance and initializes tools. * @param args - A record of key-value pairs, including an optional API key. * @param args.apiKey - Ads4GPTs API key. If not provided, it will attempt to retrieve it from the `ADS4GPTS_API_KEY` environment variable. */ constructor(args = {}) { const baseUrl = args.rootUrl || 'https://with.ads4gpts.com'; const ads4gptsApiKey = (0, utils_1.getConfigValue)(args, 'apiKey', 'ADS4GPTS_API_KEY'); this.ads4gptsAPI = new ADS4GPTsAPI_1.ADS4GPTsAPI(ads4gptsApiKey, baseUrl); this.tools = toolsConfig_1.default.map((tool) => new ADS4GPTsTool_1.ADS4GPTsTool(this.ads4gptsAPI, tool.name, tool.url, tool.description, tool.parameters)); } /** * Returns the list of initialized tools. * @returns {ADS4GPTsTool[]} Array of tools. */ getTools() { return this.tools; } } exports.default = ADS4GPTsToolkit; //# sourceMappingURL=toolkit.js.map