Add Volcengine support for TTS and ASR services
- Introduced Volcengine as a new provider for both TTS and ASR services. - Updated configuration files to include Volcengine-specific parameters such as app_id, resource_id, and uid. - Enhanced the ASR service to support streaming mode with Volcengine's API. - Modified existing tests to validate the integration of Volcengine services. - Updated documentation to reflect the addition of Volcengine as a supported provider for TTS and ASR. - Refactored service factory to accommodate Volcengine alongside existing providers.
This commit is contained in:
@@ -227,6 +227,62 @@ async def test_with_backend_url_uses_backend_for_assistant_config(monkeypatch, t
|
||||
assert payload["assistant"]["systemPrompt"] == "backend prompt"
|
||||
|
||||
|
||||
def test_translate_agent_schema_maps_volcengine_fields():
|
||||
payload = {
|
||||
"agent": {
|
||||
"tts": {
|
||||
"provider": "volcengine",
|
||||
"api_key": "tts-key",
|
||||
"api_url": "https://openspeech.bytedance.com/api/v3/tts/unidirectional",
|
||||
"app_id": "app-123",
|
||||
"resource_id": "seed-tts-2.0",
|
||||
"uid": "caller-1",
|
||||
"voice": "zh_female_shuangkuaisisi_moon_bigtts",
|
||||
"speed": 1.1,
|
||||
},
|
||||
"asr": {
|
||||
"provider": "volcengine",
|
||||
"api_key": "asr-key",
|
||||
"api_url": "wss://openspeech.bytedance.com/api/v3/sauc/bigmodel",
|
||||
"model": "bigmodel",
|
||||
"app_id": "app-123",
|
||||
"resource_id": "volc.bigasr.sauc.duration",
|
||||
"uid": "caller-1",
|
||||
"request_params": {
|
||||
"end_window_size": 800,
|
||||
"force_to_speech_time": 1000,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
translated = LocalYamlAssistantConfigAdapter._translate_agent_schema("assistant_demo", payload)
|
||||
assert translated is not None
|
||||
assert translated["services"]["tts"] == {
|
||||
"provider": "volcengine",
|
||||
"apiKey": "tts-key",
|
||||
"baseUrl": "https://openspeech.bytedance.com/api/v3/tts/unidirectional",
|
||||
"voice": "zh_female_shuangkuaisisi_moon_bigtts",
|
||||
"appId": "app-123",
|
||||
"resourceId": "seed-tts-2.0",
|
||||
"uid": "caller-1",
|
||||
"speed": 1.1,
|
||||
}
|
||||
assert translated["services"]["asr"] == {
|
||||
"provider": "volcengine",
|
||||
"model": "bigmodel",
|
||||
"apiKey": "asr-key",
|
||||
"baseUrl": "wss://openspeech.bytedance.com/api/v3/sauc/bigmodel",
|
||||
"appId": "app-123",
|
||||
"resourceId": "volc.bigasr.sauc.duration",
|
||||
"uid": "caller-1",
|
||||
"requestParams": {
|
||||
"end_window_size": 800,
|
||||
"force_to_speech_time": 1000,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_backend_mode_disabled_uses_local_assistant_config_even_with_url(monkeypatch, tmp_path):
|
||||
class _FailIfCalledClientSession:
|
||||
|
||||
Reference in New Issue
Block a user