mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 17:01:00 +03:00
Merge pull request #925 from FlowiseAI/feature/Milvus
Feature/Add filter to milvus
This commit is contained in:
@@ -21,7 +21,7 @@ class Milvus_Existing_VectorStores implements INode {
|
|||||||
constructor() {
|
constructor() {
|
||||||
this.label = 'Milvus Load Existing collection'
|
this.label = 'Milvus Load Existing collection'
|
||||||
this.name = 'milvusExistingCollection'
|
this.name = 'milvusExistingCollection'
|
||||||
this.version = 1.0
|
this.version = 2.0
|
||||||
this.type = 'Milvus'
|
this.type = 'Milvus'
|
||||||
this.icon = 'milvus.svg'
|
this.icon = 'milvus.svg'
|
||||||
this.category = 'Vector Stores'
|
this.category = 'Vector Stores'
|
||||||
@@ -50,6 +50,25 @@ class Milvus_Existing_VectorStores implements INode {
|
|||||||
label: 'Milvus Collection Name',
|
label: 'Milvus Collection Name',
|
||||||
name: 'milvusCollection',
|
name: 'milvusCollection',
|
||||||
type: 'string'
|
type: 'string'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Milvus Filter',
|
||||||
|
name: 'milvusFilter',
|
||||||
|
type: 'string',
|
||||||
|
optional: true,
|
||||||
|
description:
|
||||||
|
'Filter data with a simple string query. Refer Milvus <a target="_blank" href="https://milvus.io/blog/2022-08-08-How-to-use-string-data-to-empower-your-similarity-search-applications.md#Hybrid-search">docs</a> for more details.',
|
||||||
|
placeholder: 'doc=="a"',
|
||||||
|
additionalParams: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Top K',
|
||||||
|
name: 'topK',
|
||||||
|
description: 'Number of top results to fetch. Default to 4',
|
||||||
|
placeholder: '4',
|
||||||
|
type: 'number',
|
||||||
|
additionalParams: true,
|
||||||
|
optional: true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
this.outputs = [
|
this.outputs = [
|
||||||
@@ -70,6 +89,7 @@ class Milvus_Existing_VectorStores implements INode {
|
|||||||
// server setup
|
// server setup
|
||||||
const address = nodeData.inputs?.milvusServerUrl as string
|
const address = nodeData.inputs?.milvusServerUrl as string
|
||||||
const collectionName = nodeData.inputs?.milvusCollection as string
|
const collectionName = nodeData.inputs?.milvusCollection as string
|
||||||
|
const milvusFilter = nodeData.inputs?.milvusFilter as string
|
||||||
|
|
||||||
// embeddings
|
// embeddings
|
||||||
const embeddings = nodeData.inputs?.embeddings as Embeddings
|
const embeddings = nodeData.inputs?.embeddings as Embeddings
|
||||||
@@ -109,7 +129,7 @@ class Milvus_Existing_VectorStores implements INode {
|
|||||||
throw new Error(`Collection not found: ${vectorStore.collectionName}, please create collection before search.`)
|
throw new Error(`Collection not found: ${vectorStore.collectionName}, please create collection before search.`)
|
||||||
}
|
}
|
||||||
|
|
||||||
const filterStr = filter ?? ''
|
const filterStr = milvusFilter ?? filter ?? ''
|
||||||
|
|
||||||
await vectorStore.grabCollectionFields()
|
await vectorStore.grabCollectionFields()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user