DrishtiSharma commited on
Commit
5e744c0
Β·
verified Β·
1 Parent(s): 662bc2d

Update lab/goodbye_errors_v2.py

Browse files
Files changed (1) hide show
  1. lab/goodbye_errors_v2.py +26 -23
lab/goodbye_errors_v2.py CHANGED
@@ -314,26 +314,29 @@ if query:
314
 
315
  final_output = context_management_chain({"context":context,"retriever_query":query,"query":query})
316
 
317
- #st.subheader('final_output["relevancy_response"]')
318
- #st.write(final_output["relevancy_response"] )
319
-
320
- st.write("πŸ“Œ **Relevance Analysis:**")
321
- if isinstance(final_output["relevancy_response"], list):
322
- for item in final_output["relevancy_response"]:
323
- st.write(f"βœ… **Context {item.get('content', 'N/A')} - Score: {item.get('score', 'N/A')}**")
324
- st.write(f"**Reasoning:** {item.get('Reasoning', 'No explanation provided.')}")
325
- else:
326
- st.write("⚠️ No relevance analysis available.")
327
-
328
-
329
- st.subheader('final_output["context_number"]')
330
- st.write(final_output["context_number"])
331
-
332
- st.subheader('final_output["relevant_contexts"]')
333
- st.write(final_output["relevant_contexts"])
334
-
335
- #st.subheader('final_output["final_response"]')
336
- #st.write(final_output["final_response"])
337
-
338
- st.subheader("πŸ“’ **Final Answer:**")
339
- st.write(final_output["final_response"] if final_output["final_response"] else "⚠️ No clear answer found based on retrieved content.")
 
 
 
 
314
 
315
  final_output = context_management_chain({"context":context,"retriever_query":query,"query":query})
316
 
317
+ st.markdown("## πŸ’‘ **Final Answer**")
318
+ st.success(final_output["final_response"] if final_output["final_response"] else "⚠️ No clear answer found based on retrieved content.")
319
+
320
+ st.markdown("### πŸ“‚ **Detailed Processing Breakdown**")
321
+ st.info("Expand the sections below to see retrieved contexts, relevance scores, and other details.")
322
+
323
+ with st.expander("πŸ“Œ **View Relevant Contexts Used**"):
324
+ st.markdown("### πŸ“– **Relevant Contexts Extracted**")
325
+ if isinstance(final_output["relevant_contexts"], list):
326
+ for idx, doc in enumerate(final_output["relevant_contexts"], 1):
327
+ st.write(f"πŸ”Ή **Context {idx}:** {doc}")
328
+ else:
329
+ st.warning("⚠️ No relevant contexts available.")
330
+
331
+ with st.expander("πŸ“Œ **View Relevance Analysis**"):
332
+ st.markdown("### πŸ“Š **Context Relevancy Scores & Analysis**")
333
+ if isinstance(final_output["relevancy_response"], list):
334
+ for item in final_output["relevancy_response"]:
335
+ st.write(f"βœ… **Context {item.get('content', 'N/A')} - Score: {item.get('score', 'N/A')}**")
336
+ st.write(f"**Reasoning:** {item.get('Reasoning', 'No explanation provided.')}")
337
+ else:
338
+ st.warning("⚠️ No relevance analysis available.")
339
+
340
+ with st.expander("πŸ” **View Relevant Context Numbers**"):
341
+ st.markdown("### πŸ”’ **Context Numbers Used in Processing**")
342
+ st.write(final_output["context_number"])