gate: streaming — the model's events relayed as they come, the fringe as the last block

Bamidbar 15:39 u'reitem oto — the fringe must be seen, so a streaming
client gets it too. With "stream": true the request is opened
asynchronously (Gate.Upstream.open_stream/4, httpc stream: :self) and
Gate.Stream relays every complete SSE event to the caller unchanged
while gathering the text deltas; the terminal events (Anthropic
message_delta + message_stop; OpenAI the finish_reason chunk + [DONE])
are held until the gathered text has been examined, then released
behind the fringe sent as one more text block, with the `bikoret` object
added to the terminal event the client already parses. No X-Bikoret-*
headers on a stream (they leave before the model speaks); no rebuke on a
stream (nothing streamed can be taken back — 422). An examination that
fails after the stream began is said in the trailer ("— bikoret: not
examined (…)"), never silent. One api_calls_external gathered before the
call, as for any pass. Tamid §1.1, Construction §3.10, KOHEN. Doorpost
40e7d7d1…. Elixir 612/0 (read before this commit).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Scott KarpandClaude Fable 5.1 committed 2026-10-15 15:23:44 +00:00
1 parent 33caedb240
commit a16617fffe
10 files changed
+517 -18

No files matched your search

+9 -3
View File
@@ -547,9 +547,15 @@ Headers:
**What the gate does with it** (`VavPipeline.Gate`):
1. Forwards the body unchanged (the `stream` flag is refused: 422 — a
fringe needs the whole garment). The upstream's status and body are
returned verbatim on any non-200.
1. Forwards the body unchanged. The upstream's status and body are
returned verbatim on any non-200. With `stream: true` the request is
opened asynchronously (`Gate.Upstream.open_stream/4`, OTP httpc
`stream: :self`) and `Gate.Stream` relays each complete SSE event to
the caller as it arrives, gathering the text deltas; the terminal
events (Anthropic `message_delta` + `message_stop`; OpenAI the
`finish_reason` chunk + `[DONE]`) are held until the examination has
run, then released behind the fringe block, the `bikoret` object
added to the terminal event. No rebuke on a stream.
2. Reads the reply's text (`content[].text` / `choices[0].message.content`)
and examines it: provenance from the upstream (`anthropic → claude`,
`openai → gpt`); **query** = the last user message's text; **sources**