Skip to content

armgit / txtai

Public Imported from GitHub
0

💡 All-in-one AI framework for semantic search, LLM orchestration and language model workflows

Ensure HNSW always returns int ids

davidmezzetti807d5349f3c6
diff --git a/src/python/txtai/ann/hnsw.py b/src/python/txtai/ann/hnsw.py
index 7dc1e98b..10117cea 100644
--- a/src/python/txtai/ann/hnsw.py
+++ b/src/python/txtai/ann/hnsw.py
@@ -83,7 +83,8 @@ class HNSW(ANN):
# Convert distances to similarity scores
scores = [1 - d for d in distance]
- results.append(list(zip(ids[x], scores)))
+ # Build (id, score) tuples, convert np.int64 to python int
+ results.append(list(zip(ids[x].tolist(), scores)))
return results