NeoGraph 0.10.0
A C++17 Graph Agent Engine Library โ€” LangGraph for C++
Loading...
Searching...
No Matches
sse_parser.h File Reference

Incremental Server-Sent Events parser. More...

#include <neograph/api.h>
#include <string>
#include <string_view>
#include <vector>
Include dependency graph for sse_parser.h:

Go to the source code of this file.

Detailed Description

Incremental Server-Sent Events parser.

Stage 3 / Semester 1.4 โ€” decodes the SSE wire format that OpenAI's /v1/chat/completions and Anthropic's /v1/messages stream over HTTP/1.1 chunked transport.

Pure state machine: bytes in (feed), complete events out (drain). The caller pairs this with a transport that delivers byte chunks (typically async_post_stream), since one HTTP chunk may contain partial, whole, or multiple SSE events.

Not supported on purpose (per SSE spec ยง9 we skip the bits LLM providers don't emit):

  • retry field โ†’ we don't auto-reconnect.
  • BOM detection on first byte.
  • Unicode line separator U+2028/U+2029.

What's included is exactly what the two provider streams use.

Definition in file sse_parser.h.