UNPKG

@n8n/n8n-nodes-langchain

Version:

![Banner image](https://user-images.githubusercontent.com/10284570/173569848-c624317f-42b1-45a6-ab09-f0ea3c247648.png)

68 lines 2.46 kB
"use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var execute_exports = {}; __export(execute_exports, { execute: () => execute }); module.exports = __toCommonJS(execute_exports); var import_process = require("./process"); var import_configureNodeInputs = require("../helpers/configureNodeInputs"); var import_model = require("../helpers/model"); async function execute() { const items = this.getInputData(); const operation = this.getNodeParameter("operation", 0); const model = (0, import_configureNodeInputs.hasLLMGuardrails)(this.getNodeParameter("guardrails", 0)) ? await import_model.getChatModel.call(this) : null; const failedItems = []; const passedItems = []; for (let i = 0; i < items.length; i++) { try { const responseData = await import_process.process.call(this, i, model); if (responseData.passed) { passedItems.push({ json: { guardrailsInput: responseData.guardrailsInput, ...responseData.passed }, pairedItem: { item: i } }); } if (responseData.failed) { failedItems.push({ json: { guardrailsInput: responseData.guardrailsInput, ...responseData.failed }, pairedItem: { item: i } }); } } catch (error) { if (this.continueOnFail()) { failedItems.push({ json: { error: error.message, guardrailsInput: "" }, pairedItem: { item: i } }); } else { throw error; } } } if (operation === "classify") { return [passedItems, failedItems]; } return [passedItems]; } // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { execute }); //# sourceMappingURL=execute.js.map