File size: 626 Bytes
fa99d8f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from langchain_community.vectorstores import Chroma
from app.core.config import settings
import chromadb
#import dotenv
#import os

#dotenv.load_dotenv()
#persist_directory = os.getenv('VECTOR_DATABASE_LOCATION')
persist_directory = settings.VECTOR_DATABASE_LOCATION

def initialize_chroma_db() -> Chroma:
    #collection_name = os.getenv('CONVERSATION_COLLECTION_NAME')
    collection_name = settings.CONVERSATION_COLLECTION_NAME

    client = chromadb.PersistentClient(
        path=persist_directory
        )
    
    collection = client.get_or_create_collection(
    name=collection_name,
    )
    
    return collection