fix: surface retrieved evidence when model abstains

This commit is contained in:
Hamza Ayed
2026-10-04 14:07:35 +03:00
parent d1010b79d7
commit bdd722e6e9
5 changed files with 622 additions and 1 deletions
@@ -256,6 +256,11 @@ class AgentSkillTests(unittest.TestCase):
}
refusal = "لم يتم العثور على مقاطع تجيب مباشرة على السؤال في فهرس المعرفة المحلي."
live_refusal = 'لا يوجد مقطع في فهرس المعرفة المحلي يجيب مباشرة على السؤال "How are old conversation answers migrated?".'
natural_refusals = (
"المعلومات المتوفرة لا تجيب على سؤالك حول أي خدمة تفرغ التسجيلات الصوتية.",
"المعلومات المتاحة لا تجيب مباشرة على السؤال حول كيفية ترحيل الإجابات القديمة.",
"The available information doesn't answer the question.",
)
with (
patch(
"app.main._search_local_knowledge",
@@ -282,6 +287,8 @@ class AgentSkillTests(unittest.TestCase):
citation_only = "المقطع `routing.md`, المقطع 0."
self.assertTrue(_is_knowledge_answer_insufficient(refusal))
self.assertTrue(_is_knowledge_answer_insufficient(live_refusal))
for natural_refusal in natural_refusals:
self.assertTrue(_is_knowledge_answer_insufficient(natural_refusal))
self.assertTrue(_is_knowledge_answer_insufficient(citation_only))
self.assertFalse(_is_knowledge_answer_insufficient("تضيف الهجرة selected_version."))
self.assertIn("لم يصغ النموذج جوابًا كافيًا رغم وجود نتائج", result["result"])