💡 All-in-one AI framework for semantic search, LLM orchestration and language model workflows
Python agentsaiai-agentsembeddingsinformation-retrievallanguage-modellarge-language-modelsllmnlppythonragretrieval-augmented-generationsearchsearch-enginesemantic-searchsentence-embeddingstransformerstxtaivector-databasevector-search
Specify np.int64 as the dtype for clarity given it's the default
davidmezzettife2d91370d80
diff --git a/src/python/txtai/ann/hnsw.py b/src/python/txtai/ann/hnsw.pyindex a5d36c6a..bf33163a 100644--- a/src/python/txtai/ann/hnsw.py+++ b/src/python/txtai/ann/hnsw.py@@ -46,7 +46,7 @@ class HNSW(ANN):self.backend.init_index(max_elements=embeddings.shape[0], ef_construction=efconstruction, M=m, random_seed=seed)# Add items - position in embeddings is used as the id- self.backend.add_items(embeddings, np.arange(embeddings.shape[0]))+ self.backend.add_items(embeddings, np.arange(embeddings.shape[0], dtype=np.int64))# Add id offset, delete counter and index build metadataself.config["offset"] = embeddings.shape[0]@@ -60,7 +60,7 @@ class HNSW(ANN):self.backend.resize_index(self.config["offset"] + new)# Append new ids - position in embeddings + existing offset is used as the id- self.backend.add_items(embeddings, np.arange(self.config["offset"], self.config["offset"] + new))+ self.backend.add_items(embeddings, np.arange(self.config["offset"], self.config["offset"] + new, dtype=np.int64))# Update id offset and index metadataself.config["offset"] += new