imbajin commented on code in PR #354:
URL: https://github.com/apache/hugegraph-ai/pull/354#discussion_r3371082579


##########
hugegraph-llm/src/hugegraph_llm/flows/common.py:
##########
@@ -19,6 +19,30 @@
 from hugegraph_llm.state.ai_state import WkFlowInput
 from hugegraph_llm.utils.log import log
 
+GRAPH_RECALL_TRACE_KEYS = (
+    "keywords",
+    "match_vids",
+    "graph_result_flag",
+    "gremlin",

Review Comment:
   ‼️ `gremlin` is advertised as part of the new trace contract, but the real 
flow drops it before `graph_trace_payload()` can see it. `GraphQueryNode` 
writes `context["gremlin"]`, then `BaseNode` persists node output through 
`WkFlowState.assign_from_json()`, which only keeps fields declared on 
`WkFlowState`. Since `WkFlowState` declares nearby graph trace fields such as 
`graph_result_flag` and `vertex_degree_list` but not `gremlin`, real `/rag` 
responses with `include_trace=true` will omit `trace.gremlin` even when Gremlin 
was generated.
   
   The current test masks this by dynamically assigning `state.gremlin = 
"g.V()"`, bypassing `assign_from_json()`. Please either add `gremlin: 
Optional[str]` to `WkFlowState` and reset it in `setup()`, or remove `gremlin` 
from the public trace contract. The regression test should exercise 
`assign_from_json()` or an actual flow-state path.



##########
hugegraph-llm/src/hugegraph_llm/api/models/rag_requests.py:
##########
@@ -56,6 +56,7 @@ class RAGRequest(BaseModel):
                                    extracted from the query, by default only 
the most similar one is returned.",
     )
     client_config: Optional[GraphConfigRequest] = Query(None, 
description="hugegraph server config.")
+    include_trace: bool = Query(False, description="Include retrieval 
trace/debug info in the response.")

Review Comment:
   ⚠️ `include_trace` is exposed as a generic retrieval/debug switch, but the 
implementation only returns trace for `graph_only` / `graph_vector_answer`; 
`vector_only + include_trace` silently omits trace. That makes it hard for 
clients to distinguish "trace unsupported for this mode" from "no trace was 
produced", and vector-only is also a retrieval mode.
   
   Please either narrow the request contract/description to graph-backed trace 
and reject unsupported combinations with a clear 400, or implement vector trace 
data as part of the same contract.



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