File size: 713 Bytes
2b94dbc | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | 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
)
|