Spaces:
Sleeping
Sleeping
Update qdrant_search.py
Browse files- qdrant_search.py +6 -6
qdrant_search.py
CHANGED
|
@@ -36,14 +36,13 @@ def qdrant_search_tool(query: str) -> str:
|
|
| 36 |
query_vector = embedder.encode(query).tolist()
|
| 37 |
print(f"Vector generation complete. Vector length: {len(query_vector)}")
|
| 38 |
|
| 39 |
-
# 2. Query Qdrant
|
| 40 |
-
#
|
| 41 |
-
|
| 42 |
-
results = client.query_points(
|
| 43 |
collection_name=COLLECTION_NAME,
|
| 44 |
query_vector=query_vector,
|
| 45 |
limit=5
|
| 46 |
-
)
|
| 47 |
|
| 48 |
print(f"Raw results count: {len(results)}")
|
| 49 |
|
|
@@ -57,8 +56,9 @@ def qdrant_search_tool(query: str) -> str:
|
|
| 57 |
|
| 58 |
# Debug: Print the payload of the first hit to see the structure
|
| 59 |
if i == 0:
|
| 60 |
-
print(f"Sample Payload
|
| 61 |
|
|
|
|
| 62 |
title = payload.get("title") or payload.get("name") or "Article"
|
| 63 |
url = payload.get("url") or payload.get("link")
|
| 64 |
text = payload.get("text", "")
|
|
|
|
| 36 |
query_vector = embedder.encode(query).tolist()
|
| 37 |
print(f"Vector generation complete. Vector length: {len(query_vector)}")
|
| 38 |
|
| 39 |
+
# 2. Query Qdrant using client.search
|
| 40 |
+
# This replaces query_points to avoid 'Unknown arguments' errors
|
| 41 |
+
results = client.search(
|
|
|
|
| 42 |
collection_name=COLLECTION_NAME,
|
| 43 |
query_vector=query_vector,
|
| 44 |
limit=5
|
| 45 |
+
)
|
| 46 |
|
| 47 |
print(f"Raw results count: {len(results)}")
|
| 48 |
|
|
|
|
| 56 |
|
| 57 |
# Debug: Print the payload of the first hit to see the structure
|
| 58 |
if i == 0:
|
| 59 |
+
print(f"Sample Payload keys: {list(payload.keys())}")
|
| 60 |
|
| 61 |
+
# Extracting metadata with fallbacks
|
| 62 |
title = payload.get("title") or payload.get("name") or "Article"
|
| 63 |
url = payload.get("url") or payload.get("link")
|
| 64 |
text = payload.get("text", "")
|