Skip to content

Commit a46c6d8

Browse files
committed
Avoid emitting empty ASR config
When no STT vendor is configured, stop serializing an empty asr object. This prevents the generated Asr model from defaulting the vendor back to ares and keeps ASR fallback behavior owned by the API.
1 parent 9241432 commit a46c6d8

3 files changed

Lines changed: 3 additions & 5 deletions

File tree

src/agora_agent/agentkit/agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1041,7 +1041,7 @@ def to_properties(
10411041
allow_missing_tts = "tts" in allow_missing_categories
10421042

10431043
turn_detection_config = self._resolve_turn_detection_config()
1044-
if not skip_asr_validation and (self._stt is not None or not allow_missing_asr):
1044+
if not skip_asr_validation and self._stt is not None:
10451045
base_kwargs["asr"] = self._resolve_asr_config(turn_detection_config)
10461046
base_kwargs["turn_detection"] = turn_detection_config
10471047

tests/custom/test_request_body.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -349,9 +349,7 @@ def test_session_start_properties_without_stt_does_not_inject_default_asr_vendor
349349

350350
props = build_properties(agent, allow_missing={"asr"})
351351

352-
assert props["asr"] == {
353-
"language": "zh-CN",
354-
}
352+
assert "asr" not in props
355353
assert props["turn_detection"] == {"language": "zh-CN"}
356354

357355

tests/custom/test_stt_language.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def test_invalid_turn_detection_language_is_rejected() -> None:
8181
def test_default_turn_detection_language_is_sent_without_stt() -> None:
8282
props = properties(base_agent())
8383

84-
assert props["asr"] == {"language": "en-US"}
84+
assert "asr" not in props
8585
assert props["turn_detection"] == {"language": "en-US"}
8686

8787

0 commit comments

Comments
 (0)