Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -188,9 +188,9 @@ if query:
|
|
| 188 |
#st.write("Extracted Context (page_content):", context)
|
| 189 |
#st.write("Number of Extracted Contexts:", len(context))
|
| 190 |
|
| 191 |
-
st.write("π **Relevant Passages Retrieved:**")
|
| 192 |
-
for idx, doc in enumerate(contexts):
|
| 193 |
-
st.write(f"**Excerpt {idx+1}:** {doc.page_content}")
|
| 194 |
|
| 195 |
|
| 196 |
relevancy_prompt = """You are an expert judge tasked with evaluating whether the EACH OF THE CONTEXT provided in the CONTEXT LIST is self sufficient to answer the QUERY asked.
|
|
@@ -318,39 +318,7 @@ EXAMPLE:
|
|
| 318 |
st.markdown("## π‘ **Final Answer**")
|
| 319 |
st.success(final_output["final_response"] if final_output["final_response"] else "β οΈ No clear answer found based on retrieved content.")
|
| 320 |
|
| 321 |
-
|
| 322 |
-
st.markdown("### π **Detailed Processing Breakdown**")
|
| 323 |
-
st.info("Expand the sections below to see retrieved contexts, relevance scores, and other details.")
|
| 324 |
-
|
| 325 |
-
# π Relevant Contexts Used
|
| 326 |
-
with st.expander("π **View Relevant Contexts Used**"):
|
| 327 |
-
st.markdown("### π **Relevant Contexts Extracted**")
|
| 328 |
-
if isinstance(final_output.get("relevant_contexts"), list) and final_output["relevant_contexts"]:
|
| 329 |
-
for idx, doc in enumerate(final_output["relevant_contexts"], 1):
|
| 330 |
-
st.write(f"πΉ **Context {idx}:** {doc}")
|
| 331 |
-
else:
|
| 332 |
-
st.warning("β οΈ No relevant contexts available.")
|
| 333 |
-
|
| 334 |
-
# π Relevance Analysis
|
| 335 |
-
with st.expander("π **View Relevance Analysis**"):
|
| 336 |
-
st.markdown("### π **Context Relevancy Scores & Analysis**")
|
| 337 |
-
if isinstance(final_output.get("relevancy_response"), list) and final_output["relevancy_response"]:
|
| 338 |
-
for item in final_output["relevancy_response"]:
|
| 339 |
-
st.write(f"β
**Context {item.get('content', 'N/A')} - Score: {item.get('score', 'N/A')}**")
|
| 340 |
-
st.write(f"**Reasoning:** {item.get('Reasoning', 'No explanation provided.')}")
|
| 341 |
-
else:
|
| 342 |
-
st.warning("β οΈ No relevance analysis available.")
|
| 343 |
-
|
| 344 |
-
# π’ Relevant Context Numbers
|
| 345 |
-
with st.expander("π **View Relevant Context Numbers**"):
|
| 346 |
-
st.markdown("### π’ **Context Numbers Used in Processing**")
|
| 347 |
-
context_numbers = final_output.get("context_number", "β οΈ No context numbers available.")
|
| 348 |
-
|
| 349 |
-
# π Handle <think> debug output (if any)
|
| 350 |
-
if isinstance(context_numbers, str) and "<think>" in context_numbers:
|
| 351 |
-
context_numbers = "β οΈ No valid context numbers available."
|
| 352 |
-
|
| 353 |
-
st.write(context_numbers)
|
| 354 |
|
| 355 |
|
| 356 |
|
|
|
|
| 188 |
#st.write("Extracted Context (page_content):", context)
|
| 189 |
#st.write("Number of Extracted Contexts:", len(context))
|
| 190 |
|
| 191 |
+
#st.write("π **Relevant Passages Retrieved:**")
|
| 192 |
+
#for idx, doc in enumerate(contexts):
|
| 193 |
+
#st.write(f"**Excerpt {idx+1}:** {doc.page_content}")
|
| 194 |
|
| 195 |
|
| 196 |
relevancy_prompt = """You are an expert judge tasked with evaluating whether the EACH OF THE CONTEXT provided in the CONTEXT LIST is self sufficient to answer the QUERY asked.
|
|
|
|
| 318 |
st.markdown("## π‘ **Final Answer**")
|
| 319 |
st.success(final_output["final_response"] if final_output["final_response"] else "β οΈ No clear answer found based on retrieved content.")
|
| 320 |
|
| 321 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 322 |
|
| 323 |
|
| 324 |
|