update: chroma v0.4.0 (#330)

This commit is contained in:
Candido Sales Gomes
2023-07-20 17:17:53 -04:00
committed by GitHub
parent cdbf75e0ec
commit d590e4423b
3 changed files with 10 additions and 17 deletions

View File

@@ -1,6 +1,7 @@
import logging
import chromadb
from chromadb.config import Settings
from embedchain.vectordb.base_vector_db import BaseVectorDB
@@ -16,24 +17,16 @@ class ChromaDB(BaseVectorDB):
if host and port:
logging.info(f"Connecting to ChromaDB server: {host}:{port}")
self.client_settings = chromadb.config.Settings(
chroma_api_impl="rest",
chroma_server_host=host,
chroma_server_http_port=port,
)
self.settings = Settings(chroma_server_host=host, chroma_server_http_port=port)
else:
if db_dir is None:
db_dir = "db"
self.client_settings = chromadb.config.Settings(
chroma_db_impl="duckdb+parquet",
persist_directory=db_dir,
anonymized_telemetry=False,
)
self.settings = Settings(persist_directory=db_dir, anonymized_telemetry=False, allow_reset=True)
super().__init__()
def _get_or_create_db(self):
"""Get or create the database."""
return chromadb.Client(self.client_settings)
return chromadb.Client(self.settings)
def _get_or_create_collection(self):
"""Get or create the collection."""