Skip to content

Commit 9117b1b

Browse files
committed
fix
1 parent d30ad5a commit 9117b1b

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

hugegraph-llm/src/hugegraph_llm/operators/index_op/build_gremlin_example_index.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,17 @@ def __init__(self, embedding: BaseEmbedding, examples: List[Dict[str, str]]):
3737

3838
def run(self, context: Dict[str, Any]) -> Dict[str, Any]:
3939
embed_dim = 0
40-
40+
4141
if len(self.examples) > 0:
4242
# Use the new async parallel embedding approach from upstream
4343
queries = [example["query"] for example in self.examples]
4444
# TODO: refactor function chain async to avoid blocking
4545
examples_embedding = asyncio.run(get_embeddings_parallel(self.embedding, queries))
4646
embed_dim = len(examples_embedding[0])
47-
47+
4848
vector_index = VectorIndex(embed_dim)
4949
vector_index.add(examples_embedding, self.examples)
5050
vector_index.to_index_file(self.index_dir, self.filename_prefix)
51-
51+
5252
context["embed_dim"] = embed_dim
5353
return context

hugegraph-llm/src/tests/operators/index_op/test_build_gremlin_example_index.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ def setUp(self):
5151
self.patcher2 = patch("hugegraph_llm.operators.index_op.build_gremlin_example_index.get_index_folder_name")
5252
self.mock_get_index_folder_name = self.patcher2.start()
5353
self.mock_get_index_folder_name.return_value = "hugegraph"
54-
54+
5555
self.patcher3 = patch("hugegraph_llm.operators.index_op.build_gremlin_example_index.get_filename_prefix")
5656
self.mock_get_filename_prefix = self.patcher3.start()
5757
self.mock_get_filename_prefix.return_value = "test_prefix"
58-
58+
5959
self.patcher4 = patch("hugegraph_llm.operators.index_op.build_gremlin_example_index.get_embeddings_parallel")
6060
self.mock_get_embeddings_parallel = self.patcher4.start()
6161
self.mock_get_embeddings_parallel.return_value = [[0.1, 0.2, 0.3], [0.4, 0.5, 0.6]]
@@ -128,7 +128,7 @@ def test_run_with_empty_examples(self):
128128

129129
# The run method should handle empty examples gracefully
130130
result = builder.run(context)
131-
131+
132132
# Should return embed_dim as 0 for empty examples
133133
self.assertEqual(result["embed_dim"], 0)
134134
self.assertEqual(result["test"], "value") # Original context should be preserved

0 commit comments

Comments
 (0)