Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -314,26 +314,37 @@ if query:
|
|
314 |
|
315 |
final_output = context_management_chain({"context":context,"retriever_query":query,"query":query})
|
316 |
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
|
|
|
|
|
|
328 |
|
329 |
-
st.subheader('final_output["context_number"]')
|
330 |
-
st.write(final_output["context_number"])
|
331 |
|
332 |
-
st.
|
333 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
334 |
|
335 |
-
|
336 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
# π **Detailed Output Sections Below**
|
321 |
+
st.markdown("### π **Detailed Processing Breakdown**")
|
322 |
+
st.info("Expand the sections below to see retrieved contexts, relevance scores, and other details.")
|
323 |
+
|
324 |
+
with st.expander("π **View Relevant Contexts Used**"):
|
325 |
+
st.markdown("### π **Relevant Contexts Extracted**")
|
326 |
+
if isinstance(final_output["relevant_contexts"], list):
|
327 |
+
for idx, doc in enumerate(final_output["relevant_contexts"], 1):
|
328 |
+
st.write(f"πΉ **Context {idx}:** {doc}")
|
329 |
+
else:
|
330 |
+
st.warning("β οΈ No relevant contexts available.")
|
331 |
|
|
|
|
|
332 |
|
333 |
+
with st.expander("π **View Relevance Analysis**"):
|
334 |
+
st.markdown("### π **Context Relevancy Scores & Analysis**")
|
335 |
+
if isinstance(final_output["relevancy_response"], list):
|
336 |
+
for item in final_output["relevancy_response"]:
|
337 |
+
st.write(f"β
**Context {item.get('content', 'N/A')} - Score: {item.get('score', 'N/A')}**")
|
338 |
+
st.write(f"**Reasoning:** {item.get('Reasoning', 'No explanation provided.')}")
|
339 |
+
else:
|
340 |
+
st.warning("β οΈ No relevance analysis available.")
|
341 |
|
342 |
+
|
343 |
+
with st.expander("π **View Relevant Context Numbers**"):
|
344 |
+
st.markdown("### π’ **Context Numbers Used in Processing**")
|
345 |
+
if final_output["context_number"]:
|
346 |
+
st.write(final_output["context_number"])
|
347 |
+
else:
|
348 |
+
st.warning("β οΈ No context numbers available.")
|
349 |
+
|
350 |
|
|
|
|