feat: ship chats.stream_chat() with SSE support#12
Closed
rodnnnney wants to merge 1 commit into
Closed
Conversation
The registry spec labels the stream endpoint application/x-ndjson, which
Speakeasy skips during codegen (jsonlResponses is enterprise-tier) - the
method was documented but never generated. The endpoint is served by demo2's
platform v2 SSE handler emitting {result: Cell} / {error: Status} envelopes.
Map the operation to chats.streamChat and normalize the response to the SSE
envelope contract; regenerate. stream_chat() / stream_chat_async() now return
EventStream[StreamChatEvent]. The overlay normalization becomes a harmless
no-op once demo2 (TextQLLabs/demo2#13014) publishes the SSE spec at the
source.
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
stream_chathad the same gap as the TypeScript SDK: the overlay mapped it, the docs documented it, but Speakeasy silently skipped the operation during codegen — the registry spec labels the stream responseapplication/x-ndjson, and JSONL/NDJSON stream generation (jsonlResponses) is gated to Speakeasy's enterprise tier. SSE generation works on the current tier.The endpoint is served by demo2's platform v2 handler (TextQLLabs/demo2#13014), which emits Server-Sent Events of
{result: Cell}/{error: Status}envelopes.Changes
chats.streamChat(name-mapping mirrored from the TS SDK) and normalizes the stream response to the SSE envelope contract — robust against any current registry snapshot; becomes a harmless no-op once demo2 publishes the SSE spec at the source.chats.stream_chat()/stream_chat_async()returningEventStream[StreamChatEvent]with typeddata.result: Cell/data.error: Status.Usage
Cross-repo context
Merge order: this can merge independently (the overlay normalizes the old spec), but the endpoint only speaks SSE once the demo2 PR deploys — until then the generated method targets the new contract.