From 8b2bf136f17370561bb08a70112d856211c812c0 Mon Sep 17 00:00:00 2001 From: Jon Saad-Falcon Date: Tue, 3 Mar 2026 05:51:29 +0000 Subject: [PATCH] feat(speech): add SpeechConfig to configuration system Add SpeechConfig dataclass with backend, model, language, device, and compute_type fields. Wire it into JarvisConfig and load_config() so [speech] TOML sections are loaded automatically. Co-Authored-By: Claude Opus 4.6 --- src/openjarvis/core/config.py | 14 ++++++++++++++ tests/speech/__init__.py | 0 tests/speech/test_config.py | 19 +++++++++++++++++++ 3 files changed, 33 insertions(+) create mode 100644 tests/speech/__init__.py create mode 100644 tests/speech/test_config.py diff --git a/src/openjarvis/core/config.py b/src/openjarvis/core/config.py index 1d16f373..b4a0419d 100644 --- a/src/openjarvis/core/config.py +++ b/src/openjarvis/core/config.py @@ -830,6 +830,17 @@ class OperatorsConfig: auto_activate: str = "" # Comma-separated operator IDs +@dataclass(slots=True) +class SpeechConfig: + """Speech-to-text settings.""" + + backend: str = "auto" # "auto", "faster-whisper", "whisper-cpp", "openai", "deepgram" + model: str = "base" # Whisper model size: tiny, base, small, medium, large-v3 + language: str = "" # Empty = auto-detect + device: str = "auto" # "auto", "cpu", "cuda" + compute_type: str = "float16" # "float16", "int8", "float32" + + @dataclass class JarvisConfig: """Top-level configuration for OpenJarvis.""" @@ -851,6 +862,7 @@ class JarvisConfig: sessions: SessionConfig = field(default_factory=SessionConfig) a2a: A2AConfig = field(default_factory=A2AConfig) operators: OperatorsConfig = field(default_factory=OperatorsConfig) + speech: SpeechConfig = field(default_factory=SpeechConfig) @property def memory(self) -> StorageConfig: @@ -945,6 +957,7 @@ def load_config(path: Optional[Path] = None) -> JarvisConfig: "server", "telemetry", "traces", "security", "channel", "tools", "sandbox", "scheduler", "workflow", "sessions", "a2a", "operators", + "speech", ) for section_name in top_sections: if section_name in data: @@ -1196,6 +1209,7 @@ __all__ = [ "SessionConfig", "SignalChannelConfig", "SlackChannelConfig", + "SpeechConfig", "StorageConfig", "TeamsChannelConfig", "TelegramChannelConfig", diff --git a/tests/speech/__init__.py b/tests/speech/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/speech/test_config.py b/tests/speech/test_config.py new file mode 100644 index 00000000..804af199 --- /dev/null +++ b/tests/speech/test_config.py @@ -0,0 +1,19 @@ +"""Tests for speech configuration.""" + +from openjarvis.core.config import JarvisConfig, SpeechConfig + + +def test_speech_config_defaults(): + cfg = SpeechConfig() + assert cfg.backend == "auto" + assert cfg.model == "base" + assert cfg.language == "" + assert cfg.device == "auto" + assert cfg.compute_type == "float16" + + +def test_jarvis_config_has_speech(): + cfg = JarvisConfig() + assert hasattr(cfg, "speech") + assert isinstance(cfg.speech, SpeechConfig) + assert cfg.speech.backend == "auto"