ARQ-RAG / shared /vector_store.py
neshaki091
add backendhug
0451cfe
raw
history blame contribute delete
713 Bytes
import os
from qdrant_client import QdrantClient
class VectorStoreManager:
def __init__(self):
url = os.getenv("QDRANT_CLOUD_URL")
api_key = os.getenv("QDRANT_CLOUD_API_KEY")
if not url:
raise Exception("Thiếu QDRANT_CLOUD_URL trong cấu hình Hugging Face!")
self.client = QdrantClient(url=url, api_key=api_key)
self.dimension = 768
def search(self, collection_name, query_vector, limit=10, with_vectors=True):
return self.client.search(
collection_name=collection_name,
query_vector=query_vector,
limit=limit,
with_vectors=with_vectors,
with_payload=True
)