jasinliu commented on code in PR #75:
URL: 
https://github.com/apache/incubator-hugegraph-ai/pull/75#discussion_r1745590185


##########
hugegraph-llm/src/hugegraph_llm/indices/vector_index.py:
##########
@@ -14,24 +14,31 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-
-
+import os
 import pickle as pkl
 from copy import deepcopy
-from typing import List, Dict, Any
+from typing import List, Dict, Any, Set, Union
 
 import faiss
 import numpy as np
 
 
+INDEX_FILE_NAME = "index.faiss"
+PROPERTIES_FILE_NAME = "properties.pkl"
+
+
 class VectorIndex:
     """Comment"""
-    def __init__(self, embed_dim: int):
+    def __init__(self, embed_dim: int = 1024):
         self.index = faiss.IndexFlatL2(embed_dim)
         self.properties = []
 
     @staticmethod
-    def from_index_file(index_file: str, properties_file: str) -> 
"VectorIndex":
+    def from_index_file(dir_path: str) -> "VectorIndex":
+        index_file = os.path.join(dir_path, INDEX_FILE_NAME)
+        properties_file = os.path.join(dir_path, PROPERTIES_FILE_NAME)
+        if not os.path.exists(index_file) or not 
os.path.exists(properties_file):
+            return VectorIndex()

Review Comment:
   This should be logged.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to