Merge branch 'feature/RAG-VectorStores-Updates-2' into feature/RAG-VectorStores-Updates

# Conflicts:
#	packages/components/nodes/retrievers/CohereRerankRetriever/CohereRerank.ts
#	packages/components/nodes/retrievers/CohereRerankRetriever/CohereRerankRetriever.ts
This commit is contained in:
Henry 2024-01-17 17:43:50 +00:00
commit 60d0fad62c
29 changed files with 747 additions and 133 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "flowise", "name": "flowise",
"version": "1.4.9", "version": "1.4.10",
"private": true, "private": true,
"homepage": "https://flowiseai.com", "homepage": "https://flowiseai.com",
"workspaces": [ "workspaces": [
@ -48,7 +48,7 @@
"pretty-quick": "^3.1.3", "pretty-quick": "^3.1.3",
"rimraf": "^3.0.2", "rimraf": "^3.0.2",
"run-script-os": "^1.1.6", "run-script-os": "^1.1.6",
"turbo": "1.7.4", "turbo": "^1.7.4",
"typescript": "^4.8.4" "typescript": "^4.8.4"
}, },
"engines": { "engines": {

View File

@ -1,7 +1,9 @@
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface' import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils' import { convertMultiOptionsToStringArray, getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
import { BaseCache } from 'langchain/schema' import { BaseCache } from 'langchain/schema'
import { ChatGoogleGenerativeAI } from '@langchain/google-genai' import { ChatGoogleGenerativeAI, GoogleGenerativeAIChatInput } from '@langchain/google-genai'
import { HarmBlockThreshold, HarmCategory } from '@google/generative-ai'
import type { SafetySetting } from '@google/generative-ai'
class GoogleGenerativeAI_ChatModels implements INode { class GoogleGenerativeAI_ChatModels implements INode {
label: string label: string
@ -74,6 +76,73 @@ class GoogleGenerativeAI_ChatModels implements INode {
step: 0.1, step: 0.1,
optional: true, optional: true,
additionalParams: true additionalParams: true
},
{
label: 'Top Next Highest Probability Tokens',
name: 'topK',
type: 'number',
description: `Decode using top-k sampling: consider the set of top_k most probable tokens. Must be positive`,
step: 1,
optional: true,
additionalParams: true
},
{
label: 'Harm Category',
name: 'harmCategory',
type: 'multiOptions',
description:
'Refer to <a target="_blank" href="https://cloud.google.com/vertex-ai/docs/generative-ai/multimodal/configure-safety-attributes#safety_attribute_definitions">official guide</a> on how to use Harm Category',
options: [
{
label: 'Dangerous',
name: HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT
},
{
label: 'Harassment',
name: HarmCategory.HARM_CATEGORY_HARASSMENT
},
{
label: 'Hate Speech',
name: HarmCategory.HARM_CATEGORY_HATE_SPEECH
},
{
label: 'Sexually Explicit',
name: HarmCategory.HARM_CATEGORY_SEXUALLY_EXPLICIT
}
],
optional: true,
additionalParams: true
},
{
label: 'Harm Block Threshold',
name: 'harmBlockThreshold',
type: 'multiOptions',
description:
'Refer to <a target="_blank" href="https://cloud.google.com/vertex-ai/docs/generative-ai/multimodal/configure-safety-attributes#safety_setting_thresholds">official guide</a> on how to use Harm Block Threshold',
options: [
{
label: 'Low and Above',
name: HarmBlockThreshold.BLOCK_LOW_AND_ABOVE
},
{
label: 'Medium and Above',
name: HarmBlockThreshold.BLOCK_MEDIUM_AND_ABOVE
},
{
label: 'None',
name: HarmBlockThreshold.BLOCK_NONE
},
{
label: 'Only High',
name: HarmBlockThreshold.BLOCK_ONLY_HIGH
},
{
label: 'Threshold Unspecified',
name: HarmBlockThreshold.HARM_BLOCK_THRESHOLD_UNSPECIFIED
}
],
optional: true,
additionalParams: true
} }
] ]
} }
@ -86,9 +155,12 @@ class GoogleGenerativeAI_ChatModels implements INode {
const modelName = nodeData.inputs?.modelName as string const modelName = nodeData.inputs?.modelName as string
const maxOutputTokens = nodeData.inputs?.maxOutputTokens as string const maxOutputTokens = nodeData.inputs?.maxOutputTokens as string
const topP = nodeData.inputs?.topP as string const topP = nodeData.inputs?.topP as string
const topK = nodeData.inputs?.topK as string
const harmCategory = nodeData.inputs?.harmCategory as string
const harmBlockThreshold = nodeData.inputs?.harmBlockThreshold as string
const cache = nodeData.inputs?.cache as BaseCache const cache = nodeData.inputs?.cache as BaseCache
const obj = { const obj: Partial<GoogleGenerativeAIChatInput> = {
apiKey: apiKey, apiKey: apiKey,
modelName: modelName, modelName: modelName,
maxOutputTokens: 2048 maxOutputTokens: 2048
@ -98,8 +170,23 @@ class GoogleGenerativeAI_ChatModels implements INode {
const model = new ChatGoogleGenerativeAI(obj) const model = new ChatGoogleGenerativeAI(obj)
if (topP) model.topP = parseFloat(topP) if (topP) model.topP = parseFloat(topP)
if (topK) model.topK = parseFloat(topK)
if (cache) model.cache = cache if (cache) model.cache = cache
if (temperature) model.temperature = parseFloat(temperature) if (temperature) model.temperature = parseFloat(temperature)
// Safety Settings
let harmCategories: string[] = convertMultiOptionsToStringArray(harmCategory)
let harmBlockThresholds: string[] = convertMultiOptionsToStringArray(harmBlockThreshold)
if (harmCategories.length != harmBlockThresholds.length)
throw new Error(`Harm Category & Harm Block Threshold are not the same length`)
const safetySettings: SafetySetting[] = harmCategories.map((harmCategory, index) => {
return {
category: harmCategory as HarmCategory,
threshold: harmBlockThresholds[index] as HarmBlockThreshold
}
})
if (safetySettings.length > 0) model.safetySettings = safetySettings
return model return model
} }
} }

View File

@ -0,0 +1 @@
<svg width="32" height="32" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M11.776 18.304c.64 0 1.92-.032 3.712-.768 2.08-.864 6.176-2.4 9.152-4 2.08-1.12 2.976-2.592 2.976-4.576 0-2.72-2.208-4.96-4.96-4.96h-11.52A7.143 7.143 0 0 0 4 11.136c0 3.936 3.008 7.168 7.776 7.168Z" fill="#39594D"/><path fill-rule="evenodd" clip-rule="evenodd" d="M13.728 23.2c0-1.92 1.152-3.68 2.944-4.416l3.616-1.504C23.968 15.776 28 18.464 28 22.432A5.572 5.572 0 0 1 22.432 28h-3.936c-2.624 0-4.768-2.144-4.768-4.8Z" fill="#D18EE2"/><path d="M8.128 19.232A4.138 4.138 0 0 0 4 23.36v.544C4 26.144 5.856 28 8.128 28a4.138 4.138 0 0 0 4.128-4.128v-.544c-.032-2.24-1.856-4.096-4.128-4.096Z" fill="#FF7759"/></svg>

After

Width:  |  Height:  |  Size: 738 B

View File

@ -1,7 +1,7 @@
import { ICommonObject, INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface' import { ICommonObject, INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface'
import { BaseRetriever } from 'langchain/schema/retriever' import { BaseRetriever } from 'langchain/schema/retriever'
import { ContextualCompressionRetriever } from 'langchain/retrievers/contextual_compression' import { ContextualCompressionRetriever } from 'langchain/retrievers/contextual_compression'
import { getCredentialData, getCredentialParam } from '../../../src' import { getCredentialData, getCredentialParam, handleEscapeCharacters } from '../../../src'
import { CohereRerank } from './CohereRerank' import { CohereRerank } from './CohereRerank'
import { VectorStoreRetriever } from 'langchain/vectorstores/base' import { VectorStoreRetriever } from 'langchain/vectorstores/base'
@ -15,16 +15,16 @@ class CohereRerankRetriever_Retrievers implements INode {
category: string category: string
baseClasses: string[] baseClasses: string[]
inputs: INodeParams[] inputs: INodeParams[]
outputs: INodeOutputsValue[]
credential: INodeParams credential: INodeParams
badge: string badge: string
outputs: INodeOutputsValue[]
constructor() { constructor() {
this.label = 'Cohere Rerank Retriever' this.label = 'Cohere Rerank Retriever'
this.name = 'cohereRerankRetriever' this.name = 'cohereRerankRetriever'
this.version = 1.0 this.version = 1.0
this.type = 'Cohere Rerank Retriever' this.type = 'Cohere Rerank Retriever'
this.icon = 'compressionRetriever.svg' this.icon = 'Cohere.svg'
this.category = 'Retrievers' this.category = 'Retrievers'
this.badge = 'NEW' this.badge = 'NEW'
this.description = 'Cohere Rerank indexes the documents from most to least semantically relevant to the query.' this.description = 'Cohere Rerank indexes the documents from most to least semantically relevant to the query.'
@ -37,7 +37,7 @@ class CohereRerankRetriever_Retrievers implements INode {
} }
this.inputs = [ this.inputs = [
{ {
label: 'Base Retriever', label: 'Vector Store Retriever',
name: 'baseRetriever', name: 'baseRetriever',
type: 'VectorStoreRetriever' type: 'VectorStoreRetriever'
}, },
@ -58,47 +58,84 @@ class CohereRerankRetriever_Retrievers implements INode {
default: 'rerank-english-v2.0', default: 'rerank-english-v2.0',
optional: true optional: true
}, },
{
label: 'Query',
name: 'query',
type: 'string',
description: 'Query to retrieve documents from retriever. If not specified, user question will be used',
optional: true,
acceptVariable: true
},
{ {
label: 'Top K', label: 'Top K',
name: 'topK', name: 'topK',
description: 'Number of top results to fetch. Default to the TopK of the Base Retriever', description: 'Number of top results to fetch. Default to the TopK of the Base Retriever',
placeholder: '0', placeholder: '4',
type: 'number', type: 'number',
default: 0,
additionalParams: true, additionalParams: true,
optional: true optional: true
}, },
{ {
label: 'Max Chunks Per Document', label: 'Max Chunks Per Doc',
name: 'maxChunksPerDoc', name: 'maxChunksPerDoc',
description: 'The maximum number of chunks to produce internally from a document. Default to 10',
placeholder: '10', placeholder: '10',
type: 'number', type: 'number',
default: 10,
additionalParams: true, additionalParams: true,
optional: true optional: true
} }
] ]
this.outputs = [
{
label: 'Cohere Rerank Retriever',
name: 'retriever',
baseClasses: this.baseClasses
},
{
label: 'Document',
name: 'document',
baseClasses: ['Document']
},
{
label: 'Text',
name: 'text',
baseClasses: ['string', 'json']
}
]
} }
async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> { async init(nodeData: INodeData, input: string, options: ICommonObject): Promise<any> {
const baseRetriever = nodeData.inputs?.baseRetriever as BaseRetriever const baseRetriever = nodeData.inputs?.baseRetriever as BaseRetriever
const model = nodeData.inputs?.model as string const model = nodeData.inputs?.model as string
const query = nodeData.inputs?.query as string
const credentialData = await getCredentialData(nodeData.credential ?? '', options) const credentialData = await getCredentialData(nodeData.credential ?? '', options)
const cohereApiKey = getCredentialParam('cohereApiKey', credentialData, nodeData) const cohereApiKey = getCredentialParam('cohereApiKey', credentialData, nodeData)
const topK = nodeData.inputs?.topK as string const topK = nodeData.inputs?.topK as string
let k = topK ? parseFloat(topK) : 4 const k = topK ? parseFloat(topK) : (baseRetriever as VectorStoreRetriever).k ?? 4
const maxChunks = nodeData.inputs?.maxChunksPerDoc as string const maxChunksPerDoc = nodeData.inputs?.maxChunksPerDoc as string
let max = maxChunks ? parseInt(maxChunks) : 10 const max_chunks_per_doc = maxChunksPerDoc ? parseFloat(maxChunksPerDoc) : 10
const output = nodeData.outputs?.output as string
if (k <= 0) { const cohereCompressor = new CohereRerank(cohereApiKey, model, k, max_chunks_per_doc)
k = (baseRetriever as VectorStoreRetriever).k
}
const cohereCompressor = new CohereRerank(cohereApiKey, model, k, max) const retriever = new ContextualCompressionRetriever({
return new ContextualCompressionRetriever({
baseCompressor: cohereCompressor, baseCompressor: cohereCompressor,
baseRetriever: baseRetriever baseRetriever: baseRetriever
}) })
if (output === 'retriever') return retriever
else if (output === 'document') return await retriever.getRelevantDocuments(query ? query : input)
else if (output === 'text') {
let finaltext = ''
const docs = await retriever.getRelevantDocuments(query ? query : input)
for (const doc of docs) finaltext += `${doc.pageContent}\n`
return handleEscapeCharacters(finaltext, false)
}
return retriever
} }
} }

View File

@ -1,7 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-chart-bar" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>
<path d="M3 12m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v6a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z" />
<path d="M9 8m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v10a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z" />
<path d="M15 4m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v14a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z" />
<path d="M4 20l14 0" />
</svg>

Before

Width:  |  Height:  |  Size: 600 B

View File

@ -3,6 +3,7 @@ import { BaseRetriever } from 'langchain/schema/retriever'
import { Embeddings } from 'langchain/embeddings/base' import { Embeddings } from 'langchain/embeddings/base'
import { ContextualCompressionRetriever } from 'langchain/retrievers/contextual_compression' import { ContextualCompressionRetriever } from 'langchain/retrievers/contextual_compression'
import { EmbeddingsFilter } from 'langchain/retrievers/document_compressors/embeddings_filter' import { EmbeddingsFilter } from 'langchain/retrievers/document_compressors/embeddings_filter'
import { handleEscapeCharacters } from '../../../src/utils'
class EmbeddingsFilterRetriever_Retrievers implements INode { class EmbeddingsFilterRetriever_Retrievers implements INode {
label: string label: string
@ -29,15 +30,22 @@ class EmbeddingsFilterRetriever_Retrievers implements INode {
this.baseClasses = [this.type, 'BaseRetriever'] this.baseClasses = [this.type, 'BaseRetriever']
this.inputs = [ this.inputs = [
{ {
label: 'Base Retriever', label: 'Vector Store Retriever',
name: 'baseRetriever', name: 'baseRetriever',
type: 'VectorStoreRetriever' type: 'VectorStoreRetriever'
}, },
{ {
label: 'Embeddings', label: 'Embeddings',
name: 'embeddings', name: 'embeddings',
type: 'Embeddings', type: 'Embeddings'
optional: false },
{
label: 'Query',
name: 'query',
type: 'string',
description: 'Query to retrieve documents from retriever. If not specified, user question will be used',
optional: true,
acceptVariable: true
}, },
{ {
label: 'Similarity Threshold', label: 'Similarity Threshold',
@ -61,36 +69,64 @@ class EmbeddingsFilterRetriever_Retrievers implements INode {
additionalParams: true additionalParams: true
} }
] ]
this.outputs = [
{
label: 'Embeddings Filter Retriever',
name: 'retriever',
baseClasses: this.baseClasses
},
{
label: 'Document',
name: 'document',
baseClasses: ['Document']
},
{
label: 'Text',
name: 'text',
baseClasses: ['string', 'json']
}
]
} }
async init(nodeData: INodeData): Promise<any> { async init(nodeData: INodeData, input: string): Promise<any> {
const baseRetriever = nodeData.inputs?.baseRetriever as BaseRetriever const baseRetriever = nodeData.inputs?.baseRetriever as BaseRetriever
const embeddings = nodeData.inputs?.embeddings as Embeddings const embeddings = nodeData.inputs?.embeddings as Embeddings
const query = nodeData.inputs?.query as string
const similarityThreshold = nodeData.inputs?.similarityThreshold as string const similarityThreshold = nodeData.inputs?.similarityThreshold as string
const k = nodeData.inputs?.k as string const k = nodeData.inputs?.k as string
const output = nodeData.outputs?.output as string
if (k === undefined && similarityThreshold === undefined) { if (k === undefined && similarityThreshold === undefined) {
throw new Error(`Must specify one of "k" or "similarity_threshold".`) throw new Error(`Must specify one of "k" or "similarity_threshold".`)
} }
let similarityThresholdNumber = 0.8 const similarityThresholdNumber = similarityThreshold ? parseFloat(similarityThreshold) : 0.8
if (similarityThreshold) { const kNumber = k ? parseFloat(k) : undefined
similarityThresholdNumber = parseFloat(similarityThreshold)
}
let kNumber = 0.8
if (k) {
kNumber = parseFloat(k)
}
const baseCompressor = new EmbeddingsFilter({ const baseCompressor = new EmbeddingsFilter({
embeddings: embeddings, embeddings: embeddings,
similarityThreshold: similarityThresholdNumber, similarityThreshold: similarityThresholdNumber,
k: kNumber k: kNumber
}) })
return new ContextualCompressionRetriever({ const retriever = new ContextualCompressionRetriever({
baseCompressor, baseCompressor,
baseRetriever: baseRetriever baseRetriever: baseRetriever
}) })
if (output === 'retriever') return retriever
else if (output === 'document') return await retriever.getRelevantDocuments(query ? query : input)
else if (output === 'text') {
let finaltext = ''
const docs = await retriever.getRelevantDocuments(query ? query : input)
for (const doc of docs) finaltext += `${doc.pageContent}\n`
return handleEscapeCharacters(finaltext, false)
}
return retriever
} }
} }

View File

@ -1,8 +1,9 @@
import { VectorStore } from 'langchain/vectorstores/base' import { VectorStore } from 'langchain/vectorstores/base'
import { INode, INodeData, INodeParams } from '../../../src/Interface' import { INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface'
import { HydeRetriever, HydeRetrieverOptions, PromptKey } from 'langchain/retrievers/hyde' import { HydeRetriever, HydeRetrieverOptions, PromptKey } from 'langchain/retrievers/hyde'
import { BaseLanguageModel } from 'langchain/base_language' import { BaseLanguageModel } from 'langchain/base_language'
import { PromptTemplate } from 'langchain/prompts' import { PromptTemplate } from 'langchain/prompts'
import { handleEscapeCharacters } from '../../../src/utils'
class HydeRetriever_Retrievers implements INode { class HydeRetriever_Retrievers implements INode {
label: string label: string
@ -14,11 +15,12 @@ class HydeRetriever_Retrievers implements INode {
category: string category: string
baseClasses: string[] baseClasses: string[]
inputs: INodeParams[] inputs: INodeParams[]
outputs: INodeOutputsValue[]
constructor() { constructor() {
this.label = 'Hyde Retriever' this.label = 'HyDE Retriever'
this.name = 'HydeRetriever' this.name = 'HydeRetriever'
this.version = 2.0 this.version = 3.0
this.type = 'HydeRetriever' this.type = 'HydeRetriever'
this.icon = 'hyderetriever.svg' this.icon = 'hyderetriever.svg'
this.category = 'Retrievers' this.category = 'Retrievers'
@ -35,6 +37,14 @@ class HydeRetriever_Retrievers implements INode {
name: 'vectorStore', name: 'vectorStore',
type: 'VectorStore' type: 'VectorStore'
}, },
{
label: 'Query',
name: 'query',
type: 'string',
description: 'Query to retrieve documents from retriever. If not specified, user question will be used',
optional: true,
acceptVariable: true
},
{ {
label: 'Select Defined Prompt', label: 'Select Defined Prompt',
name: 'promptKey', name: 'promptKey',
@ -121,15 +131,34 @@ Passage:`
optional: true optional: true
} }
] ]
this.outputs = [
{
label: 'HyDE Retriever',
name: 'retriever',
baseClasses: this.baseClasses
},
{
label: 'Document',
name: 'document',
baseClasses: ['Document']
},
{
label: 'Text',
name: 'text',
baseClasses: ['string', 'json']
}
]
} }
async init(nodeData: INodeData): Promise<any> { async init(nodeData: INodeData, input: string): Promise<any> {
const llm = nodeData.inputs?.model as BaseLanguageModel const llm = nodeData.inputs?.model as BaseLanguageModel
const vectorStore = nodeData.inputs?.vectorStore as VectorStore const vectorStore = nodeData.inputs?.vectorStore as VectorStore
const promptKey = nodeData.inputs?.promptKey as PromptKey const promptKey = nodeData.inputs?.promptKey as PromptKey
const customPrompt = nodeData.inputs?.customPrompt as string const customPrompt = nodeData.inputs?.customPrompt as string
const query = nodeData.inputs?.query as string
const topK = nodeData.inputs?.topK as string const topK = nodeData.inputs?.topK as string
const k = topK ? parseFloat(topK) : 4 const k = topK ? parseFloat(topK) : 4
const output = nodeData.outputs?.output as string
const obj: HydeRetrieverOptions<any> = { const obj: HydeRetrieverOptions<any> = {
llm, llm,
@ -141,6 +170,19 @@ Passage:`
else if (promptKey) obj.promptTemplate = promptKey else if (promptKey) obj.promptTemplate = promptKey
const retriever = new HydeRetriever(obj) const retriever = new HydeRetriever(obj)
if (output === 'retriever') return retriever
else if (output === 'document') return await retriever.getRelevantDocuments(query ? query : input)
else if (output === 'text') {
let finaltext = ''
const docs = await retriever.getRelevantDocuments(query ? query : input)
for (const doc of docs) finaltext += `${doc.pageContent}\n`
return handleEscapeCharacters(finaltext, false)
}
return retriever return retriever
} }
} }

View File

@ -3,6 +3,7 @@ import { BaseRetriever } from 'langchain/schema/retriever'
import { ContextualCompressionRetriever } from 'langchain/retrievers/contextual_compression' import { ContextualCompressionRetriever } from 'langchain/retrievers/contextual_compression'
import { BaseLanguageModel } from 'langchain/base_language' import { BaseLanguageModel } from 'langchain/base_language'
import { LLMChainExtractor } from 'langchain/retrievers/document_compressors/chain_extract' import { LLMChainExtractor } from 'langchain/retrievers/document_compressors/chain_extract'
import { handleEscapeCharacters } from '../../../src/utils'
class LLMFilterCompressionRetriever_Retrievers implements INode { class LLMFilterCompressionRetriever_Retrievers implements INode {
label: string label: string
@ -22,7 +23,7 @@ class LLMFilterCompressionRetriever_Retrievers implements INode {
this.name = 'llmFilterRetriever' this.name = 'llmFilterRetriever'
this.version = 1.0 this.version = 1.0
this.type = 'LLMFilterRetriever' this.type = 'LLMFilterRetriever'
this.icon = 'compressionRetriever.svg' this.icon = 'llmFilterRetriever.svg'
this.category = 'Retrievers' this.category = 'Retrievers'
this.badge = 'NEW' this.badge = 'NEW'
this.description = this.description =
@ -30,30 +31,69 @@ class LLMFilterCompressionRetriever_Retrievers implements INode {
this.baseClasses = [this.type, 'BaseRetriever'] this.baseClasses = [this.type, 'BaseRetriever']
this.inputs = [ this.inputs = [
{ {
label: 'Base Retriever', label: 'Vector Store Retriever',
name: 'baseRetriever', name: 'baseRetriever',
type: 'VectorStoreRetriever' type: 'VectorStoreRetriever'
}, },
{ {
label: 'Language Model', label: 'Language Model',
name: 'model', name: 'model',
type: 'BaseLanguageModel', type: 'BaseLanguageModel'
optional: true },
{
label: 'Query',
name: 'query',
type: 'string',
description: 'Query to retrieve documents from retriever. If not specified, user question will be used',
optional: true,
acceptVariable: true
}
]
this.outputs = [
{
label: 'LLM Filter Retriever',
name: 'retriever',
baseClasses: this.baseClasses
},
{
label: 'Document',
name: 'document',
baseClasses: ['Document']
},
{
label: 'Text',
name: 'text',
baseClasses: ['string', 'json']
} }
] ]
} }
async init(nodeData: INodeData): Promise<any> { async init(nodeData: INodeData, input: string): Promise<any> {
const baseRetriever = nodeData.inputs?.baseRetriever as BaseRetriever const baseRetriever = nodeData.inputs?.baseRetriever as BaseRetriever
const model = nodeData.inputs?.model as BaseLanguageModel const model = nodeData.inputs?.model as BaseLanguageModel
const query = nodeData.inputs?.query as string
const output = nodeData.outputs?.output as string
if (model) { if (!model) throw new Error('There must be a LLM model connected to LLM Filter Retriever')
return new ContextualCompressionRetriever({
baseCompressor: LLMChainExtractor.fromLLM(model), const retriever = new ContextualCompressionRetriever({
baseRetriever: baseRetriever baseCompressor: LLMChainExtractor.fromLLM(model),
}) baseRetriever: baseRetriever
})
if (output === 'retriever') return retriever
else if (output === 'document') return await retriever.getRelevantDocuments(query ? query : input)
else if (output === 'text') {
let finaltext = ''
const docs = await retriever.getRelevantDocuments(query ? query : input)
for (const doc of docs) finaltext += `${doc.pageContent}\n`
return handleEscapeCharacters(finaltext, false)
} }
return {}
return retriever
} }
} }

View File

@ -1,7 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-chart-bar" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>
<path d="M3 12m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v6a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z" />
<path d="M9 8m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v10a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z" />
<path d="M15 4m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v14a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z" />
<path d="M4 20l14 0" />
</svg>

Before

Width:  |  Height:  |  Size: 600 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-filter-check" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M11.18 20.274l-2.18 .726v-8.5l-4.48 -4.928a2 2 0 0 1 -.52 -1.345v-2.227h16v2.172a2 2 0 0 1 -.586 1.414l-4.414 4.414v3" /><path d="M15 19l2 2l4 -4" /></svg>

After

Width:  |  Height:  |  Size: 446 B

View File

@ -1,9 +1,10 @@
import { INode, INodeData, INodeParams } from '../../../src/Interface' import { INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface'
import { BaseLanguageModel } from 'langchain/base_language' import { BaseLanguageModel } from 'langchain/base_language'
import { ContextualCompressionRetriever } from 'langchain/retrievers/contextual_compression' import { ContextualCompressionRetriever } from 'langchain/retrievers/contextual_compression'
import { BaseRetriever } from 'langchain/schema/retriever' import { BaseRetriever } from 'langchain/schema/retriever'
import { ReciprocalRankFusion } from './ReciprocalRankFusion' import { ReciprocalRankFusion } from './ReciprocalRankFusion'
import { VectorStoreRetriever } from 'langchain/vectorstores/base' import { VectorStoreRetriever } from 'langchain/vectorstores/base'
import { handleEscapeCharacters } from '../../../src/utils'
class RRFRetriever_Retrievers implements INode { class RRFRetriever_Retrievers implements INode {
label: string label: string
@ -16,20 +17,21 @@ class RRFRetriever_Retrievers implements INode {
baseClasses: string[] baseClasses: string[]
inputs: INodeParams[] inputs: INodeParams[]
badge: string badge: string
outputs: INodeOutputsValue[]
constructor() { constructor() {
this.label = 'Reciprocal Rank Fusion Retriever' this.label = 'Reciprocal Rank Fusion Retriever'
this.name = 'RRFRetriever' this.name = 'RRFRetriever'
this.version = 2.0 this.version = 1.0
this.type = 'RRFRetriever' this.type = 'RRFRetriever'
this.badge = 'NEW' this.badge = 'NEW'
this.icon = 'compressionRetriever.svg' this.icon = 'rrfRetriever.svg'
this.category = 'Retrievers' this.category = 'Retrievers'
this.description = 'Reciprocal Rank Fusion to re-rank search results by multiple query generation.' this.description = 'Reciprocal Rank Fusion to re-rank search results by multiple query generation.'
this.baseClasses = [this.type, 'BaseRetriever'] this.baseClasses = [this.type, 'BaseRetriever']
this.inputs = [ this.inputs = [
{ {
label: 'Base Retriever', label: 'Vector Store Retriever',
name: 'baseRetriever', name: 'baseRetriever',
type: 'VectorStoreRetriever' type: 'VectorStoreRetriever'
}, },
@ -38,6 +40,14 @@ class RRFRetriever_Retrievers implements INode {
name: 'model', name: 'model',
type: 'BaseLanguageModel' type: 'BaseLanguageModel'
}, },
{
label: 'Query',
name: 'query',
type: 'string',
description: 'Query to retrieve documents from retriever. If not specified, user question will be used',
optional: true,
acceptVariable: true
},
{ {
label: 'Query Count', label: 'Query Count',
name: 'queryCount', name: 'queryCount',
@ -54,7 +64,6 @@ class RRFRetriever_Retrievers implements INode {
description: 'Number of top results to fetch. Default to the TopK of the Base Retriever', description: 'Number of top results to fetch. Default to the TopK of the Base Retriever',
placeholder: '0', placeholder: '0',
type: 'number', type: 'number',
default: 0,
additionalParams: true, additionalParams: true,
optional: true optional: true
}, },
@ -71,27 +80,56 @@ class RRFRetriever_Retrievers implements INode {
optional: true optional: true
} }
] ]
this.outputs = [
{
label: 'Reciprocal Rank Fusion Retriever',
name: 'retriever',
baseClasses: this.baseClasses
},
{
label: 'Document',
name: 'document',
baseClasses: ['Document']
},
{
label: 'Text',
name: 'text',
baseClasses: ['string', 'json']
}
]
} }
async init(nodeData: INodeData): Promise<any> { async init(nodeData: INodeData, input: string): Promise<any> {
const llm = nodeData.inputs?.model as BaseLanguageModel const llm = nodeData.inputs?.model as BaseLanguageModel
const baseRetriever = nodeData.inputs?.baseRetriever as BaseRetriever const baseRetriever = nodeData.inputs?.baseRetriever as BaseRetriever
const query = nodeData.inputs?.query as string
const queryCount = nodeData.inputs?.queryCount as string const queryCount = nodeData.inputs?.queryCount as string
const q = queryCount ? parseFloat(queryCount) : 4 const q = queryCount ? parseFloat(queryCount) : 4
const topK = nodeData.inputs?.topK as string const topK = nodeData.inputs?.topK as string
let k = topK ? parseFloat(topK) : 4 const k = topK ? parseFloat(topK) : (baseRetriever as VectorStoreRetriever).k ?? 4
const constantC = nodeData.inputs?.c as string const constantC = nodeData.inputs?.c as string
let c = topK ? parseFloat(constantC) : 60 const c = topK ? parseFloat(constantC) : 60
const output = nodeData.outputs?.output as string
if (k <= 0) {
k = (baseRetriever as VectorStoreRetriever).k
}
const ragFusion = new ReciprocalRankFusion(llm, baseRetriever as VectorStoreRetriever, q, k, c) const ragFusion = new ReciprocalRankFusion(llm, baseRetriever as VectorStoreRetriever, q, k, c)
return new ContextualCompressionRetriever({ const retriever = new ContextualCompressionRetriever({
baseCompressor: ragFusion, baseCompressor: ragFusion,
baseRetriever: baseRetriever baseRetriever: baseRetriever
}) })
if (output === 'retriever') return retriever
else if (output === 'document') return await retriever.getRelevantDocuments(query ? query : input)
else if (output === 'text') {
let finaltext = ''
const docs = await retriever.getRelevantDocuments(query ? query : input)
for (const doc of docs) finaltext += `${doc.pageContent}\n`
return handleEscapeCharacters(finaltext, false)
}
return retriever
} }
} }

View File

@ -1,7 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-chart-bar" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>
<path d="M3 12m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v6a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z" />
<path d="M9 8m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v10a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z" />
<path d="M15 4m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v14a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z" />
<path d="M4 20l14 0" />
</svg>

Before

Width:  |  Height:  |  Size: 600 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-math-x-divide-y-2" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M3 21l18 -18" /><path d="M15 14l3 4.5" /><path d="M21 14l-4.5 7" /><path d="M3 4l6 6" /><path d="M3 10l6 -6" /></svg>

After

Width:  |  Height:  |  Size: 413 B

View File

@ -18,7 +18,7 @@ class SimilarityThresholdRetriever_Retrievers implements INode {
constructor() { constructor() {
this.label = 'Similarity Score Threshold Retriever' this.label = 'Similarity Score Threshold Retriever'
this.name = 'similarityThresholdRetriever' this.name = 'similarityThresholdRetriever'
this.version = 1.0 this.version = 2.0
this.type = 'SimilarityThresholdRetriever' this.type = 'SimilarityThresholdRetriever'
this.icon = 'similaritythreshold.svg' this.icon = 'similaritythreshold.svg'
this.category = 'Retrievers' this.category = 'Retrievers'
@ -30,6 +30,14 @@ class SimilarityThresholdRetriever_Retrievers implements INode {
name: 'vectorStore', name: 'vectorStore',
type: 'VectorStore' type: 'VectorStore'
}, },
{
label: 'Query',
name: 'query',
type: 'string',
description: 'Query to retrieve documents from retriever. If not specified, user question will be used',
optional: true,
acceptVariable: true
},
{ {
label: 'Minimum Similarity Score (%)', label: 'Minimum Similarity Score (%)',
name: 'minSimilarityScore', name: 'minSimilarityScore',
@ -44,7 +52,8 @@ class SimilarityThresholdRetriever_Retrievers implements INode {
description: `The maximum number of results to fetch`, description: `The maximum number of results to fetch`,
type: 'number', type: 'number',
default: 20, default: 20,
step: 1 step: 1,
additionalParams: true
}, },
{ {
label: 'K Increment', label: 'K Increment',
@ -52,7 +61,8 @@ class SimilarityThresholdRetriever_Retrievers implements INode {
description: `How much to increase K by each time. It'll fetch N results, then N + kIncrement, then N + kIncrement * 2, etc.`, description: `How much to increase K by each time. It'll fetch N results, then N + kIncrement, then N + kIncrement * 2, etc.`,
type: 'number', type: 'number',
default: 2, default: 2,
step: 1 step: 1,
additionalParams: true
} }
] ]
this.outputs = [ this.outputs = [
@ -77,6 +87,7 @@ class SimilarityThresholdRetriever_Retrievers implements INode {
async init(nodeData: INodeData, input: string): Promise<any> { async init(nodeData: INodeData, input: string): Promise<any> {
const vectorStore = nodeData.inputs?.vectorStore as VectorStore const vectorStore = nodeData.inputs?.vectorStore as VectorStore
const minSimilarityScore = nodeData.inputs?.minSimilarityScore as number const minSimilarityScore = nodeData.inputs?.minSimilarityScore as number
const query = nodeData.inputs?.query as string
const maxK = nodeData.inputs?.maxK as string const maxK = nodeData.inputs?.maxK as string
const kIncrement = nodeData.inputs?.kIncrement as string const kIncrement = nodeData.inputs?.kIncrement as string
@ -89,11 +100,11 @@ class SimilarityThresholdRetriever_Retrievers implements INode {
}) })
if (output === 'retriever') return retriever if (output === 'retriever') return retriever
else if (output === 'document') return await retriever.getRelevantDocuments(input) else if (output === 'document') return await retriever.getRelevantDocuments(query ? query : input)
else if (output === 'text') { else if (output === 'text') {
let finaltext = '' let finaltext = ''
const docs = await retriever.getRelevantDocuments(input) const docs = await retriever.getRelevantDocuments(query ? query : input)
for (const doc of docs) finaltext += `${doc.pageContent}\n` for (const doc of docs) finaltext += `${doc.pageContent}\n`

View File

@ -73,7 +73,11 @@ class CustomFunction_Utilities implements INode {
if (Object.keys(inputVars).length) { if (Object.keys(inputVars).length) {
for (const item in inputVars) { for (const item in inputVars) {
sandbox[`$${item}`] = inputVars[item] let value = inputVars[item]
if (typeof value === 'string') {
value = handleEscapeCharacters(value, true)
}
sandbox[`$${item}`] = value
} }
} }

View File

@ -4,6 +4,7 @@ import { Document } from 'langchain/document'
import { ICommonObject, INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface' import { ICommonObject, INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface'
import { getBaseClasses, getCredentialData } from '../../../src/utils' import { getBaseClasses, getCredentialData } from '../../../src/utils'
import { AstraDBVectorStore, AstraLibArgs } from '@langchain/community/vectorstores/astradb' import { AstraDBVectorStore, AstraLibArgs } from '@langchain/community/vectorstores/astradb'
import { addMMRInputParams, resolveVectorStoreOrRetriever } from '../VectorStoreUtils'
class Astra_VectorStores implements INode { class Astra_VectorStores implements INode {
label: string label: string
@ -26,7 +27,7 @@ class Astra_VectorStores implements INode {
this.type = 'Astra' this.type = 'Astra'
this.icon = 'astra.svg' this.icon = 'astra.svg'
this.category = 'Vector Stores' this.category = 'Vector Stores'
this.description = `Upsert embedded data and perform similarity search upon query using DataStax Astra DB, a serverless vector database thats perfect for managing mission-critical AI workloads` this.description = `Upsert embedded data and perform similarity or mmr search upon query using DataStax Astra DB, a serverless vector database thats perfect for managing mission-critical AI workloads`
this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever'] this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever']
this.badge = 'NEW' this.badge = 'NEW'
this.credential = { this.credential = {
@ -74,6 +75,7 @@ class Astra_VectorStores implements INode {
optional: true optional: true
} }
] ]
addMMRInputParams(this.inputs)
this.outputs = [ this.outputs = [
{ {
label: 'Astra Retriever', label: 'Astra Retriever',
@ -139,9 +141,6 @@ class Astra_VectorStores implements INode {
const embeddings = nodeData.inputs?.embeddings as Embeddings const embeddings = nodeData.inputs?.embeddings as Embeddings
const vectorDimension = nodeData.inputs?.vectorDimension as number const vectorDimension = nodeData.inputs?.vectorDimension as number
const similarityMetric = nodeData.inputs?.similarityMetric as 'cosine' | 'euclidean' | 'dot_product' | undefined const similarityMetric = nodeData.inputs?.similarityMetric as 'cosine' | 'euclidean' | 'dot_product' | undefined
const output = nodeData.outputs?.output as string
const topK = nodeData.inputs?.topK as string
const k = topK ? parseFloat(topK) : 4
const credentialData = await getCredentialData(nodeData.credential ?? '', options) const credentialData = await getCredentialData(nodeData.credential ?? '', options)
@ -176,14 +175,7 @@ class Astra_VectorStores implements INode {
const vectorStore = await AstraDBVectorStore.fromExistingIndex(embeddings, astraConfig) const vectorStore = await AstraDBVectorStore.fromExistingIndex(embeddings, astraConfig)
if (output === 'retriever') { return resolveVectorStoreOrRetriever(nodeData, vectorStore)
const retriever = vectorStore.asRetriever(k)
return retriever
} else if (output === 'vectorStore') {
;(vectorStore as any).k = k
return vectorStore
}
return vectorStore
} }
} }

View File

@ -5,6 +5,7 @@ import { Embeddings } from 'langchain/embeddings/base'
import { Document } from 'langchain/document' import { Document } from 'langchain/document'
import { ICommonObject, INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface' import { ICommonObject, INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface'
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils' import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
import { addMMRInputParams, resolveVectorStoreOrRetriever } from '../VectorStoreUtils'
class MongoDBAtlas_VectorStores implements INode { class MongoDBAtlas_VectorStores implements INode {
label: string label: string
@ -24,7 +25,7 @@ class MongoDBAtlas_VectorStores implements INode {
this.label = 'MongoDB Atlas' this.label = 'MongoDB Atlas'
this.name = 'mongoDBAtlas' this.name = 'mongoDBAtlas'
this.version = 1.0 this.version = 1.0
this.description = `Upsert embedded data and perform similarity search upon query using MongoDB Atlas, a managed cloud mongodb database` this.description = `Upsert embedded data and perform similarity or mmr search upon query using MongoDB Atlas, a managed cloud mongodb database`
this.type = 'MongoDB Atlas' this.type = 'MongoDB Atlas'
this.icon = 'mongodb.svg' this.icon = 'mongodb.svg'
this.category = 'Vector Stores' this.category = 'Vector Stores'
@ -95,6 +96,7 @@ class MongoDBAtlas_VectorStores implements INode {
optional: true optional: true
} }
] ]
addMMRInputParams(this.inputs)
this.outputs = [ this.outputs = [
{ {
label: 'MongoDB Retriever', label: 'MongoDB Retriever',
@ -162,9 +164,6 @@ class MongoDBAtlas_VectorStores implements INode {
let textKey = nodeData.inputs?.textKey as string let textKey = nodeData.inputs?.textKey as string
let embeddingKey = nodeData.inputs?.embeddingKey as string let embeddingKey = nodeData.inputs?.embeddingKey as string
const embeddings = nodeData.inputs?.embeddings as Embeddings const embeddings = nodeData.inputs?.embeddings as Embeddings
const topK = nodeData.inputs?.topK as string
const k = topK ? parseFloat(topK) : 4
const output = nodeData.outputs?.output as string
let mongoDBConnectUrl = getCredentialParam('mongoDBConnectUrl', credentialData, nodeData) let mongoDBConnectUrl = getCredentialParam('mongoDBConnectUrl', credentialData, nodeData)
@ -181,13 +180,7 @@ class MongoDBAtlas_VectorStores implements INode {
embeddingKey embeddingKey
}) })
if (output === 'retriever') { return resolveVectorStoreOrRetriever(nodeData, vectorStore)
return vectorStore.asRetriever(k)
} else if (output === 'vectorStore') {
;(vectorStore as any).k = k
return vectorStore
}
return vectorStore
} }
} }

View File

@ -24,7 +24,7 @@ class Pinecone_VectorStores implements INode {
constructor() { constructor() {
this.label = 'Pinecone' this.label = 'Pinecone'
this.name = 'pinecone' this.name = 'pinecone'
this.version = 3.0 this.version = 2.0
this.type = 'Pinecone' this.type = 'Pinecone'
this.icon = 'pinecone.svg' this.icon = 'pinecone.svg'
this.category = 'Vector Stores' this.category = 'Vector Stores'

View File

@ -1,6 +1,6 @@
{ {
"name": "flowise-components", "name": "flowise-components",
"version": "1.5.0", "version": "1.5.1",
"description": "Flowiseai Components", "description": "Flowiseai Components",
"main": "dist/src/index", "main": "dist/src/index",
"types": "dist/src/index.d.ts", "types": "dist/src/index.d.ts",
@ -26,6 +26,7 @@
"@gomomento/sdk": "^1.51.1", "@gomomento/sdk": "^1.51.1",
"@gomomento/sdk-core": "^1.51.1", "@gomomento/sdk-core": "^1.51.1",
"@google-ai/generativelanguage": "^0.2.1", "@google-ai/generativelanguage": "^0.2.1",
"@google/generative-ai": "^0.1.3",
"@huggingface/inference": "^2.6.1", "@huggingface/inference": "^2.6.1",
"@langchain/community": "^0.0.16", "@langchain/community": "^0.0.16",
"@langchain/google-genai": "^0.0.6", "@langchain/google-genai": "^0.0.6",
@ -37,7 +38,7 @@
"@supabase/supabase-js": "^2.29.0", "@supabase/supabase-js": "^2.29.0",
"@types/js-yaml": "^4.0.5", "@types/js-yaml": "^4.0.5",
"@types/jsdom": "^21.1.1", "@types/jsdom": "^21.1.1",
"@upstash/redis": "^1.22.1", "@upstash/redis": "1.22.1",
"@zilliz/milvus2-sdk-node": "^2.2.24", "@zilliz/milvus2-sdk-node": "^2.2.24",
"apify-client": "^2.7.1", "apify-client": "^2.7.1",
"axios": "1.6.2", "axios": "1.6.2",

View File

@ -673,3 +673,18 @@ export const convertBaseMessagetoIMessage = (messages: BaseMessage[]): IMessage[
} }
return formatmessages return formatmessages
} }
/**
* Convert MultiOptions String to String Array
* @param {string} inputString
* @returns {string[]}
*/
export const convertMultiOptionsToStringArray = (inputString: string): string[] => {
let ArrayString: string[] = []
try {
ArrayString = JSON.parse(inputString)
} catch (e) {
ArrayString = []
}
return ArrayString
}

View File

@ -511,7 +511,7 @@
"type": "Pinecone", "type": "Pinecone",
"baseClasses": ["Pinecone", "VectorStoreRetriever", "BaseRetriever"], "baseClasses": ["Pinecone", "VectorStoreRetriever", "BaseRetriever"],
"category": "Vector Stores", "category": "Vector Stores",
"description": "Upsert embedded data and perform similarity search upon query using Pinecone, a leading fully managed hosted vector database", "description": "Upsert embedded data and perform similarity or mmr search using Pinecone, a leading fully managed hosted vector database",
"inputParams": [ "inputParams": [
{ {
"label": "Connect Credential", "label": "Connect Credential",
@ -552,6 +552,45 @@
"additionalParams": true, "additionalParams": true,
"optional": true, "optional": true,
"id": "pinecone_0-input-topK-number" "id": "pinecone_0-input-topK-number"
},
{
"label": "Search Type",
"name": "searchType",
"type": "options",
"default": "similarity",
"options": [
{
"label": "Similarity",
"name": "similarity"
},
{
"label": "Max Marginal Relevance",
"name": "mmr"
}
],
"additionalParams": true,
"optional": true,
"id": "pinecone_0-input-searchType-options"
},
{
"label": "Fetch K (for MMR Search)",
"name": "fetchK",
"description": "Number of initial documents to fetch for MMR reranking. Default to 20. Used only when the search type is MMR",
"placeholder": "20",
"type": "number",
"additionalParams": true,
"optional": true,
"id": "pinecone_0-input-fetchK-number"
},
{
"label": "Lambda (for MMR Search)",
"name": "lambda",
"description": "Number between 0 and 1 that determines the degree of diversity among the results, where 0 corresponds to maximum diversity and 1 to minimum diversity. Used only when the search type is MMR",
"placeholder": "0.5",
"type": "number",
"additionalParams": true,
"optional": true,
"id": "pinecone_0-input-lambda-number"
} }
], ],
"inputAnchors": [ "inputAnchors": [
@ -576,7 +615,10 @@
"pineconeIndex": "", "pineconeIndex": "",
"pineconeNamespace": "", "pineconeNamespace": "",
"pineconeMetadataFilter": "", "pineconeMetadataFilter": "",
"topK": "" "topK": "",
"searchType": "similarity",
"fetchK": "",
"lambda": ""
}, },
"outputAnchors": [ "outputAnchors": [
{ {

View File

@ -166,7 +166,7 @@
"type": "Pinecone", "type": "Pinecone",
"baseClasses": ["Pinecone", "VectorStoreRetriever", "BaseRetriever"], "baseClasses": ["Pinecone", "VectorStoreRetriever", "BaseRetriever"],
"category": "Vector Stores", "category": "Vector Stores",
"description": "Upsert embedded data and perform similarity search upon query using Pinecone, a leading fully managed hosted vector database", "description": "Upsert embedded data and perform similarity or mmr search using Pinecone, a leading fully managed hosted vector database",
"inputParams": [ "inputParams": [
{ {
"label": "Connect Credential", "label": "Connect Credential",
@ -207,6 +207,45 @@
"additionalParams": true, "additionalParams": true,
"optional": true, "optional": true,
"id": "pinecone_0-input-topK-number" "id": "pinecone_0-input-topK-number"
},
{
"label": "Search Type",
"name": "searchType",
"type": "options",
"default": "similarity",
"options": [
{
"label": "Similarity",
"name": "similarity"
},
{
"label": "Max Marginal Relevance",
"name": "mmr"
}
],
"additionalParams": true,
"optional": true,
"id": "pinecone_0-input-searchType-options"
},
{
"label": "Fetch K (for MMR Search)",
"name": "fetchK",
"description": "Number of initial documents to fetch for MMR reranking. Default to 20. Used only when the search type is MMR",
"placeholder": "20",
"type": "number",
"additionalParams": true,
"optional": true,
"id": "pinecone_0-input-fetchK-number"
},
{
"label": "Lambda (for MMR Search)",
"name": "lambda",
"description": "Number between 0 and 1 that determines the degree of diversity among the results, where 0 corresponds to maximum diversity and 1 to minimum diversity. Used only when the search type is MMR",
"placeholder": "0.5",
"type": "number",
"additionalParams": true,
"optional": true,
"id": "pinecone_0-input-lambda-number"
} }
], ],
"inputAnchors": [ "inputAnchors": [
@ -231,7 +270,10 @@
"pineconeIndex": "", "pineconeIndex": "",
"pineconeNamespace": "", "pineconeNamespace": "",
"pineconeMetadataFilter": "", "pineconeMetadataFilter": "",
"topK": "" "topK": "",
"searchType": "similarity",
"fetchK": "",
"lambda": ""
}, },
"outputAnchors": [ "outputAnchors": [
{ {

View File

@ -301,7 +301,7 @@
"type": "Pinecone", "type": "Pinecone",
"baseClasses": ["Pinecone", "VectorStoreRetriever", "BaseRetriever"], "baseClasses": ["Pinecone", "VectorStoreRetriever", "BaseRetriever"],
"category": "Vector Stores", "category": "Vector Stores",
"description": "Upsert embedded data and perform similarity search upon query using Pinecone, a leading fully managed hosted vector database", "description": "Upsert embedded data and perform similarity or mmr search using Pinecone, a leading fully managed hosted vector database",
"inputParams": [ "inputParams": [
{ {
"label": "Connect Credential", "label": "Connect Credential",
@ -342,6 +342,45 @@
"additionalParams": true, "additionalParams": true,
"optional": true, "optional": true,
"id": "pinecone_0-input-topK-number" "id": "pinecone_0-input-topK-number"
},
{
"label": "Search Type",
"name": "searchType",
"type": "options",
"default": "similarity",
"options": [
{
"label": "Similarity",
"name": "similarity"
},
{
"label": "Max Marginal Relevance",
"name": "mmr"
}
],
"additionalParams": true,
"optional": true,
"id": "pinecone_0-input-searchType-options"
},
{
"label": "Fetch K (for MMR Search)",
"name": "fetchK",
"description": "Number of initial documents to fetch for MMR reranking. Default to 20. Used only when the search type is MMR",
"placeholder": "20",
"type": "number",
"additionalParams": true,
"optional": true,
"id": "pinecone_0-input-fetchK-number"
},
{
"label": "Lambda (for MMR Search)",
"name": "lambda",
"description": "Number between 0 and 1 that determines the degree of diversity among the results, where 0 corresponds to maximum diversity and 1 to minimum diversity. Used only when the search type is MMR",
"placeholder": "0.5",
"type": "number",
"additionalParams": true,
"optional": true,
"id": "pinecone_0-input-lambda-number"
} }
], ],
"inputAnchors": [ "inputAnchors": [
@ -366,7 +405,10 @@
"pineconeIndex": "", "pineconeIndex": "",
"pineconeNamespace": "", "pineconeNamespace": "",
"pineconeMetadataFilter": "", "pineconeMetadataFilter": "",
"topK": "" "topK": "",
"searchType": "similarity",
"fetchK": "",
"lambda": ""
}, },
"outputAnchors": [ "outputAnchors": [
{ {

View File

@ -541,7 +541,7 @@
"type": "Pinecone", "type": "Pinecone",
"baseClasses": ["Pinecone", "VectorStoreRetriever", "BaseRetriever"], "baseClasses": ["Pinecone", "VectorStoreRetriever", "BaseRetriever"],
"category": "Vector Stores", "category": "Vector Stores",
"description": "Upsert embedded data and perform similarity search upon query using Pinecone, a leading fully managed hosted vector database", "description": "Upsert embedded data and perform similarity or mmr search using Pinecone, a leading fully managed hosted vector database",
"inputParams": [ "inputParams": [
{ {
"label": "Connect Credential", "label": "Connect Credential",
@ -582,6 +582,45 @@
"additionalParams": true, "additionalParams": true,
"optional": true, "optional": true,
"id": "pinecone_0-input-topK-number" "id": "pinecone_0-input-topK-number"
},
{
"label": "Search Type",
"name": "searchType",
"type": "options",
"default": "similarity",
"options": [
{
"label": "Similarity",
"name": "similarity"
},
{
"label": "Max Marginal Relevance",
"name": "mmr"
}
],
"additionalParams": true,
"optional": true,
"id": "pinecone_0-input-searchType-options"
},
{
"label": "Fetch K (for MMR Search)",
"name": "fetchK",
"description": "Number of initial documents to fetch for MMR reranking. Default to 20. Used only when the search type is MMR",
"placeholder": "20",
"type": "number",
"additionalParams": true,
"optional": true,
"id": "pinecone_0-input-fetchK-number"
},
{
"label": "Lambda (for MMR Search)",
"name": "lambda",
"description": "Number between 0 and 1 that determines the degree of diversity among the results, where 0 corresponds to maximum diversity and 1 to minimum diversity. Used only when the search type is MMR",
"placeholder": "0.5",
"type": "number",
"additionalParams": true,
"optional": true,
"id": "pinecone_0-input-lambda-number"
} }
], ],
"inputAnchors": [ "inputAnchors": [
@ -606,7 +645,10 @@
"pineconeIndex": "", "pineconeIndex": "",
"pineconeNamespace": "", "pineconeNamespace": "",
"pineconeMetadataFilter": "", "pineconeMetadataFilter": "",
"topK": "" "topK": "",
"searchType": "similarity",
"fetchK": "",
"lambda": ""
}, },
"outputAnchors": [ "outputAnchors": [
{ {

View File

@ -625,7 +625,7 @@
"type": "Pinecone", "type": "Pinecone",
"baseClasses": ["Pinecone", "VectorStoreRetriever", "BaseRetriever"], "baseClasses": ["Pinecone", "VectorStoreRetriever", "BaseRetriever"],
"category": "Vector Stores", "category": "Vector Stores",
"description": "Upsert embedded data and perform similarity search upon query using Pinecone, a leading fully managed hosted vector database", "description": "Upsert embedded data and perform similarity or mmr search using Pinecone, a leading fully managed hosted vector database",
"inputParams": [ "inputParams": [
{ {
"label": "Connect Credential", "label": "Connect Credential",
@ -666,6 +666,45 @@
"additionalParams": true, "additionalParams": true,
"optional": true, "optional": true,
"id": "pinecone_0-input-topK-number" "id": "pinecone_0-input-topK-number"
},
{
"label": "Search Type",
"name": "searchType",
"type": "options",
"default": "similarity",
"options": [
{
"label": "Similarity",
"name": "similarity"
},
{
"label": "Max Marginal Relevance",
"name": "mmr"
}
],
"additionalParams": true,
"optional": true,
"id": "pinecone_0-input-searchType-options"
},
{
"label": "Fetch K (for MMR Search)",
"name": "fetchK",
"description": "Number of initial documents to fetch for MMR reranking. Default to 20. Used only when the search type is MMR",
"placeholder": "20",
"type": "number",
"additionalParams": true,
"optional": true,
"id": "pinecone_0-input-fetchK-number"
},
{
"label": "Lambda (for MMR Search)",
"name": "lambda",
"description": "Number between 0 and 1 that determines the degree of diversity among the results, where 0 corresponds to maximum diversity and 1 to minimum diversity. Used only when the search type is MMR",
"placeholder": "0.5",
"type": "number",
"additionalParams": true,
"optional": true,
"id": "pinecone_0-input-lambda-number"
} }
], ],
"inputAnchors": [ "inputAnchors": [
@ -690,7 +729,10 @@
"pineconeIndex": "", "pineconeIndex": "",
"pineconeNamespace": "", "pineconeNamespace": "",
"pineconeMetadataFilter": "{\"id\":{\"$in\":[\"doc1\",\"doc2\"]}}", "pineconeMetadataFilter": "{\"id\":{\"$in\":[\"doc1\",\"doc2\"]}}",
"topK": "" "topK": "",
"searchType": "similarity",
"fetchK": "",
"lambda": ""
}, },
"outputAnchors": [ "outputAnchors": [
{ {

View File

@ -560,7 +560,7 @@
"type": "Pinecone", "type": "Pinecone",
"baseClasses": ["Pinecone", "VectorStoreRetriever", "BaseRetriever"], "baseClasses": ["Pinecone", "VectorStoreRetriever", "BaseRetriever"],
"category": "Vector Stores", "category": "Vector Stores",
"description": "Upsert embedded data and perform similarity search upon query using Pinecone, a leading fully managed hosted vector database", "description": "Upsert embedded data and perform similarity or mmr search using Pinecone, a leading fully managed hosted vector database",
"inputParams": [ "inputParams": [
{ {
"label": "Connect Credential", "label": "Connect Credential",
@ -601,6 +601,45 @@
"additionalParams": true, "additionalParams": true,
"optional": true, "optional": true,
"id": "pinecone_0-input-topK-number" "id": "pinecone_0-input-topK-number"
},
{
"label": "Search Type",
"name": "searchType",
"type": "options",
"default": "similarity",
"options": [
{
"label": "Similarity",
"name": "similarity"
},
{
"label": "Max Marginal Relevance",
"name": "mmr"
}
],
"additionalParams": true,
"optional": true,
"id": "pinecone_0-input-searchType-options"
},
{
"label": "Fetch K (for MMR Search)",
"name": "fetchK",
"description": "Number of initial documents to fetch for MMR reranking. Default to 20. Used only when the search type is MMR",
"placeholder": "20",
"type": "number",
"additionalParams": true,
"optional": true,
"id": "pinecone_0-input-fetchK-number"
},
{
"label": "Lambda (for MMR Search)",
"name": "lambda",
"description": "Number between 0 and 1 that determines the degree of diversity among the results, where 0 corresponds to maximum diversity and 1 to minimum diversity. Used only when the search type is MMR",
"placeholder": "0.5",
"type": "number",
"additionalParams": true,
"optional": true,
"id": "pinecone_0-input-lambda-number"
} }
], ],
"inputAnchors": [ "inputAnchors": [
@ -625,7 +664,10 @@
"pineconeIndex": "", "pineconeIndex": "",
"pineconeNamespace": "", "pineconeNamespace": "",
"pineconeMetadataFilter": "", "pineconeMetadataFilter": "",
"topK": "" "topK": "",
"searchType": "similarity",
"fetchK": "",
"lambda": ""
}, },
"outputAnchors": [ "outputAnchors": [
{ {
@ -840,6 +882,45 @@
"additionalParams": true, "additionalParams": true,
"optional": true, "optional": true,
"id": "supabase_0-input-topK-number" "id": "supabase_0-input-topK-number"
},
{
"label": "Search Type",
"name": "searchType",
"type": "options",
"default": "similarity",
"options": [
{
"label": "Similarity",
"name": "similarity"
},
{
"label": "Max Marginal Relevance",
"name": "mmr"
}
],
"additionalParams": true,
"optional": true,
"id": "pinecone_0-input-searchType-options"
},
{
"label": "Fetch K (for MMR Search)",
"name": "fetchK",
"description": "Number of initial documents to fetch for MMR reranking. Default to 20. Used only when the search type is MMR",
"placeholder": "20",
"type": "number",
"additionalParams": true,
"optional": true,
"id": "pinecone_0-input-fetchK-number"
},
{
"label": "Lambda (for MMR Search)",
"name": "lambda",
"description": "Number between 0 and 1 that determines the degree of diversity among the results, where 0 corresponds to maximum diversity and 1 to minimum diversity. Used only when the search type is MMR",
"placeholder": "0.5",
"type": "number",
"additionalParams": true,
"optional": true,
"id": "pinecone_0-input-lambda-number"
} }
], ],
"inputAnchors": [ "inputAnchors": [
@ -865,7 +946,10 @@
"tableName": "", "tableName": "",
"queryName": "", "queryName": "",
"supabaseMetadataFilter": "", "supabaseMetadataFilter": "",
"topK": "" "topK": "",
"searchType": "similarity",
"fetchK": "",
"lambda": ""
}, },
"outputAnchors": [ "outputAnchors": [
{ {

View File

@ -643,7 +643,7 @@
"type": "Pinecone", "type": "Pinecone",
"baseClasses": ["Pinecone", "VectorStoreRetriever", "BaseRetriever"], "baseClasses": ["Pinecone", "VectorStoreRetriever", "BaseRetriever"],
"category": "Vector Stores", "category": "Vector Stores",
"description": "Upsert embedded data and perform similarity search upon query using Pinecone, a leading fully managed hosted vector database", "description": "Upsert embedded data and perform similarity or mmr search using Pinecone, a leading fully managed hosted vector database",
"inputParams": [ "inputParams": [
{ {
"label": "Connect Credential", "label": "Connect Credential",
@ -684,6 +684,45 @@
"additionalParams": true, "additionalParams": true,
"optional": true, "optional": true,
"id": "pinecone_0-input-topK-number" "id": "pinecone_0-input-topK-number"
},
{
"label": "Search Type",
"name": "searchType",
"type": "options",
"default": "similarity",
"options": [
{
"label": "Similarity",
"name": "similarity"
},
{
"label": "Max Marginal Relevance",
"name": "mmr"
}
],
"additionalParams": true,
"optional": true,
"id": "pinecone_0-input-searchType-options"
},
{
"label": "Fetch K (for MMR Search)",
"name": "fetchK",
"description": "Number of initial documents to fetch for MMR reranking. Default to 20. Used only when the search type is MMR",
"placeholder": "20",
"type": "number",
"additionalParams": true,
"optional": true,
"id": "pinecone_0-input-fetchK-number"
},
{
"label": "Lambda (for MMR Search)",
"name": "lambda",
"description": "Number between 0 and 1 that determines the degree of diversity among the results, where 0 corresponds to maximum diversity and 1 to minimum diversity. Used only when the search type is MMR",
"placeholder": "0.5",
"type": "number",
"additionalParams": true,
"optional": true,
"id": "pinecone_0-input-lambda-number"
} }
], ],
"inputAnchors": [ "inputAnchors": [
@ -708,7 +747,10 @@
"pineconeIndex": "", "pineconeIndex": "",
"pineconeNamespace": "", "pineconeNamespace": "",
"pineconeMetadataFilter": "", "pineconeMetadataFilter": "",
"topK": "" "topK": "",
"searchType": "similarity",
"fetchK": "",
"lambda": ""
}, },
"outputAnchors": [ "outputAnchors": [
{ {

View File

@ -1,6 +1,6 @@
{ {
"name": "flowise", "name": "flowise",
"version": "1.4.9", "version": "1.4.10",
"description": "Flowiseai Server", "description": "Flowiseai Server",
"main": "dist/index", "main": "dist/index",
"types": "dist/index.d.ts", "types": "dist/index.d.ts",

View File

@ -1,6 +1,6 @@
{ {
"name": "flowise-ui", "name": "flowise-ui",
"version": "1.4.6", "version": "1.4.7",
"license": "SEE LICENSE IN LICENSE.md", "license": "SEE LICENSE IN LICENSE.md",
"homepage": "https://flowiseai.com", "homepage": "https://flowiseai.com",
"author": { "author": {