fix(retrieval): match the Qwen query prompt format

Drop the trailing space after "Query:" as in the model card and include the
prompt in the query cache key.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Julian lechnerandClaude Opus 5.5 committed 2026-10-01 13:13:06 +02:00
1 parent d60dd10c45
commit f134c50d39
2 files changed
+8 -3

No files matched your search

+4
View File
@@ -133,6 +133,10 @@ class RetrievalServerTests(unittest.TestCase):
self.assertNotEqual(MODULE.daemon_address(data_dir), old_address)
self.assertNotEqual(MODULE.daemon_lock_path(data_dir), old_lock)
def test_query_prompt_matches_qwen_format(self):
self.assertTrue(MODULE.QUERY_PROMPT.startswith('Instruct: '))
self.assertTrue(MODULE.QUERY_PROMPT.endswith('\nQuery:'))
def test_preferred_device_uses_cuda_with_cpu_fallback(self):
with patch.dict('sys.modules', torch=SimpleNamespace(cuda=SimpleNamespace(is_available=lambda: True))):
self.assertEqual(MODULE.preferred_device(), 'cuda')