feat(realtime): default to passthrough when no initial prompt is provided#32
Merged
AdirAmsalem merged 1 commit intomainfrom Feb 25, 2026
Merged
Conversation
eed4a23 to
78fc2c4
Compare
…ided Port JS SDK PR #93 to Python SDK. When connecting without an initial prompt or image, send a passthrough set_image message (null image_data + null prompt) so the server receives an explicit initial state. Changes: - Add passthrough branch in connect() for when neither initial_image nor initial_prompt is provided (skipped in subscribe mode) - Add _send_passthrough_and_wait() method - Use exclude_unset serialization for SetAvatarImageMessage so explicitly-passed None values serialize as JSON null - Fix pre-existing bug: _handle_error now resolves pending Phase-2 waits (image/prompt) so server errors fail fast instead of timing out - Add 6 tests covering passthrough, subscribe skip, and fail-fast error handling for all Phase-2 paths
78fc2c4 to
cc04baa
Compare
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.
Summary
Port of JS SDK PR #93 to the Python SDK. When connecting without an initial prompt or image, the client now sends an explicit passthrough message to the server instead of skipping the initial state entirely.
Changes
elif local_track is not Nonebranch inconnect()sendsSetAvatarImageMessage(image_data=None, prompt=None)when neitherinitial_imagenorinitial_promptis provided. Subscribe mode (no local track) naturally skips this.message_to_jsonusesexclude_unset=TrueforSetAvatarImageMessageso explicitly-passedNonevalues serialize as JSONnull(other messages unchanged)._handle_errornow resolves any pending Phase-2 waits (image set / prompt) with the real error message, so server errors surface immediately instead of causing a 30s timeout.Tests
6 new tests (35 total, all passing):
test_connect_without_initial_state_sends_passthroughtest_passthrough_sends_set_image_with_null_prompttest_subscribe_mode_skips_passthroughtest_server_error_during_passthrough_fails_fasttest_server_error_during_initial_image_fails_fasttest_server_error_during_initial_prompt_fails_fast