mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-22 11:01:22 +03:00
@@ -10,11 +10,16 @@ export const resolveVectorStoreOrRetriever = (
|
||||
const searchType = nodeData.outputs?.searchType as string
|
||||
const topK = nodeData.inputs?.topK as string
|
||||
const k = topK ? parseFloat(topK) : 4
|
||||
const alpha = nodeData.inputs?.alpha
|
||||
|
||||
// If it is already pre-defined in lc_kwargs, then don't pass it again
|
||||
const filter = vectorStore?.lc_kwargs?.filter ? undefined : metadataFilter
|
||||
|
||||
if (output === 'retriever') {
|
||||
const searchKwargs: Record<string, any> = {}
|
||||
if (alpha !== undefined) {
|
||||
searchKwargs.alpha = parseFloat(alpha)
|
||||
}
|
||||
if ('mmr' === searchType) {
|
||||
const fetchK = nodeData.inputs?.fetchK as string
|
||||
const lambda = nodeData.inputs?.lambda as string
|
||||
@@ -25,13 +30,18 @@ export const resolveVectorStoreOrRetriever = (
|
||||
k: k,
|
||||
filter,
|
||||
searchKwargs: {
|
||||
//...searchKwargs,
|
||||
fetchK: f,
|
||||
lambda: l
|
||||
}
|
||||
})
|
||||
} else {
|
||||
// "searchType" is "similarity"
|
||||
return vectorStore.asRetriever(k, filter)
|
||||
return vectorStore.asRetriever({
|
||||
k: k,
|
||||
filter: filter,
|
||||
searchKwargs: Object.keys(searchKwargs).length > 0 ? searchKwargs : undefined
|
||||
})
|
||||
}
|
||||
} else if (output === 'vectorStore') {
|
||||
;(vectorStore as any).k = k
|
||||
|
||||
@@ -26,7 +26,7 @@ class Weaviate_VectorStores implements INode {
|
||||
constructor() {
|
||||
this.label = 'Weaviate'
|
||||
this.name = 'weaviate'
|
||||
this.version = 3.0
|
||||
this.version = 4.0
|
||||
this.type = 'Weaviate'
|
||||
this.icon = 'weaviate.png'
|
||||
this.category = 'Vector Stores'
|
||||
@@ -124,6 +124,16 @@ class Weaviate_VectorStores implements INode {
|
||||
}
|
||||
]
|
||||
addMMRInputParams(this.inputs)
|
||||
this.inputs.push({
|
||||
label: 'Alpha (for Hybrid Search)',
|
||||
name: 'alpha',
|
||||
description:
|
||||
'Number between 0 and 1 that determines the weighting of keyword (BM25) portion of the hybrid search. A value of 1 is a pure vector search, while 0 is a pure keyword search.',
|
||||
placeholder: '1',
|
||||
type: 'number',
|
||||
additionalParams: true,
|
||||
optional: true
|
||||
})
|
||||
this.outputs = [
|
||||
{
|
||||
label: 'Weaviate Retriever',
|
||||
|
||||
Reference in New Issue
Block a user