TalatMasood commited on
Commit
7e85abb
·
1 Parent(s): d3c044c

Updating path for chroma_db

Browse files
src/vectorstores/chroma_vectorstore.py CHANGED
@@ -1,4 +1,5 @@
1
  # src/vectorstores/chroma_vectorstore.py
 
2
  import chromadb
3
  from typing import List, Callable, Any, Dict, Optional
4
  from chromadb.config import Settings
@@ -25,10 +26,14 @@ class ChromaVectorStore(BaseVectorStore):
25
  client_settings (Optional[Dict[str, Any]]): Additional settings for ChromaDB client
26
  """
27
  try:
 
 
 
28
  settings = Settings(
29
  persist_directory=persist_directory,
30
  **(client_settings or {})
31
  )
 
32
  self.client = chromadb.PersistentClient(settings=settings)
33
  self.collection = self.client.get_or_create_collection(
34
  name=collection_name,
 
1
  # src/vectorstores/chroma_vectorstore.py
2
+ import os
3
  import chromadb
4
  from typing import List, Callable, Any, Dict, Optional
5
  from chromadb.config import Settings
 
26
  client_settings (Optional[Dict[str, Any]]): Additional settings for ChromaDB client
27
  """
28
  try:
29
+ persist_directory = os.path.abspath(persist_directory)
30
+ os.makedirs(self._persist_directory, exist_ok=True)
31
+
32
  settings = Settings(
33
  persist_directory=persist_directory,
34
  **(client_settings or {})
35
  )
36
+
37
  self.client = chromadb.PersistentClient(settings=settings)
38
  self.collection = self.client.get_or_create_collection(
39
  name=collection_name,