bosprimigenious commented on code in PR #411:
URL: https://github.com/apache/hugegraph-ai/pull/411#discussion_r4527133510


##########
hugegraph-llm/src/hugegraph_llm/demo/rag_demo/rag_block.py:
##########
@@ -99,12 +110,17 @@ def rag_answer(
         )
         if res.get("switch_to_bleu"):
             gr.Warning("Online reranker fails, automatically switches to local 
bleu rerank.")
-        return (
+        answers = (
             res.get("raw_answer", ""),
             res.get("vector_only_answer", ""),
             res.get("graph_only_answer", ""),
             res.get("graph_vector_answer", ""),
         )
+        if not include_trace:
+            return answers
+        # Same field names as the `/rag/graph` response so callers can compare.
+        trace = {key: res[key] for key in TRACE_FIELDS if key in res}

Review Comment:
   Thanks for catching this. At `99cdef7`, the two graph flows return their 
full state when `include_trace` is set, and `rag_answer()` selects trace fields 
from that state. The new tests cover preparation/state propagation and 
`post_deal`; the trace API test still mocks `rag_answer_func`, so the 
real-`rag_answer()` regression you requested is not covered yet.



##########
hugegraph-llm/src/hugegraph_llm/demo/rag_demo/rag_block.py:
##########
@@ -96,15 +107,23 @@ def rag_answer(
             topk_return_results=topk_return_results,
             vector_dis_threshold=vector_dis_threshold,
             topk_per_keyword=topk_per_keyword,
+            # Graph-only and graph+vector flows return their full state when 
this
+            # is set, which is where the trace fields live.
+            is_graph_rag_recall=include_trace,

Review Comment:
   At `99cdef7`, tracing uses a separate `include_trace` flag. `rag_answer()` 
passes that flag without enabling recall-only mode, and `GraphRecallCondition` 
still checks only `is_graph_rag_recall`. The current tests do not execute the 
real graph-only pipeline with tracing, so that requested regression is still 
missing.



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