@n8n/n8n-nodes-langchain
Version:

84 lines • 2.77 kB
JavaScript
;
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 configureNodeInputs_exports = {};
__export(configureNodeInputs_exports, {
configureNodeInputsV1: () => configureNodeInputsV1,
configureNodeInputsV2: () => configureNodeInputsV2,
hasLLMGuardrails: () => hasLLMGuardrails
});
module.exports = __toCommonJS(configureNodeInputs_exports);
const LLM_CHECKS = ["nsfw", "topicalAlignment", "custom", "jailbreak"];
const hasLLMGuardrails = (guardrails) => {
const checks = Object.keys(guardrails ?? {});
return checks.some((check) => LLM_CHECKS.includes(check));
};
const configureNodeInputsV2 = (parameters) => {
const CHECKS = ["nsfw", "topicalAlignment", "custom", "jailbreak"];
const checks = Object.keys(parameters?.guardrails ?? {});
const hasLLMChecks = checks.some((check) => CHECKS.includes(check));
if (!hasLLMChecks) {
return ["main"];
}
return [
"main",
{
type: "ai_languageModel",
displayName: "Chat Model",
maxConnections: 1,
required: true,
filter: {
excludedNodes: [
"@n8n/n8n-nodes-langchain.lmCohere",
"@n8n/n8n-nodes-langchain.lmOllama",
"n8n/n8n-nodes-langchain.lmOpenAi",
"@n8n/n8n-nodes-langchain.lmOpenHuggingFaceInference"
]
}
}
];
};
const configureNodeInputsV1 = (operation) => {
if (operation === "sanitize") {
return ["main"];
}
return [
"main",
{
type: "ai_languageModel",
displayName: "Chat Model",
maxConnections: 1,
required: true,
filter: {
excludedNodes: [
"@n8n/n8n-nodes-langchain.lmCohere",
"@n8n/n8n-nodes-langchain.lmOllama",
"n8n/n8n-nodes-langchain.lmOpenAi",
"@n8n/n8n-nodes-langchain.lmOpenHuggingFaceInference"
]
}
}
];
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
configureNodeInputsV1,
configureNodeInputsV2,
hasLLMGuardrails
});
//# sourceMappingURL=configureNodeInputs.js.map