imbajin commented on code in PR #323:
URL: https://github.com/apache/hugegraph-ai/pull/323#discussion_r3186225047
##########
hugegraph-llm/src/hugegraph_llm/operators/index_op/build_gremlin_example_index.py:
##########
@@ -38,14 +38,22 @@ def __init__(
self.vector_index = vector_index
def run(self, context: Dict[str, Any]) -> Dict[str, Any]:
- # !: We have assumed that self.example is not empty
+ if not self.examples:
+ context["embed_dim"] = 0
+ return context
Review Comment:
‼️ Returning early here leaves any previously persisted `gremlin_examples`
index untouched. `GremlinExampleIndexQuery` reuses that index whenever
`exist("gremlin_examples")` is true, so rebuilding with an empty example set
will still serve stale examples from the previous run. If an empty list is
meant to clear the few-shot examples, we should wipe the index before returning.
```suggestion
if not self.examples:
self.vector_index.clean(self.vector_index_name)
context["embed_dim"] = 0
return context
```
##########
hugegraph-llm/src/hugegraph_llm/operators/index_op/build_gremlin_example_index.py:
##########
@@ -38,14 +38,22 @@ def __init__(
self.vector_index = vector_index
def run(self, context: Dict[str, Any]) -> Dict[str, Any]:
- # !: We have assumed that self.example is not empty
+ if not self.examples:
Review Comment:
‼️ `BuildGremlinExampleIndexNode.node_init()` still rejects `[]` via `if not
self.wk_input.examples`
(`hugegraph-llm/src/hugegraph_llm/nodes/index_node/build_gremlin_example_index.py:37`),
so the main `BuildExampleIndexFlow` never reaches this branch for the
empty-list case. As written, the unit test passes but the end-to-end workflow
still returns `examples is required`. Could we align the node-level guard in
the same PR or add flow-level coverage?
--
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]