mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 21:00:58 +03:00
chroma installation fix
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { Chroma, ChromaLibArgs } from 'langchain/vectorstores/chroma'
|
||||
import { Embeddings } from 'langchain/embeddings/base'
|
||||
import type { Collection } from 'chromadb'
|
||||
import { ChromaClient } from 'chromadb'
|
||||
|
||||
interface ChromaAuth {
|
||||
chromaApiKey?: string
|
||||
@@ -23,7 +24,6 @@ export class ChromaExtended extends Chroma {
|
||||
async ensureCollection(): Promise<Collection> {
|
||||
if (!this.collection) {
|
||||
if (!this.index) {
|
||||
const { ChromaClient } = await Chroma.imports()
|
||||
const obj: any = {
|
||||
path: this.url
|
||||
}
|
||||
@@ -37,8 +37,9 @@ export class ChromaExtended extends Chroma {
|
||||
this.index = new ChromaClient(obj)
|
||||
}
|
||||
try {
|
||||
this.collection = await this.index.getOrCreateCollection({
|
||||
name: this.collectionName
|
||||
this.collection = await this.index!.getOrCreateCollection({
|
||||
name: this.collectionName,
|
||||
...(this.collectionMetadata && { metadata: this.collectionMetadata })
|
||||
})
|
||||
} catch (err) {
|
||||
throw new Error(`Chroma getOrCreateCollection error: ${err}`)
|
||||
|
||||
Reference in New Issue
Block a user