add multiple loaders and documents

This commit is contained in:
Henry
2023-04-30 22:57:12 +01:00
parent e333db8245
commit 40b655e66b
7 changed files with 96 additions and 15 deletions
@@ -27,7 +27,8 @@ class InMemoryVectorStore_VectorStores implements INode {
{
label: 'Document',
name: 'document',
type: 'Document'
type: 'Document',
list: true
},
{
label: 'Embeddings',
@@ -54,9 +55,10 @@ class InMemoryVectorStore_VectorStores implements INode {
const embeddings = nodeData.inputs?.embeddings as Embeddings
const output = nodeData.outputs?.output as string
const flattenDocs = docs.flat()
const finalDocs = []
for (let i = 0; i < docs.length; i += 1) {
finalDocs.push(new Document(docs[i]))
for (let i = 0; i < flattenDocs.length; i += 1) {
finalDocs.push(new Document(flattenDocs[i]))
}
const vectorStore = await MemoryVectorStore.fromDocuments(finalDocs, embeddings)