feat: establish voice assistant V1 baseline
This commit is contained in:
83
tests/test_provider_factories.py
Normal file
83
tests/test_provider_factories.py
Normal file
@@ -0,0 +1,83 @@
|
||||
"""
|
||||
Provider factory tests for the Voice Assistant.
|
||||
|
||||
Purpose:
|
||||
Verify that the provider composition layer resolves the configured
|
||||
providers dynamically and passes the configured options correctly.
|
||||
|
||||
Responsibilities:
|
||||
- Validate STT provider creation.
|
||||
- Validate Agent provider creation.
|
||||
- Validate TTS provider creation.
|
||||
- Verify provider-specific options are propagated to each adapter.
|
||||
|
||||
Non-responsibilities:
|
||||
- Testing provider internals.
|
||||
- Testing WebSocket behavior.
|
||||
- Testing external services.
|
||||
|
||||
Architecture:
|
||||
AppConfig + ProviderCatalog
|
||||
|
|
||||
v
|
||||
provider factories
|
||||
|
|
||||
v
|
||||
concrete Adapter instances
|
||||
"""
|
||||
|
||||
from voice_assistant.agent.mock import MockAgentAdapter
|
||||
from voice_assistant.config.loader import (
|
||||
load_config,
|
||||
load_provider_catalog,
|
||||
)
|
||||
from voice_assistant.providers import (
|
||||
create_agent_adapter,
|
||||
create_stt_adapter,
|
||||
create_tts_adapter,
|
||||
)
|
||||
from voice_assistant.stt.nvidia import NvidiaSTTAdapter
|
||||
from voice_assistant.tts.voxcpm import VoxCPMTTSAdapter
|
||||
|
||||
|
||||
def test_create_stt_adapter_from_config():
|
||||
config = load_config()
|
||||
catalog = load_provider_catalog()
|
||||
|
||||
stt = create_stt_adapter(
|
||||
config=config,
|
||||
catalog=catalog,
|
||||
)
|
||||
|
||||
assert isinstance(stt, NvidiaSTTAdapter)
|
||||
assert stt.server == "127.0.0.1:9000"
|
||||
assert stt.language_code == "pt-BR"
|
||||
assert stt.automatic_punctuation is True
|
||||
|
||||
|
||||
def test_create_agent_adapter_from_config():
|
||||
config = load_config()
|
||||
catalog = load_provider_catalog()
|
||||
|
||||
agent = create_agent_adapter(
|
||||
config=config,
|
||||
catalog=catalog,
|
||||
)
|
||||
|
||||
assert isinstance(agent, MockAgentAdapter)
|
||||
|
||||
|
||||
def test_create_tts_adapter_from_config():
|
||||
config = load_config()
|
||||
catalog = load_provider_catalog()
|
||||
|
||||
tts = create_tts_adapter(
|
||||
config=config,
|
||||
catalog=catalog,
|
||||
)
|
||||
|
||||
assert isinstance(tts, VoxCPMTTSAdapter)
|
||||
assert tts.server == "http://127.0.0.1:8000"
|
||||
assert tts.model == "openbmb/VoxCPM2"
|
||||
assert tts.voice == "default"
|
||||
|
||||
Reference in New Issue
Block a user