Spaces:
Sleeping
Sleeping
File size: 848 Bytes
7e462a8 | 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_huggingface import HuggingFaceEmbeddings # ✅ Updated import
from langchain_chroma import Chroma # ✅ Updated import
from config import EMBEDDING_MODEL, CHROMA_DB_PATH
def store_embeddings(chunks):
"""Generate embeddings and store them in ChromaDB."""
# Load the embedding model
embeddings = HuggingFaceEmbeddings(model_name=EMBEDDING_MODEL)
# Store the embeddings in ChromaDB
db = Chroma.from_documents(chunks, embeddings, persist_directory=CHROMA_DB_PATH)
print("✅ Embeddings stored successfully in ChromaDB!")
return db
def load_vector_store():
"""Load the stored ChromaDB vector store."""
embeddings = HuggingFaceEmbeddings(model_name=EMBEDDING_MODEL)
db = Chroma(persist_directory=CHROMA_DB_PATH, embedding_function=embeddings)
return db
|