File size: 990 Bytes
b5deaf1 ad04a72 b5deaf1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
"""Module for the Vector Database."""
from langchain_chroma import Chroma
from models.llm import EmbeddingsModel
vectorstore = Chroma(
embedding_function=EmbeddingsModel("all-MiniLM-L6-v2"),
collection_name="email",
persist_directory="models/chroma/data"
)
# def create_or_get_collection(collection_name: str):
# """
# Creates a new collection or gets an existing collection from the Vector Database.
# Args:
# collection_name (str): The name of the collection.
# Returns:
# chromadb.Collection: The collection associated with the provided name.
# """
# chroma_client = chromadb.PersistentClient(path="models/chroma/data")
# collection = chroma_client.get_or_create_collection(collection_name)
# # try:
# # collection = chroma_client.create_collection(collection_name)
# # except chromadb.errors.UniqueConstraintError:
# # collection = chroma_client.get_collection(collection_name)
# return collection
|