Skip to content

feat: SSE overload support - non-generated code changes#422

Draft
Nelson-PROIA wants to merge 1 commit intomainfrom
nelson.proia/sse-overload-v2
Draft

feat: SSE overload support - non-generated code changes#422
Nelson-PROIA wants to merge 1 commit intomainfrom
nelson.proia/sse-overload-v2

Conversation

@Nelson-PROIA
Copy link
Contributor

@Nelson-PROIA Nelson-PROIA commented Mar 12, 2026

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.

  • Examples: Updated all streaming examples to use complete(stream=True) / complete_async(stream=True) instead of .stream() / .stream_async()
  • Custom code regions (in chat.py, conversations.py): Updated parse_stream, parse_stream_async, run_async, run_stream_async to use the overload pattern
  • Parity tests (Azure, GCP): Added accept_header_override param expectation
  • Integration tests (Azure, GCP): Updated streaming tests to use overload pattern

Forward compatibility

Both patterns coexist intentionally:

  • client.chat.stream(...) — existing dedicated method (backward compatible)
  • client.chat.complete(stream=True) — new overload pattern

The 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).

@Nelson-PROIA Nelson-PROIA marked this pull request as draft March 12, 2026 12:01
… 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.
@Nelson-PROIA Nelson-PROIA force-pushed the nelson.proia/sse-overload-v2 branch from 6b4143b to a7fcbd8 Compare March 12, 2026 12:04
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.

1 participant