-
Notifications
You must be signed in to change notification settings - Fork 1
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
Deepgram streaming #101
Deepgram streaming #101
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
✅ Deploy Preview for openduck canceled.
|
self.dg_connection = deepgram.listen.live.v("1") | ||
options = LiveOptions( | ||
model="nova-2", | ||
punctuate=True, | ||
language="en-US", | ||
encoding="linear16", | ||
channels=1, | ||
sample_rate=WS_SAMPLE_RATE, | ||
interim_results=True, | ||
utterance_end_ms="1000", | ||
vad_events=True, | ||
) | ||
|
||
self.dg_connection.on( | ||
LiveTranscriptionEvents.Transcript, | ||
lambda x, result, **kwargs: self.on_message(result), | ||
) | ||
self.dg_connection.start(options) |
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.
Let's put this inside if ASR_METHOD == "deepgram":
@@ -483,3 +504,9 @@ async def speak_response( | |||
audio=np.frombuffer(audio_chunk_bytes, dtype=np.int16), | |||
latency=t_styletts - t_normalize, | |||
) | |||
|
|||
def on_message(self, result): |
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.
Call it on_deepgram_message
or on_streaming_asr_message
?
@@ -279,7 +279,7 @@ async def connect_daily( | |||
session_id=session_id, | |||
record=record, | |||
input_audio_format="int16", | |||
tts_config=TTSConfig(provider="elevenlabs", voice_id=voice_id), | |||
tts_config=TTSConfig(provider="local", voice_id=voice_id), |
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.
can we revert the changes in this file before merging? in prod it's nice to have recording and 11 labs voice for now
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.
ya
@@ -271,6 +288,9 @@ async def interrupt(self, task: asyncio.Task): | |||
self.is_responding = False | |||
|
|||
async def receive_audio(self, message: bytes): | |||
|
|||
self.dg_connection.send(message) |
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.
Same thing here, should gate on ASR_METHOD == "deepgram"
User description
attempting to be backwards compatible with whisper.
when ASR_METHOD == "deepgram", deepgram keeps track of the transcription as it goes in
self.transcription
, which is used in start_response().Next, I think deepgram has VAD functionality, so we can get rid of silero vad and call start_response() once deepgram has a transcript ready.
Description
ResponseAgent
class, replacing the previous static transcription setup.transcript
attribute toResponseAgent
to store the ongoing transcription result from Deepgram.transcript
attribute accordingly.receive_audio
method to send audio data to Deepgram's live transcription service.start_response
method to use the live transcription result when Deepgram is selected as the ASR method.connect_daily
function to not record by default.connect_daily
function.Changes walkthrough
response_agent.py
Integrate Deepgram Live Transcription
openduck-py/openduck_py/response_agent.py
PrerecordedOptions
andFileSource
withLiveTranscriptionEvents
andLiveOptions
for DeepgramClient.ASR_METHOD
.transcript
attribute to store ongoing transcription.receive_audio
method to send audio data to Deepgram livetranscription.
start_response
to use the storedtranscript
whenASR_METHOD
is set to "deepgram".
on_message
method to handle live transcription events and updatethe
transcript
.voice.py
Update Voice Router Configuration Defaults
openduck-py/openduck_py/routers/voice.py
record
fromTrue
toFalse
inconnect_daily
function.TTSConfig
provider from "elevenlabs" to "local" inconnect_daily
function.💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.