Files
GorichBot/rag_api/app/vector_store.py
T
2026-05-12 23:37:04 +03:00

24 lines
766 B
Python

from __future__ import annotations
from chromadb import PersistentClient
from chromadb.api.models.Collection import Collection
from chromadb.config import Settings as ChromaSettings
from .config import settings
class VectorStore:
def __init__(self) -> None:
chroma_settings = ChromaSettings(
anonymized_telemetry=False,
chroma_product_telemetry_impl="app.noop_telemetry.NoOpProductTelemetry",
chroma_telemetry_impl="app.noop_telemetry.NoOpProductTelemetry",
)
self.client = PersistentClient(
path=settings.chroma_path,
settings=chroma_settings,
)
def get_collection(self, name: str) -> Collection:
return self.client.get_or_create_collection(name=name)