feat(mllm): add ThunderPhone speech-to-speech extension - #2316
Open
kolchinski wants to merge 1 commit into
Open
kolchinski wants to merge 1 commit into
kolchinski wants to merge 1 commit into
Conversation
ThunderPhone's Realtime WebSocket API speaks the OpenAI Realtime protocol, so thunderphone_mllm_python mirrors openai_mllm_python and adds the ThunderPhone parts: endpoint and query parameters (saved agent, engine, language, phone numbers, wire audio, call events), sk_live_ keys, saved agents that bring their own prompt/voice/tools, one complete session.update for inline sessions (ThunderPhone freezes instructions and tools when the call starts), call.* events, and no reconnect after the platform ends the call.
Author
|
Checking in on this. The branch is still mergeable and the only red check is the repo's own claude-review job, which needs a maintainer-side secret rather than a change here. Happy to rebase or rework anything if there's feedback. |
Author
|
@wangyoucao577 @diyuyi-agora, could one of you take a look when you have a moment? You've handled the recent extension PRs (#2276, #2320), so you seemed like the right people. The workflows haven't run here yet since this is my first PR to the repo, so it also needs an approval to run CI. I've added the Type of Change and Testing sections to match #2320, and I can run |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
thunderphone_mllm_python: ThunderPhone voice agents as a speech-to-speech (MLLM) extension, alongsideopenai_mllm_python,gemini_mllm_python,azure_mllm_python,glm_mllm_pythonandstepfun_mllm_python.ThunderPhone's Realtime WebSocket API speaks the OpenAI Realtime protocol, so the extension mirrors
openai_mllm_python(samemllm-interface.json, same event mapping) and adds the ThunderPhone-specific parts:call_events) andsk_live_keys;agent_id): prompt, voice, engine, languages, tools and greeting live on ThunderPhone, the graph only moves audio;prompt,product,voice,language): graph tools are collected and sent in the singlesession.updatethat starts the call, because ThunderPhone freezes instructions, tools and voice at that point (the extension waits up to 500 ms for latetool_registers unless audio arrives first);call.*events (hang-up reason, transfer, keypad) are parsed and logged, andcall.endedstops the extension from reconnecting, since a reconnect would start a new, separately billed call.Also registers the extension in
examples/voice-assistant-realtime(manifest dependency + README provider list) and addsTHUNDERPHONE_API_KEY/THUNDERPHONE_AGENT_IDto.env.example.Validation
tests/test_realtime.py(no credentials): 6 passed, covering the connect query, config validation, the inlinesession.update, and parsing of ThunderPhone'ssession.created, GAconversation.item.addedandcall.*events.tests/test_extension.py: a credential-free load test throughAsyncExtensionTester, plus a live session-ready test whenTHUNDERPHONE_API_KEYis set.ThunderPhoneRealtimeExtensiondirectly (base class stubbed to record emits): saved-agent greeting → caller transcript → reply → hang-up (call.ended, no reconnect); inline session with a graph tool →mllm_server_function_call→function_call_output→ reply using the tool result → hang-up.Type of Change
Testing
tests/test_realtime.pyneeds no TEN runtime and passes locally.tests/test_extension.pyruns throughAsyncExtensionTester, which needs theten_agent_builddev container; I haven't run it there yet and can if you'd like. No upstream CI result is claimed.Documentation
The extension README covers configuration, saved agents vs. inline sessions, graph wiring and test commands.
examples/voice-assistant-realtimelists the provider, and.env.examplehas the two ThunderPhone variables.Breaking Changes
None. The extension is opt-in and doesn't change existing MLLM extensions or graphs.
Disclosure: I'm the founder of ThunderPhone.