Developer commited on
Commit
bc4016b
·
1 Parent(s): e0273cc

Fix: Update Qdrant query API for qdrant-client 1.7+

Browse files
Files changed (1) hide show
  1. vector_store.py +17 -6
vector_store.py CHANGED
@@ -743,12 +743,23 @@ class QdrantManager:
743
  # Generate query embedding
744
  query_embedding = self.embedding_model.embed_query(query_text)
745
 
746
- # Query Qdrant
747
- results = self.client.search(
748
- collection_name=self.current_collection,
749
- query_vector=query_embedding.tolist(),
750
- limit=n_results
751
- )
 
 
 
 
 
 
 
 
 
 
 
752
 
753
  # Convert to ChromaDB-compatible format
754
  documents = [[r.payload.get("text", "") for r in results]]
 
743
  # Generate query embedding
744
  query_embedding = self.embedding_model.embed_query(query_text)
745
 
746
+ # Query Qdrant using query_points (newer API) or search (older API)
747
+ try:
748
+ # Try newer API first (qdrant-client >= 1.7)
749
+ from qdrant_client.http.models import QueryRequest
750
+ results = self.client.query_points(
751
+ collection_name=self.current_collection,
752
+ query=query_embedding.tolist(),
753
+ limit=n_results,
754
+ with_payload=True
755
+ ).points
756
+ except (AttributeError, ImportError):
757
+ # Fallback to older API
758
+ results = self.client.search(
759
+ collection_name=self.current_collection,
760
+ query_vector=query_embedding.tolist(),
761
+ limit=n_results
762
+ )
763
 
764
  # Convert to ChromaDB-compatible format
765
  documents = [[r.payload.get("text", "") for r in results]]