feat: SSE overload support - non-generated code changes#422
Draft
Nelson-PROIA wants to merge 1 commit intomainfrom
Draft
feat: SSE overload support - non-generated code changes#422Nelson-PROIA wants to merge 1 commit intomainfrom
Nelson-PROIA wants to merge 1 commit intomainfrom
Conversation
… on complete methods) Update custom code regions, examples, and tests to use the new `complete(stream=True)` pattern alongside the existing dedicated `stream()` methods. Custom code regions (preserved by Speakeasy across regenerations): - chat.py: parse/parse_async now call complete(stream=False) with assert isinstance; parse_stream/parse_stream_async now call complete(stream=True) instead of stream() - conversations.py: run_async uses start_async(stream=False/True) and append_async(stream=False/True) instead of separate stream methods Examples (not generated): - All streaming examples updated to use complete(stream=True) pattern Tests (not generated): - Integration tests: use complete(stream=True) instead of stream() - Parity tests: add accept_header_override param, add stream/stream_async to known public methods, remove redundant stream-only test methods Note: Speakeasy-generated code is NOT included in this commit. The SDK was locally regenerated with specs that add text/event-stream as an alternative response on non-streaming operations (SSE overload pattern). Once the specs are published, the GitHub Actions workflow will regenerate the SDK code automatically.
6b4143b to
a7fcbd8
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
Adapts non-generated code (examples, tests, custom code regions) for the Speakeasy SSE overload pattern, enabling
complete(stream=True)as an alternative to dedicated.stream()methods.complete(stream=True)/complete_async(stream=True)instead of.stream()/.stream_async()chat.py,conversations.py): Updatedparse_stream,parse_stream_async,run_async,run_stream_asyncto use the overload patternaccept_header_overrideparam expectationForward compatibility
Both patterns coexist intentionally:
client.chat.stream(...)— existing dedicated method (backward compatible)client.chat.complete(stream=True)— new overload patternThe dedicated
.stream()/.stream_async()methods are planned for removal in the next major version.CI status
CI failures are expected. These changes depend on the SDK being regenerated with the SSE overload OpenAPI specs. Once the specs are published and Speakeasy CI regenerates the SDK, this PR should be marked ready for review.
Tested locally with regenerated SDK. All tests pass (pytest, mypy, pyright, ruff).