Skip to content

🪲 BUG-#17: Stream via SSE for custom response_paths configs - #45

Merged
FernandoCelmer merged 3 commits into
masterfrom
feature/17
Aug 15, 2026
Merged

🪲 BUG-#17: Stream via SSE for custom response_paths configs#45
FernandoCelmer merged 3 commits into
masterfrom
feature/17

Conversation

@FernandoCelmer

@FernandoCelmer FernandoCelmer commented Aug 15, 2026

Copy link
Copy Markdown
Member

Description

Fixes GenericProvider silently falling back to a blocking (non-streaming) request when a custom response_paths config was active. Introduces supports_openai_sse (derived from response_shape != "anthropic") so the streaming gate is based on the actual SSE envelope shape, not on whether a custom response_paths mapping is configured.

Motivation and Context

Closes #17. Only the non-streaming response JSON key paths differ for custom response_paths configs — 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

  • Bug fix

Checklist

  • Self-review done
  • Tests added
  • CHANGELOG updated
  • Docs updated

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 FernandoCelmer left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@FernandoCelmer FernandoCelmer added the bug Something isn't working label Aug 15, 2026
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.
@FernandoCelmer
FernandoCelmer merged commit 0d5c414 into master Aug 15, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

1 participant