Skip to content

Adding support to WebsocketTransport #1911

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 6 commits into from
Jun 6, 2025

Conversation

filipi87
Copy link
Contributor

@filipi87 filipi87 commented May 28, 2025

  • Fixes inside the ProtobufSerializer.
  • A Pipecat example demonstrating how to use WebsocketTransport

},
"dependencies": {
"@pipecat-ai/client-js": "^0.3.5",
"@pipecat-ai/realtime-websocket-transport": "^0.3.5",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I still need to publish a new version which will include the PipecatWebsocketTransport.
Right now I am using the version from this PR:

Copy link

codecov bot commented May 28, 2025

Codecov Report

Attention: Patch coverage is 22.22222% with 7 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/pipecat/serializers/protobuf.py 22.22% 7 Missing ⚠️
Files with missing lines Coverage Δ
src/pipecat/serializers/protobuf.py 79.71% <22.22%> (-8.82%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@filipi87 filipi87 changed the title A Pipecat example demonstrating how to use PipecatWebsocketTransport Adding support to PipecatWebsocketTransport May 29, 2025
@markbackman
Copy link
Contributor

In terms of organization for the examples, we already have a websocket-server example. Should this new example replace the current one?

@filipi87
Copy link
Contributor Author

In terms of organization for the examples, we already have a websocket-server example. Should this new example replace the current one?

@markbackman, I have removed the websocket-server example now, and changed this one, so when you execute the server you can choose what do you wish to use, 'fast_api' or 'websocket_server'.

WEBSOCKET_SERVER= # Options: 'fast_api' or 'websocket_server'

What do you think ?

@filipi87 filipi87 requested a review from markbackman May 29, 2025 20:56
@markbackman
Copy link
Contributor

WEBSOCKET_SERVER= # Options: 'fast_api' or 'websocket_server'

What do you think ?

This makes sense!

pipeline,
params=PipelineParams(
allow_interruptions=True,
observers=[RTVIObserver(rtvi)],
Copy link
Contributor

Choose a reason for hiding this comment

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

observers should be a PipelineTask param. It's deprecated as a PipelineParams param.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

),
)

@rtvi.event_handler("on_client_ready")
Copy link
Contributor

Choose a reason for hiding this comment

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

We do this for simple-chatbot:

        @rtvi.event_handler("on_client_ready")
        async def on_client_ready(rtvi):
            await rtvi.set_bot_ready()
            # Kick off the conversation
            await task.queue_frames([context_aggregator.user().get_context_frame()])

Does this make sense here too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

@@ -0,0 +1,110 @@
#
Copy link
Contributor

@markbackman markbackman May 30, 2025

Choose a reason for hiding this comment

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

Same comments as the bot_fast_api.py example.

  • observer
  • on_client_ready
  • GeminiMultimodalLiveLLMService args

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

llm = GeminiMultimodalLiveLLMService(
api_key=os.getenv("GOOGLE_API_KEY"),
voice_id="Puck", # Aoede, Charon, Fenrir, Kore, Puck
transcribe_user_audio=True,
Copy link
Contributor

Choose a reason for hiding this comment

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

This now happens automatically.

Suggested change
transcribe_user_audio=True,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

api_key=os.getenv("GOOGLE_API_KEY"),
voice_id="Puck", # Aoede, Charon, Fenrir, Kore, Puck
transcribe_user_audio=True,
transcribe_model_audio=True,
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here.

Suggested change
transcribe_model_audio=True,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

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.

Looks really good! Just a few comments, but overall this is really nice to have.

@filipi87 filipi87 changed the title Adding support to PipecatWebsocketTransport Adding support to WebsocketTransport Jun 6, 2025
@filipi87 filipi87 force-pushed the filipi/websocket_transport_example branch from 689b501 to e9f041e Compare June 6, 2025 20:09
@filipi87
Copy link
Contributor Author

filipi87 commented Jun 6, 2025

Thank you for the review @markbackman 🎉

@filipi87 filipi87 merged commit c9575ea into main Jun 6, 2025
5 of 6 checks passed
@filipi87 filipi87 deleted the filipi/websocket_transport_example branch June 6, 2025 20:25
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.

2 participants