agsamantha/node_modules/langchain/dist/load/index.cjs

52 lines
2 KiB
JavaScript
Raw Normal View History

2024-10-02 15:15:21 -05:00
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.load = void 0;
const load_1 = require("@langchain/core/load");
const import_constants_js_1 = require("./import_constants.cjs");
const importMap = __importStar(require("./import_map.cjs"));
/**
* Load a LangChain module from a serialized text representation.
* NOTE: This functionality is currently in beta.
* Loaded classes may change independently of semver.
* @param text Serialized text representation of the module.
* @param secretsMap
* @param optionalImportsMap
* @returns A loaded instance of a LangChain module.
*/
async function load(text,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
secretsMap = {},
// eslint-disable-next-line @typescript-eslint/no-explicit-any
optionalImportsMap = {}) {
return (0, load_1.load)(text, {
secretsMap,
optionalImportsMap,
optionalImportEntrypoints: import_constants_js_1.optionalImportEntrypoints,
importMap,
});
}
exports.load = load;