mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 23:01:09 +03:00
Update Chroma_Existing.ts to add metadatafilter
This commit is contained in:
@@ -51,6 +51,13 @@ class Chroma_Existing_VectorStores implements INode {
|
|||||||
type: 'string',
|
type: 'string',
|
||||||
optional: true
|
optional: true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: 'Chroma Metadata Filter',
|
||||||
|
name: 'chromaMetadataFilter',
|
||||||
|
type: 'json',
|
||||||
|
optional: true,
|
||||||
|
additionalParams: true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: 'Top K',
|
label: 'Top K',
|
||||||
name: 'topK',
|
name: 'topK',
|
||||||
@@ -86,13 +93,18 @@ class Chroma_Existing_VectorStores implements INode {
|
|||||||
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
|
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
|
||||||
const chromaApiKey = getCredentialParam('chromaApiKey', credentialData, nodeData)
|
const chromaApiKey = getCredentialParam('chromaApiKey', credentialData, nodeData)
|
||||||
|
|
||||||
|
const chromaMetadataFilter = nodeData.inputs?.chromaMetadataFilter;
|
||||||
|
const metadataFilter = chromaMetadataFilter ? JSON.parse(chromaMetadataFilter) : {};
|
||||||
|
|
||||||
const obj: {
|
const obj: {
|
||||||
collectionName: string
|
collectionName: string
|
||||||
url?: string
|
url?: string
|
||||||
chromaApiKey?: string
|
chromaApiKey?: string
|
||||||
|
metadataFilter?: any
|
||||||
} = { collectionName }
|
} = { collectionName }
|
||||||
if (chromaURL) obj.url = chromaURL
|
if (chromaURL) obj.url = chromaURL
|
||||||
if (chromaApiKey) obj.chromaApiKey = chromaApiKey
|
if (chromaApiKey) obj.chromaApiKey = chromaApiKey
|
||||||
|
if (chromaMetadataFilter) obj.metadataFilter = metadataFilter
|
||||||
|
|
||||||
const vectorStore = await ChromaExtended.fromExistingCollection(embeddings, obj)
|
const vectorStore = await ChromaExtended.fromExistingCollection(embeddings, obj)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user