feat: adiciona Silero VAD local com configuração por ambiente

This commit is contained in:
alex alves
2026-11-03 17:20:51 -03:00
parent 2d1acdac31
commit d27c26c166
11 changed files with 1154 additions and 11 deletions

View File

@@ -10,7 +10,7 @@ Responsibilities:
- Resolve provider implementations from ProviderCatalog metadata.
- Import provider classes dynamically.
- Validate that the loaded implementation matches the expected adapter.
- Instantiate STT, Agent, and TTS providers using provider-specific options.
- Instantiate STT, Agent, TTS, and VAD providers using provider-specific options.
Non-responsibilities:
- Loading YAML files.
@@ -26,7 +26,7 @@ Architecture:
Provider Loader
|
v
STTAdapter / AgentAdapter / TTSAdapter
STTAdapter / AgentAdapter / TTSAdapter / VADAdapter
|
v
concrete provider
@@ -43,12 +43,14 @@ from voice_assistant.config.models import (
)
from voice_assistant.stt.adapter import STTAdapter
from voice_assistant.tts.adapter import TTSAdapter
from voice_assistant.vad.adapter import VADAdapter
PROVIDER_CONTRACTS: dict[str, type] = {
"stt": STTAdapter,
"agent": AgentAdapter,
"tts": TTSAdapter,
"vad": VADAdapter,
}
@@ -184,3 +186,19 @@ def create_tts_adapter(
config=config.tts,
)
def create_vad_adapter(
config: AppConfig,
catalog: ProviderCatalog,
) -> VADAdapter:
"""Create the VAD selected by the active environment configuration."""
if config.vad is None:
raise ValueError("VAD provider is not configured for this environment.")
return _create_provider(
catalog=catalog,
component="vad",
config=config.vad,
)