Add benchmark-driven model promotion workflow and pipeline stages
Some checks failed
ci / test-and-build (push) Has been cancelled
Some checks failed
ci / test-and-build (push) Has been cancelled
This commit is contained in:
parent
98b13d1069
commit
8c1f7c1e13
38 changed files with 5300 additions and 503 deletions
|
|
@ -25,14 +25,12 @@ class ConfigTests(unittest.TestCase):
|
|||
self.assertEqual(cfg.stt.model, "base")
|
||||
self.assertEqual(cfg.stt.device, "cpu")
|
||||
self.assertEqual(cfg.stt.language, "auto")
|
||||
self.assertEqual(cfg.llm.provider, "local_llama")
|
||||
self.assertFalse(cfg.models.allow_custom_models)
|
||||
self.assertEqual(cfg.models.whisper_model_path, "")
|
||||
self.assertEqual(cfg.models.llm_model_path, "")
|
||||
self.assertFalse(cfg.external_api.enabled)
|
||||
self.assertEqual(cfg.external_api.provider, "openai")
|
||||
self.assertEqual(cfg.injection.backend, "clipboard")
|
||||
self.assertFalse(cfg.injection.remove_transcription_from_clipboard)
|
||||
self.assertTrue(cfg.safety.enabled)
|
||||
self.assertFalse(cfg.safety.strict)
|
||||
self.assertEqual(cfg.ux.profile, "default")
|
||||
self.assertTrue(cfg.ux.show_notifications)
|
||||
self.assertTrue(cfg.advanced.strict_startup)
|
||||
|
|
@ -54,13 +52,15 @@ class ConfigTests(unittest.TestCase):
|
|||
"device": "cuda",
|
||||
"language": "English",
|
||||
},
|
||||
"llm": {"provider": "local_llama"},
|
||||
"models": {"allow_custom_models": False},
|
||||
"external_api": {"enabled": False},
|
||||
"injection": {
|
||||
"backend": "injection",
|
||||
"remove_transcription_from_clipboard": True,
|
||||
},
|
||||
"safety": {
|
||||
"enabled": True,
|
||||
"strict": True,
|
||||
},
|
||||
"vocabulary": {
|
||||
"replacements": [
|
||||
{"from": "Martha", "to": "Marta"},
|
||||
|
|
@ -82,9 +82,10 @@ class ConfigTests(unittest.TestCase):
|
|||
self.assertEqual(cfg.stt.model, "small")
|
||||
self.assertEqual(cfg.stt.device, "cuda")
|
||||
self.assertEqual(cfg.stt.language, "en")
|
||||
self.assertEqual(cfg.llm.provider, "local_llama")
|
||||
self.assertEqual(cfg.injection.backend, "injection")
|
||||
self.assertTrue(cfg.injection.remove_transcription_from_clipboard)
|
||||
self.assertTrue(cfg.safety.enabled)
|
||||
self.assertTrue(cfg.safety.strict)
|
||||
self.assertEqual(len(cfg.vocabulary.replacements), 2)
|
||||
self.assertEqual(cfg.vocabulary.replacements[0].source, "Martha")
|
||||
self.assertEqual(cfg.vocabulary.replacements[0].target, "Marta")
|
||||
|
|
@ -138,6 +139,33 @@ class ConfigTests(unittest.TestCase):
|
|||
with self.assertRaisesRegex(ValueError, "injection.remove_transcription_from_clipboard"):
|
||||
load(str(path))
|
||||
|
||||
def test_invalid_safety_enabled_option_raises(self):
|
||||
payload = {"safety": {"enabled": "yes"}}
|
||||
with tempfile.TemporaryDirectory() as td:
|
||||
path = Path(td) / "config.json"
|
||||
path.write_text(json.dumps(payload), encoding="utf-8")
|
||||
|
||||
with self.assertRaisesRegex(ValueError, "safety.enabled"):
|
||||
load(str(path))
|
||||
|
||||
def test_invalid_safety_strict_option_raises(self):
|
||||
payload = {"safety": {"strict": "yes"}}
|
||||
with tempfile.TemporaryDirectory() as td:
|
||||
path = Path(td) / "config.json"
|
||||
path.write_text(json.dumps(payload), encoding="utf-8")
|
||||
|
||||
with self.assertRaisesRegex(ValueError, "safety.strict"):
|
||||
load(str(path))
|
||||
|
||||
def test_unknown_safety_fields_raise(self):
|
||||
payload = {"safety": {"enabled": True, "mode": "strict"}}
|
||||
with tempfile.TemporaryDirectory() as td:
|
||||
path = Path(td) / "config.json"
|
||||
path.write_text(json.dumps(payload), encoding="utf-8")
|
||||
|
||||
with self.assertRaisesRegex(ValueError, "safety.mode: unknown config field"):
|
||||
load(str(path))
|
||||
|
||||
def test_unknown_top_level_fields_raise(self):
|
||||
payload = {
|
||||
"custom_a": {"enabled": True},
|
||||
|
|
@ -269,10 +297,9 @@ class ConfigTests(unittest.TestCase):
|
|||
|
||||
self.assertEqual(cfg.config_version, CURRENT_CONFIG_VERSION)
|
||||
|
||||
def test_external_llm_requires_external_api_enabled(self):
|
||||
def test_legacy_llm_config_fields_raise(self):
|
||||
payload = {
|
||||
"llm": {"provider": "external_api"},
|
||||
"external_api": {"enabled": False},
|
||||
"llm": {"provider": "local_llama"},
|
||||
}
|
||||
with tempfile.TemporaryDirectory() as td:
|
||||
path = Path(td) / "config.json"
|
||||
|
|
@ -280,7 +307,7 @@ class ConfigTests(unittest.TestCase):
|
|||
|
||||
with self.assertRaisesRegex(
|
||||
ValueError,
|
||||
"llm.provider: external_api provider requires external_api.enabled=true",
|
||||
"llm: unknown config field",
|
||||
):
|
||||
load(str(path))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue