Skip to content
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

fixing [#868] bug where deepgram client fails due to langauge #869

Merged

Conversation

Vaibhav159
Copy link
Contributor

Description:
This PR fixes a bug in the DeepgramSTTService where the language parameter, defined as an enum, was causing a WebSocket connection failure during the pipeline initialization. The issue occurred because Deepgram's API expects the language parameter as a string, but an enum was being passed directly.

Changes Made:

  • Ensured the language parameter is converted from an enum to its string value (Language.EN.value) before being passed to the API.

@markbackman
Copy link
Contributor

Thanks for the proposed fix!

For whatever reason I can't repro this, but this does seem like the right thing to do.

One suggestion, since it's also possible to pass a string via live_options, let's add a check like this:

if hasattr(merged_options.language, "value"):
    merged_options.language = merged_options.language.value

This will allow either a string of an enum to be passed. With that, I think this change is ready.

@Vaibhav-Lodha
Copy link
Contributor

@markbackman this is up for review, lmk if there is any change required.

Copy link
Contributor

@markbackman markbackman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! This is great.

@Vaibhav-Lodha
Copy link
Contributor

@markbackman pushed once more change as per ruff, for some odd reason pycharm ruff didn't catch it 🤦

@markbackman
Copy link
Contributor

The linter wants it as:

# deepgram connection requires language to be a string
if isinstance(merged_options.language, Language) and hasattr(
    merged_options.language, "value"
):
    merged_options.language = merged_options.language.value

That is, one less tab before merged_options.language, "value".

@markbackman markbackman merged commit 9f7f74e into pipecat-ai:main Dec 17, 2024
4 checks passed
@jonnyjohnson1
Copy link

Had the same issue. This did the trick to make the deepgram client connect successfully, but it messed up the TTS audio (using elevenlabs) in the downstream frames.

@markbackman
Copy link
Contributor

@jonnyjohnson1 do you mind filing a separate issue for what you're seeing with ElevenLabs? Might it be that the TTS audio issue is unrelated and now that the STT error is resolved, the TTS error is revealed?

@jonnyjohnson1
Copy link

Possibly. I'll create an issue for it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants