From 6484e29132987a3521d1e697bbc4cc43e3146cdd Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 20 Sep 2023 01:22:56 +0100 Subject: [PATCH] chroma installation fix --- packages/components/nodes/vectorstores/Chroma/core.ts | 7 ++++--- packages/components/package.json | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/components/nodes/vectorstores/Chroma/core.ts b/packages/components/nodes/vectorstores/Chroma/core.ts index ccdbe03c..8277c58e 100644 --- a/packages/components/nodes/vectorstores/Chroma/core.ts +++ b/packages/components/nodes/vectorstores/Chroma/core.ts @@ -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 { 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}`) diff --git a/packages/components/package.json b/packages/components/package.json index a69b8f26..373584b0 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -32,7 +32,7 @@ "apify-client": "^2.7.1", "axios": "^0.27.2", "cheerio": "^1.0.0-rc.12", - "chromadb": "^1.5.3", + "chromadb": "^1.5.11", "cohere-ai": "^6.2.0", "d3-dsv": "2", "dotenv": "^16.0.0",