MedSpace / scripts /test_qdrant_client.py
kbsss's picture
Upload folder using huggingface_hub
39d9003 verified
Raw
History Blame Contribute Delete
1.04 kB
from qdrant_client import QdrantClient, models
try:
print("Checking QdrantClient methods...")
client = QdrantClient(location=":memory:")
client.create_collection("test", vectors_config=models.VectorParams(size=4, distance=models.Distance.COSINE))
client.upsert("test", points=[
models.PointStruct(id=1, vector=[0.1, 0.1, 0.1, 0.1], payload={"text": "hello"})
])
print("Testing query_points...")
results = client.query_points(
collection_name="test",
query=[0.1, 0.1, 0.1, 0.1],
limit=1
)
print(f"Results type: {type(results)}")
print(f"Results attributes: {dir(results)}")
if hasattr(results, 'points'):
print(f"Points type: {type(results.points)}")
print(f"First point: {results.points[0]}")
print(f"First point payload: {results.points[0].payload}")
if hasattr(client, 'search'):
print("client.search exists")
else:
print("client.search DOES NOT exist")
except Exception as e:
print(f"Error: {e}")