Skip to content

feat: parse SSE streaming responses for response plugins#153

Closed
Mohammad-nassar10 wants to merge 1 commit into
llm-d:mainfrom
ms-llmd:pr-138
Closed

feat: parse SSE streaming responses for response plugins#153
Mohammad-nassar10 wants to merge 1 commit into
llm-d:mainfrom
ms-llmd:pr-138

Conversation

@Mohammad-nassar10

Copy link
Copy Markdown
Contributor

When the response body is not valid JSON (e.g., SSE/Server-Sent Events from streaming providers like Anthropic), parse the SSE data lines to extract usage and model information. This enables response plugins (usage-tracking, metering) to process streaming responses that were previously skipped with "Failed to parse response body as JSON".

Also fixes two issues with streaming response handling:

  1. Always respond to response headers so Envoy proceeds with body chunks (previously returned nil, causing per-message timeout)
  2. Send an immediate ack for each non-EoS response body chunk so Envoy continues forwarding subsequent chunks instead of blocking

What type of PR is this?

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes #

Release note (write NONE if no user-facing change):

NONE

When the response body is not valid JSON (e.g., SSE/Server-Sent Events
from streaming providers like Anthropic), parse the SSE data lines to
extract usage and model information. This enables response plugins
(usage-tracking, metering) to process streaming responses that were
previously skipped with "Failed to parse response body as JSON".

Also fixes two issues with streaming response handling:
1. Always respond to response headers so Envoy proceeds with body
   chunks (previously returned nil, causing per-message timeout)
2. Send an immediate ack for each non-EoS response body chunk so
   Envoy continues forwarding subsequent chunks instead of blocking

Signed-off-by: Noy Itzikowitz <nitzikow@redhat.com>
@github-actions github-actions Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jun 2, 2026
@mergify

mergify Bot commented Jun 2, 2026

Copy link
Copy Markdown

⚠️ The sha of the head commit of this PR conflicts with #138. Mergify cannot evaluate rules on this PR. Once #138 is merged or closed, Mergify will resume processing this PR. ⚠️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants