Spaces:
Sleeping
Sleeping
Update alz_companion/agent.py
Browse files- alz_companion/agent.py +6 -0
alz_companion/agent.py
CHANGED
|
@@ -744,6 +744,9 @@ def make_rag_chain(vs_general: FAISS, vs_personal: FAISS, *, for_evaluation: boo
|
|
| 744 |
# New modify for test evaluation, general_context is empty but use general context in live chat
|
| 745 |
general_context = _format_docs([], "") if for_evaluation else _format_docs(filtered_general_docs, "(No general information found.)")
|
| 746 |
# End
|
|
|
|
|
|
|
|
|
|
| 747 |
|
| 748 |
template = ANSWER_TEMPLATE_SUMMARIZE if "summarization" in query_type else ANSWER_TEMPLATE_FACTUAL
|
| 749 |
user_prompt = ""
|
|
@@ -781,6 +784,9 @@ def make_rag_chain(vs_general: FAISS, vs_personal: FAISS, *, for_evaluation: boo
|
|
| 781 |
personal_sources = {'1 Complaints of a Dutiful Daughter.txt', 'Saved Chat', 'Text Input'}
|
| 782 |
personal_context = _format_docs([d for d in all_retrieved_docs if d.metadata.get('source') in personal_sources], "(No relevant personal memories found.)")
|
| 783 |
general_context = _format_docs([d for d in all_retrieved_docs if d.metadata.get('source') not in personal_sources], "(No general guidance found.)")
|
|
|
|
|
|
|
|
|
|
| 784 |
|
| 785 |
first_emotion = next((d.metadata.get("emotion") for d in all_retrieved_docs if d.metadata.get("emotion")), None)
|
| 786 |
emotions_context = render_emotion_guidelines(first_emotion or kwargs.get("emotion_tag"))
|
|
|
|
| 744 |
# New modify for test evaluation, general_context is empty but use general context in live chat
|
| 745 |
general_context = _format_docs([], "") if for_evaluation else _format_docs(filtered_general_docs, "(No general information found.)")
|
| 746 |
# End
|
| 747 |
+
|
| 748 |
+
print(f"[DEBUG] Personal Context: {personal_context}")
|
| 749 |
+
print(f"[DEBUG] General Context: {general_context}")
|
| 750 |
|
| 751 |
template = ANSWER_TEMPLATE_SUMMARIZE if "summarization" in query_type else ANSWER_TEMPLATE_FACTUAL
|
| 752 |
user_prompt = ""
|
|
|
|
| 784 |
personal_sources = {'1 Complaints of a Dutiful Daughter.txt', 'Saved Chat', 'Text Input'}
|
| 785 |
personal_context = _format_docs([d for d in all_retrieved_docs if d.metadata.get('source') in personal_sources], "(No relevant personal memories found.)")
|
| 786 |
general_context = _format_docs([d for d in all_retrieved_docs if d.metadata.get('source') not in personal_sources], "(No general guidance found.)")
|
| 787 |
+
|
| 788 |
+
print(f"[DEBUG] Personal Context: {personal_context}")
|
| 789 |
+
print(f"[DEBUG] General Context: {general_context}")
|
| 790 |
|
| 791 |
first_emotion = next((d.metadata.get("emotion") for d in all_retrieved_docs if d.metadata.get("emotion")), None)
|
| 792 |
emotions_context = render_emotion_guidelines(first_emotion or kwargs.get("emotion_tag"))
|