@@ -431,6 +431,29 @@ def test_sse_err():
431431 pass
432432
433433
434+ def test_sse_pronunciation_dict (resources : _Resources ):
435+ logger .info ("Testing SSE with pronunciation_dict_id parameter" )
436+ client = resources .client
437+ transcript = SAMPLE_TRANSCRIPT
438+
439+ output_generate = client .tts .sse (
440+ transcript = transcript ,
441+ voice = {"mode" : "id" , "id" : SAMPLE_VOICE_ID },
442+ output_format = DEFAULT_OUTPUT_FORMAT_PARAMS ,
443+ model_id = DEFAULT_MODEL_ID ,
444+ pronunciation_dict_id = None , # Test with None to verify parameter acceptance
445+ )
446+
447+ chunks = []
448+ for response in output_generate :
449+ assert isinstance (response , WebSocketResponse_Chunk )
450+ audio_bytes = base64 .b64decode (response .data )
451+ chunks .append (audio_bytes )
452+
453+ data = b"" .join (chunks )
454+ _validate_audio_response (data , DEFAULT_OUTPUT_FORMAT_PARAMS )
455+
456+
434457@pytest .mark .parametrize ("output_format" , TEST_RAW_OUTPUT_FORMATS )
435458@pytest .mark .parametrize ("stream" , [True , False ])
436459def test_ws_sync (resources : _Resources , output_format : OutputFormatParams , stream : bool ):
@@ -584,6 +607,40 @@ async def test_ws_timestamps(use_original_timestamps: bool):
584607 await async_client .close ()
585608
586609
610+ @pytest .mark .asyncio
611+ async def test_ws_pronunciation_dict ():
612+ logger .info ("Testing WebSocket with pronunciation_dict_id parameter" )
613+ transcript = SAMPLE_TRANSCRIPT
614+
615+ async_client = create_async_client ()
616+ ws = await async_client .tts .websocket ()
617+
618+ # Test that pronunciation_dict_id parameter can be passed
619+ # Using None as we don't have a real pronunciation dict ID for testing
620+ output_generate = await ws .send (
621+ transcript = transcript ,
622+ voice = {"mode" : "id" , "id" : SAMPLE_VOICE_ID },
623+ output_format = DEFAULT_OUTPUT_FORMAT_PARAMS ,
624+ model_id = DEFAULT_MODEL_ID ,
625+ pronunciation_dict_id = None , # Test with None to verify parameter acceptance
626+ stream = True ,
627+ )
628+
629+ chunks = []
630+ async for out in output_generate :
631+ _validate_schema (out )
632+ if out .audio is not None :
633+ chunks .append (out .audio )
634+
635+ # Verify audio
636+ audio = b"" .join (chunks )
637+ _validate_audio_response (audio , DEFAULT_OUTPUT_FORMAT_PARAMS )
638+
639+ # Close the websocket
640+ await ws .close ()
641+ await async_client .close ()
642+
643+
587644def chunk_generator (transcripts ):
588645 for transcript in transcripts :
589646 if transcript .endswith (" " ):
@@ -1364,6 +1421,7 @@ def test_ws_phoneme_timestamps():
13641421 output_format = DEFAULT_OUTPUT_FORMAT_PARAMS ,
13651422 model_id = DEFAULT_MODEL_ID ,
13661423 add_phoneme_timestamps = True ,
1424+ add_timestamps = True , # workaround, currently you need both add_timestamps and add_phoneme_timestamps to get phoneme timestamps
13671425 stream = True ,
13681426 )
13691427 has_phoneme_timestamps = False
@@ -1407,6 +1465,7 @@ def test_continuation_phoneme_timestamps():
14071465 voice = {"mode" : "id" , "id" : SAMPLE_VOICE_ID },
14081466 output_format = DEFAULT_OUTPUT_FORMAT_PARAMS ,
14091467 add_phoneme_timestamps = True ,
1468+ add_timestamps = True , # workaround, currently you need both add_timestamps and add_phoneme_timestamps to get phoneme timestamps
14101469 )
14111470
14121471 has_phoneme_timestamps = False
@@ -1445,6 +1504,7 @@ async def test_ws_phoneme_timestamps_async():
14451504 output_format = DEFAULT_OUTPUT_FORMAT_PARAMS ,
14461505 model_id = DEFAULT_MODEL_ID ,
14471506 add_phoneme_timestamps = True ,
1507+ add_timestamps = True , # workaround, currently you need both add_timestamps and add_phoneme_timestamps to get phoneme timestamps
14481508 stream = True ,
14491509 )
14501510 has_phoneme_timestamps = False
@@ -1491,6 +1551,7 @@ async def test_continuation_phoneme_timestamps_async():
14911551 voice = {"mode" : "id" , "id" : SAMPLE_VOICE_ID },
14921552 output_format = DEFAULT_OUTPUT_FORMAT_PARAMS ,
14931553 add_phoneme_timestamps = True ,
1554+ add_timestamps = True , # workaround, currently you need both add_timestamps and add_phoneme_timestamps to get phoneme timestamps
14941555 continue_ = True ,
14951556 )
14961557
0 commit comments