Skip to content

Conversation

@fern-support
Copy link
Collaborator

@fern-support fern-support commented Sep 27, 2025

Slack thread: https://buildwithfern.slack.com/archives/C05KKD1P8BG/p1751913443809909

  • Fixes dropped threads due to bad json handling by httpx.Response.iter_lines() - uses httpx.Response.iter_bytes() instead
  • Added handling for empty events and [DONE] events
  • Improved error logging when parsing of SSE events fail

This PR introduces a forked and fixed version of httpx_sse to handle multi-line SSE data fields properly. It consolidates all httpx_sse functionality into a single file.

  • Added a new module http_sse.py that includes classes and functions for handling Server-Sent Events (SSE).
  • Replaced the use of httpx_sse with the new EventSource class from http_sse in raw_client.py.
  • Updated the event handling logic in raw_client.py to skip empty events and handle the [DONE] token from OpenAI-style APIs.
  • Added error handling for JSON decoding and parsing errors in raw_client.py.

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.

3 participants