From ae85cbf910491c7903cb984ba7150a8af79965a2 Mon Sep 17 00:00:00 2001 From: Gus Date: Mon, 21 Oct 2024 23:43:52 +0800 Subject: [PATCH] fix: encoding for storage (#3, #4) --- nano_vectordb/__init__.py | 2 +- nano_vectordb/dbs.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nano_vectordb/__init__.py b/nano_vectordb/__init__.py index 718f6ac..ada03aa 100644 --- a/nano_vectordb/__init__.py +++ b/nano_vectordb/__init__.py @@ -1,5 +1,5 @@ from .dbs import NanoVectorDB -__version__ = "0.0.4" +__version__ = "0.0.4.1" __author__ = "Jianbai Ye" __url__ = "https://github.com/gusye1234/nano-vectordb" diff --git a/nano_vectordb/dbs.py b/nano_vectordb/dbs.py index f2092ff..c19fa8c 100644 --- a/nano_vectordb/dbs.py +++ b/nano_vectordb/dbs.py @@ -33,7 +33,7 @@ def buffer_string_to_array(base64_str: str, dtype=Float) -> np.ndarray: def load_storage(file_name) -> Union[DataBase, None]: if not os.path.exists(file_name): return None - with open(file_name) as f: + with open(file_name, encoding="utf-8") as f: data = json.load(f) data["matrix"] = buffer_string_to_array(data["matrix"]).reshape( -1, data["embedding_dim"]