mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-22 09:01:09 +03:00
Add tenant and database configs for Chroma Cloud credentials (#3872)
* Add tenant and database configs for Chroma Cloud credentials * Lint fix
This commit is contained in:
@@ -16,6 +16,16 @@ class ChromaApi implements INodeCredential {
|
||||
label: 'Chroma Api Key',
|
||||
name: 'chromaApiKey',
|
||||
type: 'password'
|
||||
},
|
||||
{
|
||||
label: 'Chroma Tenant',
|
||||
name: 'chromaTenant',
|
||||
type: 'string'
|
||||
},
|
||||
{
|
||||
label: 'Chroma Database',
|
||||
name: 'chromaDatabase',
|
||||
type: 'string'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -111,6 +111,8 @@ class Chroma_VectorStores implements INode {
|
||||
|
||||
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
|
||||
const chromaApiKey = getCredentialParam('chromaApiKey', credentialData, nodeData)
|
||||
const chromaTenant = getCredentialParam('chromaTenant', credentialData, nodeData)
|
||||
const chromaDatabase = getCredentialParam('chromaDatabase', credentialData, nodeData)
|
||||
|
||||
const flattenDocs = docs && docs.length ? flatten(docs) : []
|
||||
const finalDocs = []
|
||||
@@ -124,9 +126,13 @@ class Chroma_VectorStores implements INode {
|
||||
collectionName: string
|
||||
url?: string
|
||||
chromaApiKey?: string
|
||||
chromaTenant?: string
|
||||
chromaDatabase?: string
|
||||
} = { collectionName }
|
||||
if (chromaURL) obj.url = chromaURL
|
||||
if (chromaApiKey) obj.chromaApiKey = chromaApiKey
|
||||
if (chromaTenant) obj.chromaTenant = chromaTenant
|
||||
if (chromaDatabase) obj.chromaDatabase = chromaDatabase
|
||||
|
||||
try {
|
||||
if (recordManager) {
|
||||
@@ -159,14 +165,20 @@ class Chroma_VectorStores implements INode {
|
||||
|
||||
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
|
||||
const chromaApiKey = getCredentialParam('chromaApiKey', credentialData, nodeData)
|
||||
const chromaTenant = getCredentialParam('chromaTenant', credentialData, nodeData)
|
||||
const chromaDatabase = getCredentialParam('chromaDatabase', credentialData, nodeData)
|
||||
|
||||
const obj: {
|
||||
collectionName: string
|
||||
url?: string
|
||||
chromaApiKey?: string
|
||||
chromaTenant?: string
|
||||
chromaDatabase?: string
|
||||
} = { collectionName }
|
||||
if (chromaURL) obj.url = chromaURL
|
||||
if (chromaApiKey) obj.chromaApiKey = chromaApiKey
|
||||
if (chromaTenant) obj.chromaTenant = chromaTenant
|
||||
if (chromaDatabase) obj.chromaDatabase = chromaDatabase
|
||||
|
||||
try {
|
||||
if (recordManager) {
|
||||
@@ -199,6 +211,8 @@ class Chroma_VectorStores implements INode {
|
||||
|
||||
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
|
||||
const chromaApiKey = getCredentialParam('chromaApiKey', credentialData, nodeData)
|
||||
const chromaTenant = getCredentialParam('chromaTenant', credentialData, nodeData)
|
||||
const chromaDatabase = getCredentialParam('chromaDatabase', credentialData, nodeData)
|
||||
|
||||
const chromaMetadataFilter = nodeData.inputs?.chromaMetadataFilter
|
||||
|
||||
@@ -206,10 +220,14 @@ class Chroma_VectorStores implements INode {
|
||||
collectionName: string
|
||||
url?: string
|
||||
chromaApiKey?: string
|
||||
chromaTenant?: string
|
||||
chromaDatabase?: string
|
||||
filter?: object | undefined
|
||||
} = { collectionName }
|
||||
if (chromaURL) obj.url = chromaURL
|
||||
if (chromaApiKey) obj.chromaApiKey = chromaApiKey
|
||||
if (chromaTenant) obj.chromaTenant = chromaTenant
|
||||
if (chromaDatabase) obj.chromaDatabase = chromaDatabase
|
||||
if (chromaMetadataFilter) {
|
||||
const metadatafilter = typeof chromaMetadataFilter === 'object' ? chromaMetadataFilter : JSON.parse(chromaMetadataFilter)
|
||||
obj.filter = metadatafilter
|
||||
|
||||
@@ -9,6 +9,8 @@ interface ChromaAuth {
|
||||
|
||||
export class ChromaExtended extends Chroma {
|
||||
chromaApiKey?: string
|
||||
chromaTenant?: string
|
||||
chromaDatabase?: string
|
||||
|
||||
constructor(embeddings: Embeddings, args: ChromaLibArgs & Partial<ChromaAuth>) {
|
||||
super(embeddings, args)
|
||||
@@ -34,6 +36,12 @@ export class ChromaExtended extends Chroma {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.chromaTenant) {
|
||||
obj.tenant = this.chromaTenant
|
||||
}
|
||||
if (this.chromaDatabase) {
|
||||
obj.database = this.chromaDatabase
|
||||
}
|
||||
this.index = new ChromaClient(obj)
|
||||
}
|
||||
try {
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
"assemblyai": "^4.2.2",
|
||||
"axios": "1.6.2",
|
||||
"cheerio": "^1.0.0-rc.12",
|
||||
"chromadb": "^1.5.11",
|
||||
"chromadb": "^1.10.0",
|
||||
"cohere-ai": "^7.7.5",
|
||||
"composio-core": "^0.4.7",
|
||||
"couchbase": "4.4.1",
|
||||
|
||||
Generated
+35367
-35403
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user