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


##########
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:
   Important: `res` never holds a `TRACE_FIELDS` key, because `post_deal` in 
all four `/rag` flows returns only the four answer fields unless 
`is_graph_rag_recall` is set, so the trace is always `{}`. Have the flows 
return the trace fields when tracing is requested, and test through the real 
`rag_answer` instead of a mocked `rag_answer_func`.



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