🪲 BUG-#17: Stream via SSE for custom response_paths configs - #45
Merged
Conversation
GenericProvider only used SSE streaming when the default OpenAI parser was active, so any config with response_paths silently fell back to a blocking, non-streaming request even though the wire format (OpenAI-style delta chunks) is unchanged. response_shape: "anthropic" is a genuinely different SSE envelope _stream() doesn't understand, so it still skips streaming and does one buffered on_delta call. Closes #17
FernandoCelmer
commented
Aug 15, 2026
FernandoCelmer
left a comment
Member
Author
There was a problem hiding this comment.
Clean, focused change. Renaming the gate from _uses_default_parser to _supports_openai_sse accurately captures the invariant being tested: it is the SSE envelope shape that determines whether _stream() can parse the response, not whether a custom response_paths mapping is present. Deriving supports_openai_sse = response_shape != 'anthropic' in _build_from_json is the correct place for this decision. The two new tests cover both the happy path (custom response_paths still streams) and the fallback path (Anthropic shape buffers into a single on_delta call). No issues found.
Resolved the generic.py conflict between #28 (per-call _ConnectionSnapshot + lock around complete()/reload()) and #17 (supports_openai_sse gating the streaming path): reload() keeps the lock; the SSE gate now reads config.supports_openai_sse instead of the removed uses_default_parser, and that field was folded into _ConnectionSnapshot/_snapshot_locked so it's read consistently with the rest of the per-call config instead of off self.
Merged
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.
Description
Fixes
GenericProvidersilently falling back to a blocking (non-streaming) request when a customresponse_pathsconfig was active. Introducessupports_openai_sse(derived fromresponse_shape != "anthropic") so the streaming gate is based on the actual SSE envelope shape, not on whether a customresponse_pathsmapping is configured.Motivation and Context
Closes #17. Only the non-streaming response JSON key paths differ for custom
response_pathsconfigs — the SSE wire format is identical to the default.response_shape: "anthropic"genuinely uses a different SSE envelope_stream()cannot parse, so it still falls back correctly.Types of changes
Checklist