Repository navigation
feat(voice): add GPT-Live 1.1 as a Realtime provider #434
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
ea703c5
feat(voice): add GPT-Live 1.1 as a Realtime provider
panuhorsmalahti 68f1dcb
fix(voice): gate GPT-Live tools on secure sign-in and fix its review …
panuhorsmalahti 4a4aaac
fix(voice): answer a silent recording and stop calling Live's silence…
panuhorsmalahti d26cf01
fix(voice): count only one stretch of speech as a narration
panuhorsmalahti File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,11 @@ | ||
| // @generated-modules-start | ||
| pub mod dictation; | ||
| pub mod get_realtime_provider; | ||
| pub mod model_audio; | ||
| pub mod openai_live; | ||
| pub mod openai_realtime; | ||
| pub mod realtime_provider; | ||
| pub mod room_readings; | ||
| pub mod voice_session; | ||
| pub mod voice_tools; | ||
| // @generated-modules-end |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| //! Audio between the rate a transport speaks and the 24 kHz a voice model speaks. | ||
| //! | ||
| //! A browser on a virtual audio device speaks 48 kHz; a transport that already speaks | ||
| //! the model's 24 kHz makes both directions identity. | ||
|
|
||
| use parking_lot::Mutex; | ||
|
|
||
| use crate::services::meeting::resampler::{ | ||
| Downsampler, MEETING_SAMPLE_RATE, REALTIME_SAMPLE_RATE, Upsampler, | ||
| }; | ||
|
|
||
| pub struct ModelAudio { | ||
| /// Only `MEETING_SAMPLE_RATE` and `REALTIME_SAMPLE_RATE` are accepted: the resampler | ||
| /// is a fixed 2:1 decimation, so any other rate would need a converter that is not | ||
| /// here, and silently accepting it would change pitch rather than fail. | ||
| passthrough: bool, | ||
| downsampler: Mutex<Downsampler>, | ||
| upsampler: Mutex<Upsampler>, | ||
| } | ||
|
|
||
| impl ModelAudio { | ||
| /// Fails with `A voice conversation speaks 48000 or 24000 Hz, not {rate}` for any | ||
| /// other rate. | ||
| pub fn new(rate: u32) -> anyhow::Result<Self> { | ||
| if rate != MEETING_SAMPLE_RATE && rate != REALTIME_SAMPLE_RATE { | ||
| anyhow::bail!( | ||
| "A voice conversation speaks {} or {} Hz, not {}", | ||
| MEETING_SAMPLE_RATE, | ||
| REALTIME_SAMPLE_RATE, | ||
| rate | ||
| ); | ||
| } | ||
| Ok(Self { | ||
| passthrough: rate == REALTIME_SAMPLE_RATE, | ||
| downsampler: Mutex::new(Downsampler::new()), | ||
| upsampler: Mutex::new(Upsampler::new()), | ||
| }) | ||
| } | ||
|
|
||
| /// Captured audio on its way to the model. | ||
| pub fn to_model(&self, pcm: &[u8]) -> Vec<u8> { | ||
| if self.passthrough { | ||
| pcm.to_vec() | ||
| } else { | ||
| self.downsampler.lock().process(pcm) | ||
| } | ||
| } | ||
|
|
||
| /// Model speech on its way to playback. | ||
| #[allow(clippy::wrong_self_convention)] // Read as "audio from the model". | ||
| pub fn from_model(&self, pcm24k: &[u8]) -> Vec<u8> { | ||
| if self.passthrough { | ||
| pcm24k.to_vec() | ||
| } else { | ||
| self.upsampler.lock().process(pcm24k) | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left open for the PR owner. The web suite's mock voice server speaks only Realtime frames. An
openai-liveconfiguration needs a second mock for the Live protocol (session.start,response.eventdelegations,session.thinking.append) and another runtime boot, which is a sizeable e2e addition. The Live protocol paths in this PR (tool runs, held items, the summary, narration replay, the sign-in refusal) have unit tests against a local WebSocket server, with frames shaped like the ones a realgpt-live-1.1session sent.