Skip to content

Commit

Permalink
Merge pull request FlowiseAI#1703 from FlowiseAI/feature/Retriever-Ou…
Browse files Browse the repository at this point in the history
…tput

Feature/Add document json output
  • Loading branch information
HenryHengZJ authored Feb 10, 2024
2 parents 55dad31 + caf54bf commit 2ef0f81
Show file tree
Hide file tree
Showing 16 changed files with 55 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,13 @@ class PlainText_DocumentLoaders implements INode {
{
label: 'Document',
name: 'document',
baseClasses: this.baseClasses
description: 'Array of document objects containing metadata and pageContent',
baseClasses: [...this.baseClasses, 'json']
},
{
label: 'Text',
name: 'text',
description: 'Concatenated string from pageContent of documents',
baseClasses: ['string', 'json']
}
]
Expand Down
4 changes: 3 additions & 1 deletion packages/components/nodes/documentloaders/Text/Text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,13 @@ class Text_DocumentLoaders implements INode {
{
label: 'Document',
name: 'document',
baseClasses: this.baseClasses
description: 'Array of document objects containing metadata and pageContent',
baseClasses: [...this.baseClasses, 'json']
},
{
label: 'Text',
name: 'text',
description: 'Concatenated string from pageContent of documents',
baseClasses: ['string', 'json']
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,13 @@ class VectorStoreToDocument_DocumentLoaders implements INode {
{
label: 'Document',
name: 'document',
description: 'Array of document objects containing metadata and pageContent',
baseClasses: [...this.baseClasses, 'json']
},
{
label: 'Text',
name: 'text',
description: 'Concatenated string from pageContent of documents',
baseClasses: ['string', 'json']
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,13 @@ class CohereRerankRetriever_Retrievers implements INode {
{
label: 'Document',
name: 'document',
baseClasses: ['Document']
description: 'Array of document objects containing metadata and pageContent',
baseClasses: ['Document', 'json']
},
{
label: 'Text',
name: 'text',
description: 'Concatenated string from pageContent of documents',
baseClasses: ['string', 'json']
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,13 @@ class EmbeddingsFilterRetriever_Retrievers implements INode {
{
label: 'Document',
name: 'document',
baseClasses: ['Document']
description: 'Array of document objects containing metadata and pageContent',
baseClasses: ['Document', 'json']
},
{
label: 'Text',
name: 'text',
description: 'Concatenated string from pageContent of documents',
baseClasses: ['string', 'json']
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,13 @@ Passage:`
{
label: 'Document',
name: 'document',
baseClasses: ['Document']
description: 'Array of document objects containing metadata and pageContent',
baseClasses: ['Document', 'json']
},
{
label: 'Text',
name: 'text',
description: 'Concatenated string from pageContent of documents',
baseClasses: ['string', 'json']
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,13 @@ class LLMFilterCompressionRetriever_Retrievers implements INode {
{
label: 'Document',
name: 'document',
baseClasses: ['Document']
description: 'Array of document objects containing metadata and pageContent',
baseClasses: ['Document', 'json']
},
{
label: 'Text',
name: 'text',
description: 'Concatenated string from pageContent of documents',
baseClasses: ['string', 'json']
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,13 @@ class RRFRetriever_Retrievers implements INode {
{
label: 'Document',
name: 'document',
baseClasses: ['Document']
description: 'Array of document objects containing metadata and pageContent',
baseClasses: ['Document', 'json']
},
{
label: 'Text',
name: 'text',
description: 'Concatenated string from pageContent of documents',
baseClasses: ['string', 'json']
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,13 @@ class SimilarityThresholdRetriever_Retrievers implements INode {
{
label: 'Document',
name: 'document',
baseClasses: ['Document']
description: 'Array of document objects containing metadata and pageContent',
baseClasses: ['Document', 'json']
},
{
label: 'Text',
name: 'text',
description: 'Concatenated string from pageContent of documents',
baseClasses: ['string', 'json']
}
]
Expand Down
4 changes: 2 additions & 2 deletions packages/server/marketplaces/chatflows/Claude LLM.json
Original file line number Diff line number Diff line change
Expand Up @@ -441,10 +441,10 @@
"type": "options",
"options": [
{
"id": "plainText_0-output-document-Document",
"id": "plainText_0-output-document-Document|json",
"name": "document",
"label": "Document",
"type": "Document"
"type": "Document | json"
},
{
"id": "plainText_0-output-text-string|json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@
"type": "options",
"options": [
{
"id": "textFile_0-output-document-Document",
"id": "textFile_0-output-document-Document|json",
"name": "document",
"label": "Document",
"type": "Document"
"type": "Document | json"
},
{
"id": "textFile_0-output-text-string|json",
Expand Down Expand Up @@ -851,11 +851,11 @@
},
{
"source": "textFile_0",
"sourceHandle": "textFile_0-output-document-Document",
"sourceHandle": "textFile_0-output-document-Document|json",
"target": "pineconeLlamaIndex_0",
"targetHandle": "pineconeLlamaIndex_0-input-document-Document",
"type": "buttonedge",
"id": "textFile_0-textFile_0-output-document-Document-pineconeLlamaIndex_0-pineconeLlamaIndex_0-input-document-Document",
"id": "textFile_0-textFile_0-output-document-Document|json-pineconeLlamaIndex_0-pineconeLlamaIndex_0-input-document-Document",
"data": {
"label": ""
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,10 +235,10 @@
"type": "options",
"options": [
{
"id": "textFile_0-output-document-Document",
"id": "textFile_0-output-document-Document|json",
"name": "document",
"label": "Document",
"type": "Document"
"type": "Document | json"
},
{
"id": "textFile_0-output-text-string|json",
Expand Down Expand Up @@ -732,11 +732,11 @@
},
{
"source": "textFile_0",
"sourceHandle": "textFile_0-output-document-Document",
"sourceHandle": "textFile_0-output-document-Document|json",
"target": "pinecone_0",
"targetHandle": "pinecone_0-input-document-Document",
"type": "buttonedge",
"id": "textFile_0-textFile_0-output-document-Document-pinecone_0-pinecone_0-input-document-Document",
"id": "textFile_0-textFile_0-output-document-Document|json-pinecone_0-pinecone_0-input-document-Document",
"data": {
"label": ""
}
Expand Down
8 changes: 4 additions & 4 deletions packages/server/marketplaces/chatflows/Local QnA.json
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,10 @@
"type": "options",
"options": [
{
"id": "textFile_0-output-document-Document",
"id": "textFile_0-output-document-Document|json",
"name": "document",
"label": "Document",
"type": "Document"
"type": "Document | json"
},
{
"id": "textFile_0-output-text-string|json",
Expand Down Expand Up @@ -651,11 +651,11 @@
},
{
"source": "textFile_0",
"sourceHandle": "textFile_0-output-document-Document",
"sourceHandle": "textFile_0-output-document-Document|json",
"target": "faiss_0",
"targetHandle": "faiss_0-input-document-Document",
"type": "buttonedge",
"id": "textFile_0-textFile_0-output-document-Document-faiss_0-faiss_0-input-document-Document",
"id": "textFile_0-textFile_0-output-document-Document|json-faiss_0-faiss_0-input-document-Document",
"data": {
"label": ""
}
Expand Down
8 changes: 4 additions & 4 deletions packages/server/marketplaces/chatflows/Metadata Filter.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,10 @@
"type": "options",
"options": [
{
"id": "textFile_0-output-document-Document",
"id": "textFile_0-output-document-Document|json",
"name": "document",
"label": "Document",
"type": "Document"
"type": "Document | json"
},
{
"id": "textFile_0-output-text-string|json",
Expand Down Expand Up @@ -838,11 +838,11 @@
},
{
"source": "textFile_0",
"sourceHandle": "textFile_0-output-document-Document",
"sourceHandle": "textFile_0-output-document-Document|json",
"target": "pinecone_0",
"targetHandle": "pinecone_0-input-document-Document",
"type": "buttonedge",
"id": "textFile_0-textFile_0-output-document-Document-pinecone_0-pinecone_0-input-document-Document",
"id": "textFile_0-textFile_0-output-document-Document|json-pinecone_0-pinecone_0-input-document-Document",
"data": {
"label": ""
}
Expand Down
16 changes: 8 additions & 8 deletions packages/server/marketplaces/chatflows/Multiple VectorDB.json
Original file line number Diff line number Diff line change
Expand Up @@ -966,10 +966,10 @@
"type": "options",
"options": [
{
"id": "plainText_0-output-document-Document",
"id": "plainText_0-output-document-Document|json",
"name": "document",
"label": "Document",
"type": "Document"
"type": "Document | json"
},
{
"id": "plainText_0-output-text-string|json",
Expand Down Expand Up @@ -1503,10 +1503,10 @@
"type": "options",
"options": [
{
"id": "plainText_1-output-document-Document",
"id": "plainText_1-output-document-Document|json",
"name": "document",
"label": "Document",
"type": "Document"
"type": "Document | json"
},
{
"id": "plainText_1-output-text-string|json",
Expand Down Expand Up @@ -1723,11 +1723,11 @@
},
{
"source": "plainText_0",
"sourceHandle": "plainText_0-output-document-Document",
"sourceHandle": "plainText_0-output-document-Document|json",
"target": "redis_0",
"targetHandle": "redis_0-input-document-Document",
"type": "buttonedge",
"id": "plainText_0-plainText_0-output-document-Document-redis_0-redis_0-input-document-Document",
"id": "plainText_0-plainText_0-output-document-Document|json-redis_0-redis_0-input-document-Document",
"data": {
"label": ""
}
Expand Down Expand Up @@ -1778,11 +1778,11 @@
},
{
"source": "plainText_1",
"sourceHandle": "plainText_1-output-document-Document",
"sourceHandle": "plainText_1-output-document-Document|json",
"target": "faiss_0",
"targetHandle": "faiss_0-input-document-Document",
"type": "buttonedge",
"id": "plainText_1-plainText_1-output-document-Document-faiss_0-faiss_0-input-document-Document",
"id": "plainText_1-plainText_1-output-document-Document|json-faiss_0-faiss_0-input-document-Document",
"data": {
"label": ""
}
Expand Down
3 changes: 3 additions & 0 deletions packages/ui/src/utils/genericHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export const initNode = (nodeData, newNodeId) => {
id: `${newNodeId}-output-${nodeData.outputs[j].name}-${baseClasses}`,
name: nodeData.outputs[j].name,
label: nodeData.outputs[j].label,
description: nodeData.outputs[j].description ?? '',
type
}
options.push(newOutputOption)
Expand All @@ -107,6 +108,7 @@ export const initNode = (nodeData, newNodeId) => {
name: 'output',
label: 'Output',
type: 'options',
description: nodeData.outputs[0].description ?? '',
options,
default: nodeData.outputs[0].name
}
Expand All @@ -116,6 +118,7 @@ export const initNode = (nodeData, newNodeId) => {
id: `${newNodeId}-output-${nodeData.name}-${nodeData.baseClasses.join('|')}`,
name: nodeData.name,
label: nodeData.type,
description: nodeData.description ?? '',
type: nodeData.baseClasses.join(' | ')
}
outputAnchors.push(newOutput)
Expand Down

0 comments on commit 2ef0f81

Please sign in to comment.