ads4gpts-langchain
Version:
Ads for AI applications. Enabling the Freemium model for the AI era.
32 lines • 1.68 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ADS4GPTsBannerTool = void 0;
const ADS4GPTsTool_1 = require("./ADS4GPTsTool");
const ADS4GPTsAPI_1 = require("../lib/api/ADS4GPTsAPI");
const toolsConfig_1 = __importDefault(require("../lib/config/toolsConfig"));
const utils_1 = require("../lib/utils");
class ADS4GPTsBannerTool extends ADS4GPTsTool_1.ADS4GPTsTool {
/**
* Constructs an instance of the ADS4GPTsBannerTool.
*
* @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.
*
* @throws Error if the API key is missing or the banner tool configuration is not found.
*/
constructor(args = {}) {
const baseUrl = args.rootUrl || 'https://with.ads4gpts.com';
const ads4gptsApiKey = (0, utils_1.getConfigValue)(args, 'apiKey', 'ADS4GPTS_API_KEY');
const ads4gptsAPI = new ADS4GPTsAPI_1.ADS4GPTsAPI(ads4gptsApiKey, baseUrl);
const bannerToolConfig = toolsConfig_1.default.find((tool) => tool.name === 'ads4gpts_banner_tool');
if (!bannerToolConfig) {
throw new Error('Banner tool configuration not found.');
}
super(ads4gptsAPI, bannerToolConfig.name, bannerToolConfig.url, bannerToolConfig.description, bannerToolConfig.parameters);
}
}
exports.ADS4GPTsBannerTool = ADS4GPTsBannerTool;
//# sourceMappingURL=ADS4GPTsBannerTool.js.map