fix/issue-3955 : add text modality to live streaming#382
Open
morganroux wants to merge 5 commits intogoogle:mainfrom
Open
fix/issue-3955 : add text modality to live streaming#382morganroux wants to merge 5 commits intogoogle:mainfrom
morganroux wants to merge 5 commits intogoogle:mainfrom
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Author
|
Hello, I've fixed the existing issue in what I feel is the best approach, but I'm very much open to any suggestions or improvements on this PR. |
|
probably has some overlap with my PR :) |
|
the text streaming of responses can still be toggled even if live streaming, that has nothing to do with the transport |
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.
Fix: add text modality to live streaming
Summary
Implements a new Live Streaming toggle feature that enables real-time text communication through WebSocket connections as an alternative to Server-Sent Events (SSE). This feature provides users with toggle control between SSE and Live Streaming modes for text-based chat.
Messages are handled the same way as SSE events to provide a uniform user experience
Motivation
This PR adresses adk-python issue #3955 / adk-web issues/383 by adding support for bidirectional text streaming using WebSockets, complementing the existing audio and video live streaming capabilities. This enables more efficient real-time text communication compared to the existing SSE implementation.
Changes
🎨 UI/UX Changes
chat.component.html:211-222)liveStreamingLabel: 'Live Streaming'🏗️ Architecture Changes
StreamChatServiceto support audio/video/text streaming/run_liveendpoint withappName,userId, andsessionIdparameters🔧 Core Implementation
Feature Flag Service (
feature-flag.service.ts:78-80)isLiveStreamingEnabled()method (enabled by default)Stream Chat Service (
stream-chat.service.ts)startTextStreaming(): Establishes WebSocket connectionstopTextStreaming(): Cleanly closes connectionsendTextMessage(): Sends messages in LiveRequest formatgetTextMessages(): Returns observable stream for componentsChat Component (
chat.component.ts)toggleLiveStreaming(): Manages connection lifecycle and message subscriptionssendMessage(): Early return for Live Streaming mode (lines 532-541)toggleSse(): Disables Live Streaming when SSE is enabledcombineTextParts,processPart, etc.)🧪 Testing
chat.component.spec.ts(138 new test lines)MockFeatureFlagServiceandMockStreamChatServicestream-chat.service.spec.tsfor text streaming methodsHow to manually test this fix
gemini-2.5-flash-native-audio-preview-12-2025closes: #383
closes: google/adk-python#3955