Added documentation (#219)

This commit is contained in:
aaishikdutta
2023-07-11 08:31:42 +05:30
committed by GitHub
parent eda28cc491
commit 6936d6983d
15 changed files with 21 additions and 1 deletions

View File

@@ -1,10 +1,13 @@
class BaseVectorDB:
''' Base class for vector database. '''
def __init__(self):
self.client = self._get_or_create_db()
self.collection = self._get_or_create_collection()
def _get_or_create_db(self):
''' Get or create the database. '''
raise NotImplementedError
def _get_or_create_collection(self):
raise NotImplementedError
raise NotImplementedError

View File

@@ -7,6 +7,8 @@ from embedchain.vectordb.base_vector_db import BaseVectorDB
class ChromaDB(BaseVectorDB):
''' Vector database using ChromaDB. '''
def __init__(self, db_dir=None, ef=None):
if ef:
self.ef = ef
@@ -26,9 +28,11 @@ class ChromaDB(BaseVectorDB):
super().__init__()
def _get_or_create_db(self):
''' Get or create the database. '''
return chromadb.Client(self.client_settings)
def _get_or_create_collection(self):
''' Get or create the collection. '''
return self.client.get_or_create_collection(
'embedchain_store', embedding_function=self.ef,
)