Files
Athena-Deck/test_qwen_asr_protocol.py
T
Mikei386 c0bc5d3a1b Integrate Basalt telemetry and shared GPU speech runtimes
Publish the reviewed accumulated runtime, scheduler, profile, UI, native recipes and historical maintenance evidence. Includes Qwen GPU ASR correction and shared Anna/atelier ownership. Validated with 784 local tests, Python/JSON parsing and eight JavaScript syntax checks. Live GPU acceptance and full fresh-host restore limits remain documented.
2026-11-03 21:16:41 +01:00

17 lines
1.1 KiB
Python

import json,unittest
from stt import qwen_asr_request,asr_text
class QwenASRProtocolTests(unittest.TestCase):
def test_audio_only_not_generic_transcription_instruction(self):
body=qwen_asr_request(b'fixture','de')
self.assertNotIn('Transcribe audio',json.dumps(body));self.assertEqual(body['messages'][1]['content'][0]['type'],'input_audio')
self.assertEqual(body['messages'][-1]['content'],'language German<asr_text>');self.assertFalse(body['add_generation_prompt']);self.assertTrue(body['continue_final_message'])
def test_auto_language_and_english(self):
self.assertEqual(len(qwen_asr_request(b'fixture','auto')['messages']),2)
self.assertEqual(qwen_asr_request(b'fixture','en')['messages'][-1]['content'],'language English<asr_text>')
def test_canonical_asr_marker_and_legacy_marker(self):
self.assertEqual(asr_text('language German<|asr_text|>Das ist der Text.<|im_end|>'),'Das ist der Text.')
self.assertEqual(asr_text('German<asr_text>Text<|endoftext|>'),'Text')
def test_literal_spoken_words_are_not_blacklisted(self):
self.assertEqual(asr_text('Transcribe audio to text'),'Transcribe audio to text')
if __name__=='__main__':unittest.main()