From 77fc34c8d2ffd83737bc16d94bab2be643b859fc Mon Sep 17 00:00:00 2001 From: grandcamel Date: Wed, 12 Aug 2026 15:03:28 -0500 Subject: [PATCH] docs(rest)+test(core): true live_transcribe call shape; drop stale ai_sidecar bypass MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit calling.md showed live_transcribe(call_id, action="start", lang="en"), but the generated signature takes action as a keyword-only TypedDict union ({"start": {...}} or the literal "stop") and has no lang/from_lang /to_lang parameters — copying the documented call raises TypeError. The examples now show the real shape, with the start parameters inside the action object where the schema defines them. The sidecar pattern test appended ai_sidecar to the raw document with a comment that the verb was not in the live SWML schema yet. It landed in 4645d48, so the test now uses add_verb_to_section directly — the path the comment promised, and stronger, since the verb goes through schema validation instead of around it. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01MgA3KeCEPMKMJVvroZY1wV --- rest/docs/calling.md | 8 ++++++-- tests/unit/core/test_swml_service_swaig.py | 9 +++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/rest/docs/calling.md b/rest/docs/calling.md index 903c3bc7..16a89924 100644 --- a/rest/docs/calling.md +++ b/rest/docs/calling.md @@ -208,9 +208,13 @@ client.calling.ai_stop(call_id, control_id="ai-1") ## Live Transcribe & Translate +`action` is an object keyed by the phase (`start`/`summarize`), with the phase's +parameters inside it — or the literal string `"stop"`: + ```python -client.calling.live_transcribe(call_id, action="start", lang="en") -client.calling.live_translate(call_id, action="start", from_lang="en", to_lang="es") +client.calling.live_transcribe(call_id, action={"start": {"lang": "en", "webhook": "https://example.com/transcripts"}}) +client.calling.live_transcribe(call_id, action="stop") +client.calling.live_translate(call_id, action={"start": {"from_lang": "en", "to_lang": "es"}}) ``` ## Fax diff --git a/tests/unit/core/test_swml_service_swaig.py b/tests/unit/core/test_swml_service_swaig.py index ba0ea9ee..5de231bf 100644 --- a/tests/unit/core/test_swml_service_swaig.py +++ b/tests/unit/core/test_swml_service_swaig.py @@ -243,13 +243,14 @@ def test_can_emit_ai_sidecar_verb(self) -> None: svc.add_section("main") ok = svc.add_verb_to_section("main", "answer", {}) assert ok - # ai_sidecar isn't in the live SWML schema yet — bypass via raw doc. - # Once the schema lands, callers will use add_verb_to_section directly. - svc._current_document["sections"]["main"].append({"ai_sidecar": { + # ai_sidecar landed in the bundled schema (4645d48), so the supported + # path works — and routes the verb through schema validation. + ok = svc.add_verb_to_section("main", "ai_sidecar", { "prompt": "real-time copilot", "lang": "en-US", "direction": ["remote-caller", "local-caller"], - }}) + }) + assert ok rendered = json.loads(svc.render_document()) verbs = [list(v.keys())[0] for v in rendered["sections"]["main"]] assert "answer" in verbs