@langchain/community
Version:
Third-party integrations for LangChain.js
48 lines (47 loc) • 1.5 kB
JavaScript
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
let _langchain_core_language_models_llms = require("@langchain/core/language_models/llms");
//#region src/llms/arcjet.ts
var arcjet_exports = /* @__PURE__ */ require_runtime.__exportAll({ ArcjetRedact: () => ArcjetRedact });
var ArcjetRedact = class extends _langchain_core_language_models_llms.LLM {
static lc_name() {
return "ArcjetRedact";
}
llm;
entities;
contextWindowSize;
detect;
replace;
constructor(options) {
super(options);
if (options.entities && options.entities.length === 0) throw new Error("no entities configured for redaction");
this.llm = options.llm;
this.entities = options.entities;
this.contextWindowSize = options.contextWindowSize;
this.detect = options.detect;
this.replace = options.replace;
}
_llmType() {
return "arcjet_redact";
}
async _call(input, options) {
const ajOptions = {
entities: this.entities,
contextWindowSize: this.contextWindowSize,
detect: this.detect,
replace: this.replace
};
const { redact } = await import("@arcjet/redact");
const [redacted, unredact] = await redact(input, ajOptions);
return unredact(await this.llm.invoke(redacted, options));
}
};
//#endregion
exports.ArcjetRedact = ArcjetRedact;
Object.defineProperty(exports, "arcjet_exports", {
enumerable: true,
get: function() {
return arcjet_exports;
}
});
//# sourceMappingURL=arcjet.cjs.map