@langchain/classic 1.0.31 → 1.0.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/dist/agents/mrkl/outputParser.d.cts +1 -1
- package/dist/agents/mrkl/outputParser.d.ts +1 -1
- package/dist/retrievers/parent_document.cjs +3 -3
- package/dist/retrievers/parent_document.cjs.map +1 -1
- package/dist/retrievers/parent_document.js +1 -1
- package/dist/retrievers/parent_document.js.map +1 -1
- package/package.json +19 -20
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @langchain/classic
|
|
2
2
|
|
|
3
|
+
## 1.0.32
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#10776](https://github.com/langchain-ai/langchainjs/pull/10776) [`20a9abe`](https://github.com/langchain-ai/langchainjs/commit/20a9abea23ffacf4ae8dc9a7aeec217143bbdeb6) Thanks [@hntrl](https://github.com/hntrl)! - fix(deps): remediate uuid vulnerability by removing direct uuid usage
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`dc20c0e`](https://github.com/langchain-ai/langchainjs/commit/dc20c0ecaad125d7e916813419548c068996d3c2), [`20a9abe`](https://github.com/langchain-ai/langchainjs/commit/20a9abea23ffacf4ae8dc9a7aeec217143bbdeb6)]:
|
|
10
|
+
- @langchain/openai@1.4.5
|
|
11
|
+
|
|
3
12
|
## 1.0.31
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -24,10 +24,10 @@ declare class ZeroShotAgentOutputParser extends AgentActionOutputParser {
|
|
|
24
24
|
tool?: undefined;
|
|
25
25
|
toolInput?: undefined;
|
|
26
26
|
} | {
|
|
27
|
-
returnValues?: undefined;
|
|
28
27
|
tool: string;
|
|
29
28
|
toolInput: string;
|
|
30
29
|
log: string;
|
|
30
|
+
returnValues?: undefined;
|
|
31
31
|
}>;
|
|
32
32
|
/**
|
|
33
33
|
* Returns the format instructions for parsing the output of an agent
|
|
@@ -24,10 +24,10 @@ declare class ZeroShotAgentOutputParser extends AgentActionOutputParser {
|
|
|
24
24
|
tool?: undefined;
|
|
25
25
|
toolInput?: undefined;
|
|
26
26
|
} | {
|
|
27
|
-
returnValues?: undefined;
|
|
28
27
|
tool: string;
|
|
29
28
|
toolInput: string;
|
|
30
29
|
log: string;
|
|
30
|
+
returnValues?: undefined;
|
|
31
31
|
}>;
|
|
32
32
|
/**
|
|
33
33
|
* Returns the format instructions for parsing the output of an agent
|
|
@@ -2,8 +2,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
|
|
3
3
|
const require_retrievers_multi_vector = require("./multi_vector.cjs");
|
|
4
4
|
let _langchain_core_documents = require("@langchain/core/documents");
|
|
5
|
-
let
|
|
6
|
-
|
|
5
|
+
let _langchain_core_utils_uuid = require("@langchain/core/utils/uuid");
|
|
6
|
+
_langchain_core_utils_uuid = require_runtime.__toESM(_langchain_core_utils_uuid);
|
|
7
7
|
//#region src/retrievers/parent_document.ts
|
|
8
8
|
var parent_document_exports = /* @__PURE__ */ require_runtime.__exportAll({ ParentDocumentRetriever: () => ParentDocumentRetriever });
|
|
9
9
|
/**
|
|
@@ -106,7 +106,7 @@ var ParentDocumentRetriever = class extends require_retrievers_multi_vector.Mult
|
|
|
106
106
|
let parentDocIds;
|
|
107
107
|
if (ids === void 0) {
|
|
108
108
|
if (!addToDocstore) throw new Error(`If ids are not passed in, "config.addToDocstore" MUST be true`);
|
|
109
|
-
parentDocIds = parentDocs.map((_doc) =>
|
|
109
|
+
parentDocIds = parentDocs.map((_doc) => _langchain_core_utils_uuid.v4());
|
|
110
110
|
} else parentDocIds = ids;
|
|
111
111
|
if (parentDocs.length !== parentDocIds.length) throw new Error(`Got uneven list of documents and ids.\nIf "ids" is provided, should be same length as "documents".`);
|
|
112
112
|
for (let i = 0; i < parentDocs.length; i += 1) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parent_document.cjs","names":["MultiVectorRetriever","Document"],"sources":["../../src/retrievers/parent_document.ts"],"sourcesContent":["import * as uuid from \"uuid\";\n\nimport {\n type VectorStoreInterface,\n type VectorStoreRetrieverInterface,\n} from \"@langchain/core/vectorstores\";\nimport { Document } from \"@langchain/core/documents\";\nimport {\n TextSplitter,\n TextSplitterChunkHeaderOptions,\n} from \"@langchain/textsplitters\";\nimport type { BaseDocumentCompressor } from \"./document_compressors/index.js\";\nimport {\n MultiVectorRetriever,\n type MultiVectorRetrieverInput,\n} from \"./multi_vector.js\";\n\n// oxlint-disable-next-line @typescript-eslint/no-explicit-any\nexport type SubDocs = Document<Record<string, any>>[];\n\n/**\n * Interface for the fields required to initialize a\n * ParentDocumentRetriever instance.\n */\nexport type ParentDocumentRetrieverFields = MultiVectorRetrieverInput & {\n childSplitter: TextSplitter;\n parentSplitter?: TextSplitter;\n /**\n * A custom retriever to use when retrieving instead of\n * the `.similaritySearch` method of the vectorstore.\n */\n childDocumentRetriever?: VectorStoreRetrieverInterface<VectorStoreInterface>;\n documentCompressor?: BaseDocumentCompressor | undefined;\n documentCompressorFilteringFn?: (docs: SubDocs) => SubDocs;\n};\n\n/**\n * A type of document retriever that splits input documents into smaller chunks\n * while separately storing and preserving the original documents.\n * The small chunks are embedded, then on retrieval, the original\n * \"parent\" documents are retrieved.\n *\n * This strikes a balance between better targeted retrieval with small documents\n * and the more context-rich larger documents.\n * @example\n * ```typescript\n * const retriever = new ParentDocumentRetriever({\n * vectorstore: new MemoryVectorStore(new OpenAIEmbeddings()),\n * byteStore: new InMemoryStore<Uint8Array>(),\n * parentSplitter: new RecursiveCharacterTextSplitter({\n * chunkOverlap: 0,\n * chunkSize: 500,\n * }),\n * childSplitter: new RecursiveCharacterTextSplitter({\n * chunkOverlap: 0,\n * chunkSize: 50,\n * }),\n * childK: 20,\n * parentK: 5,\n * });\n *\n * const parentDocuments = await getDocuments();\n * await retriever.addDocuments(parentDocuments);\n * const retrievedDocs = await retriever.invoke(\"justice breyer\");\n * ```\n */\nexport class ParentDocumentRetriever extends MultiVectorRetriever {\n static lc_name() {\n return \"ParentDocumentRetriever\";\n }\n\n lc_namespace = [\"langchain\", \"retrievers\", \"parent_document\"];\n\n vectorstore: VectorStoreInterface;\n\n protected childSplitter: TextSplitter;\n\n protected parentSplitter?: TextSplitter;\n\n protected idKey = \"doc_id\";\n\n protected childK?: number;\n\n protected parentK?: number;\n\n childDocumentRetriever:\n | VectorStoreRetrieverInterface<VectorStoreInterface>\n | undefined;\n\n documentCompressor: BaseDocumentCompressor | undefined;\n\n documentCompressorFilteringFn?: ParentDocumentRetrieverFields[\"documentCompressorFilteringFn\"];\n\n constructor(fields: ParentDocumentRetrieverFields) {\n super(fields);\n this.vectorstore = fields.vectorstore;\n this.childSplitter = fields.childSplitter;\n this.parentSplitter = fields.parentSplitter;\n this.idKey = fields.idKey ?? this.idKey;\n this.childK = fields.childK;\n this.parentK = fields.parentK;\n this.childDocumentRetriever = fields.childDocumentRetriever;\n this.documentCompressor = fields.documentCompressor;\n this.documentCompressorFilteringFn = fields.documentCompressorFilteringFn;\n }\n\n async _getRelevantDocuments(query: string): Promise<Document[]> {\n let subDocs: SubDocs = [];\n if (this.childDocumentRetriever) {\n subDocs = await this.childDocumentRetriever.invoke(query);\n } else {\n subDocs = await this.vectorstore.similaritySearch(query, this.childK);\n }\n\n if (this.documentCompressor && subDocs.length) {\n subDocs = await this.documentCompressor.compressDocuments(subDocs, query);\n if (this.documentCompressorFilteringFn) {\n subDocs = this.documentCompressorFilteringFn(subDocs);\n }\n }\n\n // Maintain order\n const parentDocIds: string[] = [];\n for (const doc of subDocs) {\n if (!parentDocIds.includes(doc.metadata[this.idKey])) {\n parentDocIds.push(doc.metadata[this.idKey]);\n }\n }\n const parentDocs: Document[] = [];\n const storedParentDocs = await this.docstore.mget(parentDocIds);\n const retrievedDocs: Document[] = storedParentDocs.filter(\n (doc?: Document): doc is Document => doc !== undefined\n );\n parentDocs.push(...retrievedDocs);\n return parentDocs.slice(0, this.parentK);\n }\n\n async _storeDocuments(\n parentDoc: Record<string, Document>,\n childDocs: Document[],\n addToDocstore: boolean\n ) {\n if (this.childDocumentRetriever) {\n await this.childDocumentRetriever.addDocuments(childDocs);\n } else {\n await this.vectorstore.addDocuments(childDocs);\n }\n if (addToDocstore) {\n await this.docstore.mset(Object.entries(parentDoc));\n }\n }\n\n /**\n * Adds documents to the docstore and vectorstores.\n * If a retriever is provided, it will be used to add documents instead of the vectorstore.\n * @param docs The documents to add\n * @param config.ids Optional list of ids for documents. If provided should be the same\n * length as the list of documents. Can provided if parent documents\n * are already in the document store and you don't want to re-add\n * to the docstore. If not provided, random UUIDs will be used as ids.\n * @param config.addToDocstore Boolean of whether to add documents to docstore.\n * This can be false if and only if `ids` are provided. You may want\n * to set this to False if the documents are already in the docstore\n * and you don't want to re-add them.\n * @param config.chunkHeaderOptions Object with options for adding Contextual chunk headers\n */\n async addDocuments(\n docs: Document[],\n config?: {\n ids?: string[];\n addToDocstore?: boolean;\n childDocChunkHeaderOptions?: TextSplitterChunkHeaderOptions;\n }\n ): Promise<void> {\n const {\n ids,\n addToDocstore = true,\n childDocChunkHeaderOptions = {},\n } = config ?? {};\n const parentDocs = this.parentSplitter\n ? await this.parentSplitter.splitDocuments(docs)\n : docs;\n let parentDocIds;\n if (ids === undefined) {\n if (!addToDocstore) {\n throw new Error(\n `If ids are not passed in, \"config.addToDocstore\" MUST be true`\n );\n }\n parentDocIds = parentDocs.map((_doc: Document) => uuid.v4());\n } else {\n parentDocIds = ids;\n }\n if (parentDocs.length !== parentDocIds.length) {\n throw new Error(\n `Got uneven list of documents and ids.\\nIf \"ids\" is provided, should be same length as \"documents\".`\n );\n }\n for (let i = 0; i < parentDocs.length; i += 1) {\n const parentDoc = parentDocs[i];\n const parentDocId = parentDocIds[i];\n const subDocs = await this.childSplitter.splitDocuments(\n [parentDoc],\n childDocChunkHeaderOptions\n );\n const taggedSubDocs = subDocs.map(\n (subDoc: Document) =>\n new Document({\n pageContent: subDoc.pageContent,\n metadata: { ...subDoc.metadata, [this.idKey]: parentDocId },\n })\n );\n await this._storeDocuments(\n { [parentDocId]: parentDoc },\n taggedSubDocs,\n addToDocstore\n );\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkEA,IAAa,0BAAb,cAA6CA,gCAAAA,qBAAqB;CAChE,OAAO,UAAU;AACf,SAAO;;CAGT,eAAe;EAAC;EAAa;EAAc;EAAkB;CAE7D;CAEA;CAEA;CAEA,QAAkB;CAElB;CAEA;CAEA;CAIA;CAEA;CAEA,YAAY,QAAuC;AACjD,QAAM,OAAO;AACb,OAAK,cAAc,OAAO;AAC1B,OAAK,gBAAgB,OAAO;AAC5B,OAAK,iBAAiB,OAAO;AAC7B,OAAK,QAAQ,OAAO,SAAS,KAAK;AAClC,OAAK,SAAS,OAAO;AACrB,OAAK,UAAU,OAAO;AACtB,OAAK,yBAAyB,OAAO;AACrC,OAAK,qBAAqB,OAAO;AACjC,OAAK,gCAAgC,OAAO;;CAG9C,MAAM,sBAAsB,OAAoC;EAC9D,IAAI,UAAmB,EAAE;AACzB,MAAI,KAAK,uBACP,WAAU,MAAM,KAAK,uBAAuB,OAAO,MAAM;MAEzD,WAAU,MAAM,KAAK,YAAY,iBAAiB,OAAO,KAAK,OAAO;AAGvE,MAAI,KAAK,sBAAsB,QAAQ,QAAQ;AAC7C,aAAU,MAAM,KAAK,mBAAmB,kBAAkB,SAAS,MAAM;AACzE,OAAI,KAAK,8BACP,WAAU,KAAK,8BAA8B,QAAQ;;EAKzD,MAAM,eAAyB,EAAE;AACjC,OAAK,MAAM,OAAO,QAChB,KAAI,CAAC,aAAa,SAAS,IAAI,SAAS,KAAK,OAAO,CAClD,cAAa,KAAK,IAAI,SAAS,KAAK,OAAO;EAG/C,MAAM,aAAyB,EAAE;EAEjC,MAAM,iBADmB,MAAM,KAAK,SAAS,KAAK,aAAa,EACZ,QAChD,QAAoC,QAAQ,KAAA,EAC9C;AACD,aAAW,KAAK,GAAG,cAAc;AACjC,SAAO,WAAW,MAAM,GAAG,KAAK,QAAQ;;CAG1C,MAAM,gBACJ,WACA,WACA,eACA;AACA,MAAI,KAAK,uBACP,OAAM,KAAK,uBAAuB,aAAa,UAAU;MAEzD,OAAM,KAAK,YAAY,aAAa,UAAU;AAEhD,MAAI,cACF,OAAM,KAAK,SAAS,KAAK,OAAO,QAAQ,UAAU,CAAC;;;;;;;;;;;;;;;;CAkBvD,MAAM,aACJ,MACA,QAKe;EACf,MAAM,EACJ,KACA,gBAAgB,MAChB,6BAA6B,EAAE,KAC7B,UAAU,EAAE;EAChB,MAAM,aAAa,KAAK,iBACpB,MAAM,KAAK,eAAe,eAAe,KAAK,GAC9C;EACJ,IAAI;AACJ,MAAI,QAAQ,KAAA,GAAW;AACrB,OAAI,CAAC,cACH,OAAM,IAAI,MACR,gEACD;AAEH,kBAAe,WAAW,KAAK,
|
|
1
|
+
{"version":3,"file":"parent_document.cjs","names":["MultiVectorRetriever","uuid","Document"],"sources":["../../src/retrievers/parent_document.ts"],"sourcesContent":["import * as uuid from \"@langchain/core/utils/uuid\";\n\nimport {\n type VectorStoreInterface,\n type VectorStoreRetrieverInterface,\n} from \"@langchain/core/vectorstores\";\nimport { Document } from \"@langchain/core/documents\";\nimport {\n TextSplitter,\n TextSplitterChunkHeaderOptions,\n} from \"@langchain/textsplitters\";\nimport type { BaseDocumentCompressor } from \"./document_compressors/index.js\";\nimport {\n MultiVectorRetriever,\n type MultiVectorRetrieverInput,\n} from \"./multi_vector.js\";\n\n// oxlint-disable-next-line @typescript-eslint/no-explicit-any\nexport type SubDocs = Document<Record<string, any>>[];\n\n/**\n * Interface for the fields required to initialize a\n * ParentDocumentRetriever instance.\n */\nexport type ParentDocumentRetrieverFields = MultiVectorRetrieverInput & {\n childSplitter: TextSplitter;\n parentSplitter?: TextSplitter;\n /**\n * A custom retriever to use when retrieving instead of\n * the `.similaritySearch` method of the vectorstore.\n */\n childDocumentRetriever?: VectorStoreRetrieverInterface<VectorStoreInterface>;\n documentCompressor?: BaseDocumentCompressor | undefined;\n documentCompressorFilteringFn?: (docs: SubDocs) => SubDocs;\n};\n\n/**\n * A type of document retriever that splits input documents into smaller chunks\n * while separately storing and preserving the original documents.\n * The small chunks are embedded, then on retrieval, the original\n * \"parent\" documents are retrieved.\n *\n * This strikes a balance between better targeted retrieval with small documents\n * and the more context-rich larger documents.\n * @example\n * ```typescript\n * const retriever = new ParentDocumentRetriever({\n * vectorstore: new MemoryVectorStore(new OpenAIEmbeddings()),\n * byteStore: new InMemoryStore<Uint8Array>(),\n * parentSplitter: new RecursiveCharacterTextSplitter({\n * chunkOverlap: 0,\n * chunkSize: 500,\n * }),\n * childSplitter: new RecursiveCharacterTextSplitter({\n * chunkOverlap: 0,\n * chunkSize: 50,\n * }),\n * childK: 20,\n * parentK: 5,\n * });\n *\n * const parentDocuments = await getDocuments();\n * await retriever.addDocuments(parentDocuments);\n * const retrievedDocs = await retriever.invoke(\"justice breyer\");\n * ```\n */\nexport class ParentDocumentRetriever extends MultiVectorRetriever {\n static lc_name() {\n return \"ParentDocumentRetriever\";\n }\n\n lc_namespace = [\"langchain\", \"retrievers\", \"parent_document\"];\n\n vectorstore: VectorStoreInterface;\n\n protected childSplitter: TextSplitter;\n\n protected parentSplitter?: TextSplitter;\n\n protected idKey = \"doc_id\";\n\n protected childK?: number;\n\n protected parentK?: number;\n\n childDocumentRetriever:\n | VectorStoreRetrieverInterface<VectorStoreInterface>\n | undefined;\n\n documentCompressor: BaseDocumentCompressor | undefined;\n\n documentCompressorFilteringFn?: ParentDocumentRetrieverFields[\"documentCompressorFilteringFn\"];\n\n constructor(fields: ParentDocumentRetrieverFields) {\n super(fields);\n this.vectorstore = fields.vectorstore;\n this.childSplitter = fields.childSplitter;\n this.parentSplitter = fields.parentSplitter;\n this.idKey = fields.idKey ?? this.idKey;\n this.childK = fields.childK;\n this.parentK = fields.parentK;\n this.childDocumentRetriever = fields.childDocumentRetriever;\n this.documentCompressor = fields.documentCompressor;\n this.documentCompressorFilteringFn = fields.documentCompressorFilteringFn;\n }\n\n async _getRelevantDocuments(query: string): Promise<Document[]> {\n let subDocs: SubDocs = [];\n if (this.childDocumentRetriever) {\n subDocs = await this.childDocumentRetriever.invoke(query);\n } else {\n subDocs = await this.vectorstore.similaritySearch(query, this.childK);\n }\n\n if (this.documentCompressor && subDocs.length) {\n subDocs = await this.documentCompressor.compressDocuments(subDocs, query);\n if (this.documentCompressorFilteringFn) {\n subDocs = this.documentCompressorFilteringFn(subDocs);\n }\n }\n\n // Maintain order\n const parentDocIds: string[] = [];\n for (const doc of subDocs) {\n if (!parentDocIds.includes(doc.metadata[this.idKey])) {\n parentDocIds.push(doc.metadata[this.idKey]);\n }\n }\n const parentDocs: Document[] = [];\n const storedParentDocs = await this.docstore.mget(parentDocIds);\n const retrievedDocs: Document[] = storedParentDocs.filter(\n (doc?: Document): doc is Document => doc !== undefined\n );\n parentDocs.push(...retrievedDocs);\n return parentDocs.slice(0, this.parentK);\n }\n\n async _storeDocuments(\n parentDoc: Record<string, Document>,\n childDocs: Document[],\n addToDocstore: boolean\n ) {\n if (this.childDocumentRetriever) {\n await this.childDocumentRetriever.addDocuments(childDocs);\n } else {\n await this.vectorstore.addDocuments(childDocs);\n }\n if (addToDocstore) {\n await this.docstore.mset(Object.entries(parentDoc));\n }\n }\n\n /**\n * Adds documents to the docstore and vectorstores.\n * If a retriever is provided, it will be used to add documents instead of the vectorstore.\n * @param docs The documents to add\n * @param config.ids Optional list of ids for documents. If provided should be the same\n * length as the list of documents. Can provided if parent documents\n * are already in the document store and you don't want to re-add\n * to the docstore. If not provided, random UUIDs will be used as ids.\n * @param config.addToDocstore Boolean of whether to add documents to docstore.\n * This can be false if and only if `ids` are provided. You may want\n * to set this to False if the documents are already in the docstore\n * and you don't want to re-add them.\n * @param config.chunkHeaderOptions Object with options for adding Contextual chunk headers\n */\n async addDocuments(\n docs: Document[],\n config?: {\n ids?: string[];\n addToDocstore?: boolean;\n childDocChunkHeaderOptions?: TextSplitterChunkHeaderOptions;\n }\n ): Promise<void> {\n const {\n ids,\n addToDocstore = true,\n childDocChunkHeaderOptions = {},\n } = config ?? {};\n const parentDocs = this.parentSplitter\n ? await this.parentSplitter.splitDocuments(docs)\n : docs;\n let parentDocIds;\n if (ids === undefined) {\n if (!addToDocstore) {\n throw new Error(\n `If ids are not passed in, \"config.addToDocstore\" MUST be true`\n );\n }\n parentDocIds = parentDocs.map((_doc: Document) => uuid.v4());\n } else {\n parentDocIds = ids;\n }\n if (parentDocs.length !== parentDocIds.length) {\n throw new Error(\n `Got uneven list of documents and ids.\\nIf \"ids\" is provided, should be same length as \"documents\".`\n );\n }\n for (let i = 0; i < parentDocs.length; i += 1) {\n const parentDoc = parentDocs[i];\n const parentDocId = parentDocIds[i];\n const subDocs = await this.childSplitter.splitDocuments(\n [parentDoc],\n childDocChunkHeaderOptions\n );\n const taggedSubDocs = subDocs.map(\n (subDoc: Document) =>\n new Document({\n pageContent: subDoc.pageContent,\n metadata: { ...subDoc.metadata, [this.idKey]: parentDocId },\n })\n );\n await this._storeDocuments(\n { [parentDocId]: parentDoc },\n taggedSubDocs,\n addToDocstore\n );\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkEA,IAAa,0BAAb,cAA6CA,gCAAAA,qBAAqB;CAChE,OAAO,UAAU;AACf,SAAO;;CAGT,eAAe;EAAC;EAAa;EAAc;EAAkB;CAE7D;CAEA;CAEA;CAEA,QAAkB;CAElB;CAEA;CAEA;CAIA;CAEA;CAEA,YAAY,QAAuC;AACjD,QAAM,OAAO;AACb,OAAK,cAAc,OAAO;AAC1B,OAAK,gBAAgB,OAAO;AAC5B,OAAK,iBAAiB,OAAO;AAC7B,OAAK,QAAQ,OAAO,SAAS,KAAK;AAClC,OAAK,SAAS,OAAO;AACrB,OAAK,UAAU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e,WAAW,KAAK,SAAmBC,2BAAK,IAAI,CAAC;QAE5D,gBAAe;AAEjB,MAAI,WAAW,WAAW,aAAa,OACrC,OAAM,IAAI,MACR,qGACD;AAEH,OAAK,IAAI,IAAI,GAAG,IAAI,WAAW,QAAQ,KAAK,GAAG;GAC7C,MAAM,YAAY,WAAW;GAC7B,MAAM,cAAc,aAAa;GAKjC,MAAM,iBAJU,MAAM,KAAK,cAAc,eACvC,CAAC,UAAU,EACX,2BACD,EAC6B,KAC3B,WACC,IAAIC,0BAAAA,SAAS;IACX,aAAa,OAAO;IACpB,UAAU;KAAE,GAAG,OAAO;MAAW,KAAK,QAAQ;KAAa;IAC5D,CAAC,CACL;AACD,SAAM,KAAK,gBACT,GAAG,cAAc,WAAW,EAC5B,eACA,cACD"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __exportAll } from "../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { MultiVectorRetriever } from "./multi_vector.js";
|
|
3
3
|
import { Document } from "@langchain/core/documents";
|
|
4
|
-
import * as uuid from "uuid";
|
|
4
|
+
import * as uuid from "@langchain/core/utils/uuid";
|
|
5
5
|
//#region src/retrievers/parent_document.ts
|
|
6
6
|
var parent_document_exports = /* @__PURE__ */ __exportAll({ ParentDocumentRetriever: () => ParentDocumentRetriever });
|
|
7
7
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parent_document.js","names":[],"sources":["../../src/retrievers/parent_document.ts"],"sourcesContent":["import * as uuid from \"uuid\";\n\nimport {\n type VectorStoreInterface,\n type VectorStoreRetrieverInterface,\n} from \"@langchain/core/vectorstores\";\nimport { Document } from \"@langchain/core/documents\";\nimport {\n TextSplitter,\n TextSplitterChunkHeaderOptions,\n} from \"@langchain/textsplitters\";\nimport type { BaseDocumentCompressor } from \"./document_compressors/index.js\";\nimport {\n MultiVectorRetriever,\n type MultiVectorRetrieverInput,\n} from \"./multi_vector.js\";\n\n// oxlint-disable-next-line @typescript-eslint/no-explicit-any\nexport type SubDocs = Document<Record<string, any>>[];\n\n/**\n * Interface for the fields required to initialize a\n * ParentDocumentRetriever instance.\n */\nexport type ParentDocumentRetrieverFields = MultiVectorRetrieverInput & {\n childSplitter: TextSplitter;\n parentSplitter?: TextSplitter;\n /**\n * A custom retriever to use when retrieving instead of\n * the `.similaritySearch` method of the vectorstore.\n */\n childDocumentRetriever?: VectorStoreRetrieverInterface<VectorStoreInterface>;\n documentCompressor?: BaseDocumentCompressor | undefined;\n documentCompressorFilteringFn?: (docs: SubDocs) => SubDocs;\n};\n\n/**\n * A type of document retriever that splits input documents into smaller chunks\n * while separately storing and preserving the original documents.\n * The small chunks are embedded, then on retrieval, the original\n * \"parent\" documents are retrieved.\n *\n * This strikes a balance between better targeted retrieval with small documents\n * and the more context-rich larger documents.\n * @example\n * ```typescript\n * const retriever = new ParentDocumentRetriever({\n * vectorstore: new MemoryVectorStore(new OpenAIEmbeddings()),\n * byteStore: new InMemoryStore<Uint8Array>(),\n * parentSplitter: new RecursiveCharacterTextSplitter({\n * chunkOverlap: 0,\n * chunkSize: 500,\n * }),\n * childSplitter: new RecursiveCharacterTextSplitter({\n * chunkOverlap: 0,\n * chunkSize: 50,\n * }),\n * childK: 20,\n * parentK: 5,\n * });\n *\n * const parentDocuments = await getDocuments();\n * await retriever.addDocuments(parentDocuments);\n * const retrievedDocs = await retriever.invoke(\"justice breyer\");\n * ```\n */\nexport class ParentDocumentRetriever extends MultiVectorRetriever {\n static lc_name() {\n return \"ParentDocumentRetriever\";\n }\n\n lc_namespace = [\"langchain\", \"retrievers\", \"parent_document\"];\n\n vectorstore: VectorStoreInterface;\n\n protected childSplitter: TextSplitter;\n\n protected parentSplitter?: TextSplitter;\n\n protected idKey = \"doc_id\";\n\n protected childK?: number;\n\n protected parentK?: number;\n\n childDocumentRetriever:\n | VectorStoreRetrieverInterface<VectorStoreInterface>\n | undefined;\n\n documentCompressor: BaseDocumentCompressor | undefined;\n\n documentCompressorFilteringFn?: ParentDocumentRetrieverFields[\"documentCompressorFilteringFn\"];\n\n constructor(fields: ParentDocumentRetrieverFields) {\n super(fields);\n this.vectorstore = fields.vectorstore;\n this.childSplitter = fields.childSplitter;\n this.parentSplitter = fields.parentSplitter;\n this.idKey = fields.idKey ?? this.idKey;\n this.childK = fields.childK;\n this.parentK = fields.parentK;\n this.childDocumentRetriever = fields.childDocumentRetriever;\n this.documentCompressor = fields.documentCompressor;\n this.documentCompressorFilteringFn = fields.documentCompressorFilteringFn;\n }\n\n async _getRelevantDocuments(query: string): Promise<Document[]> {\n let subDocs: SubDocs = [];\n if (this.childDocumentRetriever) {\n subDocs = await this.childDocumentRetriever.invoke(query);\n } else {\n subDocs = await this.vectorstore.similaritySearch(query, this.childK);\n }\n\n if (this.documentCompressor && subDocs.length) {\n subDocs = await this.documentCompressor.compressDocuments(subDocs, query);\n if (this.documentCompressorFilteringFn) {\n subDocs = this.documentCompressorFilteringFn(subDocs);\n }\n }\n\n // Maintain order\n const parentDocIds: string[] = [];\n for (const doc of subDocs) {\n if (!parentDocIds.includes(doc.metadata[this.idKey])) {\n parentDocIds.push(doc.metadata[this.idKey]);\n }\n }\n const parentDocs: Document[] = [];\n const storedParentDocs = await this.docstore.mget(parentDocIds);\n const retrievedDocs: Document[] = storedParentDocs.filter(\n (doc?: Document): doc is Document => doc !== undefined\n );\n parentDocs.push(...retrievedDocs);\n return parentDocs.slice(0, this.parentK);\n }\n\n async _storeDocuments(\n parentDoc: Record<string, Document>,\n childDocs: Document[],\n addToDocstore: boolean\n ) {\n if (this.childDocumentRetriever) {\n await this.childDocumentRetriever.addDocuments(childDocs);\n } else {\n await this.vectorstore.addDocuments(childDocs);\n }\n if (addToDocstore) {\n await this.docstore.mset(Object.entries(parentDoc));\n }\n }\n\n /**\n * Adds documents to the docstore and vectorstores.\n * If a retriever is provided, it will be used to add documents instead of the vectorstore.\n * @param docs The documents to add\n * @param config.ids Optional list of ids for documents. If provided should be the same\n * length as the list of documents. Can provided if parent documents\n * are already in the document store and you don't want to re-add\n * to the docstore. If not provided, random UUIDs will be used as ids.\n * @param config.addToDocstore Boolean of whether to add documents to docstore.\n * This can be false if and only if `ids` are provided. You may want\n * to set this to False if the documents are already in the docstore\n * and you don't want to re-add them.\n * @param config.chunkHeaderOptions Object with options for adding Contextual chunk headers\n */\n async addDocuments(\n docs: Document[],\n config?: {\n ids?: string[];\n addToDocstore?: boolean;\n childDocChunkHeaderOptions?: TextSplitterChunkHeaderOptions;\n }\n ): Promise<void> {\n const {\n ids,\n addToDocstore = true,\n childDocChunkHeaderOptions = {},\n } = config ?? {};\n const parentDocs = this.parentSplitter\n ? await this.parentSplitter.splitDocuments(docs)\n : docs;\n let parentDocIds;\n if (ids === undefined) {\n if (!addToDocstore) {\n throw new Error(\n `If ids are not passed in, \"config.addToDocstore\" MUST be true`\n );\n }\n parentDocIds = parentDocs.map((_doc: Document) => uuid.v4());\n } else {\n parentDocIds = ids;\n }\n if (parentDocs.length !== parentDocIds.length) {\n throw new Error(\n `Got uneven list of documents and ids.\\nIf \"ids\" is provided, should be same length as \"documents\".`\n );\n }\n for (let i = 0; i < parentDocs.length; i += 1) {\n const parentDoc = parentDocs[i];\n const parentDocId = parentDocIds[i];\n const subDocs = await this.childSplitter.splitDocuments(\n [parentDoc],\n childDocChunkHeaderOptions\n );\n const taggedSubDocs = subDocs.map(\n (subDoc: Document) =>\n new Document({\n pageContent: subDoc.pageContent,\n metadata: { ...subDoc.metadata, [this.idKey]: parentDocId },\n })\n );\n await this._storeDocuments(\n { [parentDocId]: parentDoc },\n taggedSubDocs,\n addToDocstore\n );\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkEA,IAAa,0BAAb,cAA6C,qBAAqB;CAChE,OAAO,UAAU;AACf,SAAO;;CAGT,eAAe;EAAC;EAAa;EAAc;EAAkB;CAE7D;CAEA;CAEA;CAEA,QAAkB;CAElB;CAEA;CAEA;CAIA;CAEA;CAEA,YAAY,QAAuC;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,EAAE;EAChB,MAAM,aAAa,KAAK,iBACpB,MAAM,KAAK,eAAe,eAAe,KAAK,GAC9C;EACJ,IAAI;AACJ,MAAI,QAAQ,KAAA,GAAW;AACrB,OAAI,CAAC,cACH,OAAM,IAAI,MACR,gEACD;AAEH,kBAAe,WAAW,KAAK,SAAmB,KAAK,IAAI,CAAC;QAE5D,gBAAe;AAEjB,MAAI,WAAW,WAAW,aAAa,OACrC,OAAM,IAAI,MACR,qGACD;AAEH,OAAK,IAAI,IAAI,GAAG,IAAI,WAAW,QAAQ,KAAK,GAAG;GAC7C,MAAM,YAAY,WAAW;GAC7B,MAAM,cAAc,aAAa;GAKjC,MAAM,iBAJU,MAAM,KAAK,cAAc,eACvC,CAAC,UAAU,EACX,2BACD,EAC6B,KAC3B,WACC,IAAI,SAAS;IACX,aAAa,OAAO;IACpB,UAAU;KAAE,GAAG,OAAO;MAAW,KAAK,QAAQ;KAAa;IAC5D,CAAC,CACL;AACD,SAAM,KAAK,gBACT,GAAG,cAAc,WAAW,EAC5B,eACA,cACD"}
|
|
1
|
+
{"version":3,"file":"parent_document.js","names":[],"sources":["../../src/retrievers/parent_document.ts"],"sourcesContent":["import * as uuid from \"@langchain/core/utils/uuid\";\n\nimport {\n type VectorStoreInterface,\n type VectorStoreRetrieverInterface,\n} from \"@langchain/core/vectorstores\";\nimport { Document } from \"@langchain/core/documents\";\nimport {\n TextSplitter,\n TextSplitterChunkHeaderOptions,\n} from \"@langchain/textsplitters\";\nimport type { BaseDocumentCompressor } from \"./document_compressors/index.js\";\nimport {\n MultiVectorRetriever,\n type MultiVectorRetrieverInput,\n} from \"./multi_vector.js\";\n\n// oxlint-disable-next-line @typescript-eslint/no-explicit-any\nexport type SubDocs = Document<Record<string, any>>[];\n\n/**\n * Interface for the fields required to initialize a\n * ParentDocumentRetriever instance.\n */\nexport type ParentDocumentRetrieverFields = MultiVectorRetrieverInput & {\n childSplitter: TextSplitter;\n parentSplitter?: TextSplitter;\n /**\n * A custom retriever to use when retrieving instead of\n * the `.similaritySearch` method of the vectorstore.\n */\n childDocumentRetriever?: VectorStoreRetrieverInterface<VectorStoreInterface>;\n documentCompressor?: BaseDocumentCompressor | undefined;\n documentCompressorFilteringFn?: (docs: SubDocs) => SubDocs;\n};\n\n/**\n * A type of document retriever that splits input documents into smaller chunks\n * while separately storing and preserving the original documents.\n * The small chunks are embedded, then on retrieval, the original\n * \"parent\" documents are retrieved.\n *\n * This strikes a balance between better targeted retrieval with small documents\n * and the more context-rich larger documents.\n * @example\n * ```typescript\n * const retriever = new ParentDocumentRetriever({\n * vectorstore: new MemoryVectorStore(new OpenAIEmbeddings()),\n * byteStore: new InMemoryStore<Uint8Array>(),\n * parentSplitter: new RecursiveCharacterTextSplitter({\n * chunkOverlap: 0,\n * chunkSize: 500,\n * }),\n * childSplitter: new RecursiveCharacterTextSplitter({\n * chunkOverlap: 0,\n * chunkSize: 50,\n * }),\n * childK: 20,\n * parentK: 5,\n * });\n *\n * const parentDocuments = await getDocuments();\n * await retriever.addDocuments(parentDocuments);\n * const retrievedDocs = await retriever.invoke(\"justice breyer\");\n * ```\n */\nexport class ParentDocumentRetriever extends MultiVectorRetriever {\n static lc_name() {\n return \"ParentDocumentRetriever\";\n }\n\n lc_namespace = [\"langchain\", \"retrievers\", \"parent_document\"];\n\n vectorstore: VectorStoreInterface;\n\n protected childSplitter: TextSplitter;\n\n protected parentSplitter?: TextSplitter;\n\n protected idKey = \"doc_id\";\n\n protected childK?: number;\n\n protected parentK?: number;\n\n childDocumentRetriever:\n | VectorStoreRetrieverInterface<VectorStoreInterface>\n | undefined;\n\n documentCompressor: BaseDocumentCompressor | undefined;\n\n documentCompressorFilteringFn?: ParentDocumentRetrieverFields[\"documentCompressorFilteringFn\"];\n\n constructor(fields: ParentDocumentRetrieverFields) {\n super(fields);\n this.vectorstore = fields.vectorstore;\n this.childSplitter = fields.childSplitter;\n this.parentSplitter = fields.parentSplitter;\n this.idKey = fields.idKey ?? this.idKey;\n this.childK = fields.childK;\n this.parentK = fields.parentK;\n this.childDocumentRetriever = fields.childDocumentRetriever;\n this.documentCompressor = fields.documentCompressor;\n this.documentCompressorFilteringFn = fields.documentCompressorFilteringFn;\n }\n\n async _getRelevantDocuments(query: string): Promise<Document[]> {\n let subDocs: SubDocs = [];\n if (this.childDocumentRetriever) {\n subDocs = await this.childDocumentRetriever.invoke(query);\n } else {\n subDocs = await this.vectorstore.similaritySearch(query, this.childK);\n }\n\n if (this.documentCompressor && subDocs.length) {\n subDocs = await this.documentCompressor.compressDocuments(subDocs, query);\n if (this.documentCompressorFilteringFn) {\n subDocs = this.documentCompressorFilteringFn(subDocs);\n }\n }\n\n // Maintain order\n const parentDocIds: string[] = [];\n for (const doc of subDocs) {\n if (!parentDocIds.includes(doc.metadata[this.idKey])) {\n parentDocIds.push(doc.metadata[this.idKey]);\n }\n }\n const parentDocs: Document[] = [];\n const storedParentDocs = await this.docstore.mget(parentDocIds);\n const retrievedDocs: Document[] = storedParentDocs.filter(\n (doc?: Document): doc is Document => doc !== undefined\n );\n parentDocs.push(...retrievedDocs);\n return parentDocs.slice(0, this.parentK);\n }\n\n async _storeDocuments(\n parentDoc: Record<string, Document>,\n childDocs: Document[],\n addToDocstore: boolean\n ) {\n if (this.childDocumentRetriever) {\n await this.childDocumentRetriever.addDocuments(childDocs);\n } else {\n await this.vectorstore.addDocuments(childDocs);\n }\n if (addToDocstore) {\n await this.docstore.mset(Object.entries(parentDoc));\n }\n }\n\n /**\n * Adds documents to the docstore and vectorstores.\n * If a retriever is provided, it will be used to add documents instead of the vectorstore.\n * @param docs The documents to add\n * @param config.ids Optional list of ids for documents. If provided should be the same\n * length as the list of documents. Can provided if parent documents\n * are already in the document store and you don't want to re-add\n * to the docstore. If not provided, random UUIDs will be used as ids.\n * @param config.addToDocstore Boolean of whether to add documents to docstore.\n * This can be false if and only if `ids` are provided. You may want\n * to set this to False if the documents are already in the docstore\n * and you don't want to re-add them.\n * @param config.chunkHeaderOptions Object with options for adding Contextual chunk headers\n */\n async addDocuments(\n docs: Document[],\n config?: {\n ids?: string[];\n addToDocstore?: boolean;\n childDocChunkHeaderOptions?: TextSplitterChunkHeaderOptions;\n }\n ): Promise<void> {\n const {\n ids,\n addToDocstore = true,\n childDocChunkHeaderOptions = {},\n } = config ?? {};\n const parentDocs = this.parentSplitter\n ? await this.parentSplitter.splitDocuments(docs)\n : docs;\n let parentDocIds;\n if (ids === undefined) {\n if (!addToDocstore) {\n throw new Error(\n `If ids are not passed in, \"config.addToDocstore\" MUST be true`\n );\n }\n parentDocIds = parentDocs.map((_doc: Document) => uuid.v4());\n } else {\n parentDocIds = ids;\n }\n if (parentDocs.length !== parentDocIds.length) {\n throw new Error(\n `Got uneven list of documents and ids.\\nIf \"ids\" is provided, should be same length as \"documents\".`\n );\n }\n for (let i = 0; i < parentDocs.length; i += 1) {\n const parentDoc = parentDocs[i];\n const parentDocId = parentDocIds[i];\n const subDocs = await this.childSplitter.splitDocuments(\n [parentDoc],\n childDocChunkHeaderOptions\n );\n const taggedSubDocs = subDocs.map(\n (subDoc: Document) =>\n new Document({\n pageContent: subDoc.pageContent,\n metadata: { ...subDoc.metadata, [this.idKey]: parentDocId },\n })\n );\n await this._storeDocuments(\n { [parentDocId]: parentDoc },\n taggedSubDocs,\n addToDocstore\n );\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkEA,IAAa,0BAAb,cAA6C,qBAAqB;CAChE,OAAO,UAAU;AACf,SAAO;;CAGT,eAAe;EAAC;EAAa;EAAc;EAAkB;CAE7D;CAEA;CAEA;CAEA,QAAkB;CAElB;CAEA;CAEA;CAIA;CAEA;CAEA,YAAY,QAAuC;AACjD,QAAM,OAAO;AACb,OAAK,cAAc,OAAO;AAC1B,OAAK,gBAAgB,OAAO;AAC5B,OAAK,iBAAiB,OAAO;AAC7B,OAAK,QAAQ,OAAO,SAAS,KAAK;AAClC,OAAK,SAAS,OAAO;AACrB,OAAK,UAAU,OAAO;AACtB,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,SAAmB,KAAK,IAAI,CAAC;QAE5D,gBAAe;AAEjB,MAAI,WAAW,WAAW,aAAa,OACrC,OAAM,IAAI,MACR,qGACD;AAEH,OAAK,IAAI,IAAI,GAAG,IAAI,WAAW,QAAQ,KAAK,GAAG;GAC7C,MAAM,YAAY,WAAW;GAC7B,MAAM,cAAc,aAAa;GAKjC,MAAM,iBAJU,MAAM,KAAK,cAAc,eACvC,CAAC,UAAU,EACX,2BACD,EAC6B,KAC3B,WACC,IAAI,SAAS;IACX,aAAa,OAAO;IACpB,UAAU;KAAE,GAAG,OAAO;MAAW,KAAK,QAAQ;KAAa;IAC5D,CAAC,CACL;AACD,SAAM,KAAK,gBACT,GAAG,cAAc,WAAW,EAC5B,eACA,cACD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@langchain/classic",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.32",
|
|
4
4
|
"description": "Old abstractions from LangChain.js",
|
|
5
5
|
"author": "LangChain",
|
|
6
6
|
"license": "MIT",
|
|
@@ -167,27 +167,27 @@
|
|
|
167
167
|
"voy-search": "0.6.3",
|
|
168
168
|
"weaviate-client": "^3.12.0",
|
|
169
169
|
"zod-to-json-schema": "^3.25.2",
|
|
170
|
-
"@langchain/anthropic": "1.3.
|
|
170
|
+
"@langchain/anthropic": "1.3.28",
|
|
171
171
|
"@langchain/aws": "1.3.5",
|
|
172
|
-
"@langchain/cloudflare": "1.0.
|
|
173
|
-
"@langchain/core": "^1.1.
|
|
174
|
-
"@langchain/deepseek": "1.0.
|
|
175
|
-
"@langchain/fireworks": "0.1.
|
|
176
|
-
"@langchain/google-cloud-sql-pg": "1.0.
|
|
177
|
-
"@langchain/google-
|
|
178
|
-
"@langchain/google-
|
|
179
|
-
"@langchain/google-vertexai
|
|
180
|
-
"@langchain/google-vertexai": "2.1.
|
|
172
|
+
"@langchain/cloudflare": "1.0.5",
|
|
173
|
+
"@langchain/core": "^1.1.42",
|
|
174
|
+
"@langchain/deepseek": "1.0.25",
|
|
175
|
+
"@langchain/fireworks": "0.1.3",
|
|
176
|
+
"@langchain/google-cloud-sql-pg": "1.0.23",
|
|
177
|
+
"@langchain/google-common": "2.1.29",
|
|
178
|
+
"@langchain/google-genai": "2.1.29",
|
|
179
|
+
"@langchain/google-vertexai": "2.1.29",
|
|
180
|
+
"@langchain/google-vertexai-web": "2.1.29",
|
|
181
181
|
"@langchain/groq": "1.2.0",
|
|
182
|
-
"@langchain/mistralai": "1.0.
|
|
183
|
-
"@langchain/mongodb": "1.1.
|
|
184
|
-
"@langchain/
|
|
185
|
-
"@langchain/
|
|
182
|
+
"@langchain/mistralai": "1.0.8",
|
|
183
|
+
"@langchain/mongodb": "1.1.1",
|
|
184
|
+
"@langchain/ollama": "1.2.7",
|
|
185
|
+
"@langchain/redis": "1.1.2",
|
|
186
186
|
"@langchain/textsplitters": "1.0.1",
|
|
187
|
-
"@langchain/xai": "1.3.
|
|
187
|
+
"@langchain/xai": "1.3.17",
|
|
188
188
|
"@langchain/tsconfig": "0.0.1",
|
|
189
|
-
"
|
|
190
|
-
"langchain": "1.3
|
|
189
|
+
"langchain": "1.3.5",
|
|
190
|
+
"@langchain/together-ai": "0.1.3"
|
|
191
191
|
},
|
|
192
192
|
"peerDependencies": {
|
|
193
193
|
"@langchain/core": "^1.0.0",
|
|
@@ -211,10 +211,9 @@
|
|
|
211
211
|
"js-yaml": "^4.1.1",
|
|
212
212
|
"jsonpointer": "^5.0.1",
|
|
213
213
|
"openapi-types": "^12.1.3",
|
|
214
|
-
"uuid": "^10.0.0",
|
|
215
214
|
"yaml": "^2.8.3",
|
|
216
215
|
"zod": "^3.25.76 || ^4",
|
|
217
|
-
"@langchain/openai": "1.4.
|
|
216
|
+
"@langchain/openai": "1.4.5",
|
|
218
217
|
"@langchain/textsplitters": "1.0.1"
|
|
219
218
|
},
|
|
220
219
|
"optionalDependencies": {
|