Copilot commented on code in PR #265:
URL: 
https://github.com/apache/incubator-hugegraph-ai/pull/265#discussion_r2257044111


##########
hugegraph-llm/src/hugegraph_llm/operators/index_op/gremlin_example_index_query.py:
##########
@@ -22,26 +22,31 @@
 
 import pandas as pd
 
-from hugegraph_llm.config import resource_path
-from hugegraph_llm.indices.vector_index import VectorIndex
+from hugegraph_llm.config import resource_path, llm_settings
+from hugegraph_llm.indices.vector_index import VectorIndex, INDEX_FILE_NAME, 
PROPERTIES_FILE_NAME
 from hugegraph_llm.models.embeddings.base import BaseEmbedding
 from hugegraph_llm.models.embeddings.init_embedding import Embeddings
+from hugegraph_llm.utils.embedding_utils import get_embeddings_parallel, 
get_filename_prefix, get_index_folder_name
 from hugegraph_llm.utils.log import log
-from hugegraph_llm.utils.embedding_utils import get_embeddings_parallel
 
 
 class GremlinExampleIndexQuery:
     def __init__(self, embedding: BaseEmbedding = None, num_examples: int = 1):
         self.embedding = embedding or Embeddings().get_embedding()
         self.num_examples = num_examples
-        self.index_dir = os.path.join(resource_path, "gremlin_examples")
+        self.folder_name = get_index_folder_name(llm_settings.graph_name, 
llm_settings.graph_space)

Review Comment:
   Using `llm_settings.graph_name` and `llm_settings.graph_space` instead of 
`huge_settings.graph_name` and `huge_settings.graph_space` is inconsistent with 
other files and may cause incorrect folder paths. Should use `huge_settings` 
like other index operations.
   ```suggestion
           self.folder_name = get_index_folder_name(huge_settings.graph_name, 
huge_settings.graph_space)
   ```



##########
hugegraph-llm/src/hugegraph_llm/operators/index_op/build_vector_index.py:
##########
@@ -20,18 +20,23 @@
 import os
 from typing import Dict, Any
 
-from hugegraph_llm.config import huge_settings, resource_path
+from hugegraph_llm.config import huge_settings, resource_path, llm_settings
 from hugegraph_llm.indices.vector_index import VectorIndex
 from hugegraph_llm.models.embeddings.base import BaseEmbedding
+from hugegraph_llm.utils.embedding_utils import get_embeddings_parallel, 
get_filename_prefix
 from hugegraph_llm.utils.log import log
-from hugegraph_llm.utils.embedding_utils import get_embeddings_parallel
 
 
 class BuildVectorIndex:
     def __init__(self, embedding: BaseEmbedding):
         self.embedding = embedding
-        self.index_dir = str(os.path.join(resource_path, 
huge_settings.graph_name, "chunks"))
-        self.vector_index = VectorIndex.from_index_file(self.index_dir)
+        self.folder_name = "_".join(filter(None, [huge_settings.graph_space, 
huge_settings.graph_name]))

Review Comment:
   This folder name generation logic is inconsistent with the 
`get_index_folder_name` utility function used elsewhere. Consider using the 
utility function for consistency: `self.folder_name = 
get_index_folder_name(huge_settings.graph_name, huge_settings.graph_space)`



-- 
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