Accept validated thinking template options in chat compatibility layer

This commit is contained in:
Mikei386 committed 2026-10-02 10:21:26 +02:00
1 parent b451b52a57
commit c9036201f7
2 files changed
+17 -1

No files matched your search

+9
View File
@@ -14,3 +14,12 @@ class CompatibilityTests(unittest.TestCase):
for value in [True,1,{},[], '', 'MAX', 'x\r\ny']:
with self.assertRaises(CompatibilityError):normalize_chat({'reasoning_effort':value})
with self.assertRaises(CompatibilityError):normalize_chat({'unknown':1})
def test_template_thinking_options(self):
original={'chat_template_kwargs':{'enable_thinking':False,'preserve_thinking':True}}
body,_=normalize_chat(original)
self.assertEqual(body,original)
body['chat_template_kwargs']['enable_thinking']=True
self.assertFalse(original['chat_template_kwargs']['enable_thinking'])
for bad in [None,[],{'enable_thinking':'false'},{'template':'custom'},{'preserve_thinking':1}]:
with self.assertRaises(CompatibilityError):normalize_chat({'chat_template_kwargs':bad})