mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 21:00:58 +03:00
Merge pull request #950 from FlowiseAI/bugfix/ChromaInstall
Bugfix/Chroma installation fix
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import { Chroma, ChromaLibArgs } from 'langchain/vectorstores/chroma'
|
import { Chroma, ChromaLibArgs } from 'langchain/vectorstores/chroma'
|
||||||
import { Embeddings } from 'langchain/embeddings/base'
|
import { Embeddings } from 'langchain/embeddings/base'
|
||||||
import type { Collection } from 'chromadb'
|
import type { Collection } from 'chromadb'
|
||||||
|
import { ChromaClient } from 'chromadb'
|
||||||
|
|
||||||
interface ChromaAuth {
|
interface ChromaAuth {
|
||||||
chromaApiKey?: string
|
chromaApiKey?: string
|
||||||
@@ -23,7 +24,6 @@ export class ChromaExtended extends Chroma {
|
|||||||
async ensureCollection(): Promise<Collection> {
|
async ensureCollection(): Promise<Collection> {
|
||||||
if (!this.collection) {
|
if (!this.collection) {
|
||||||
if (!this.index) {
|
if (!this.index) {
|
||||||
const { ChromaClient } = await Chroma.imports()
|
|
||||||
const obj: any = {
|
const obj: any = {
|
||||||
path: this.url
|
path: this.url
|
||||||
}
|
}
|
||||||
@@ -37,8 +37,9 @@ export class ChromaExtended extends Chroma {
|
|||||||
this.index = new ChromaClient(obj)
|
this.index = new ChromaClient(obj)
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
this.collection = await this.index.getOrCreateCollection({
|
this.collection = await this.index!.getOrCreateCollection({
|
||||||
name: this.collectionName
|
name: this.collectionName,
|
||||||
|
...(this.collectionMetadata && { metadata: this.collectionMetadata })
|
||||||
})
|
})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw new Error(`Chroma getOrCreateCollection error: ${err}`)
|
throw new Error(`Chroma getOrCreateCollection error: ${err}`)
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
"apify-client": "^2.7.1",
|
"apify-client": "^2.7.1",
|
||||||
"axios": "^0.27.2",
|
"axios": "^0.27.2",
|
||||||
"cheerio": "^1.0.0-rc.12",
|
"cheerio": "^1.0.0-rc.12",
|
||||||
"chromadb": "^1.5.3",
|
"chromadb": "^1.5.11",
|
||||||
"cohere-ai": "^6.2.0",
|
"cohere-ai": "^6.2.0",
|
||||||
"d3-dsv": "2",
|
"d3-dsv": "2",
|
||||||
"dotenv": "^16.0.0",
|
"dotenv": "^16.0.0",
|
||||||
|
|||||||
Reference in New Issue
Block a user