Repository navigation
Commit b569e40
Judge a stream's speed on what it generates visibly (#133)
Fixes to how a stream's speed is judged against its provider's minimum:
- Counts the upstream reports are no longer used. Gemini's running
output count includes the thoughts it does not show; once it leaped
ahead of the text, the text counted for nothing and a fast stream
could be cut.
- Summarised reasoning is left out: Responses reasoning summaries,
Anthropic thinking blocks, Gemini thought parts and Bedrock reasoning
content arrive in bursts while the model reasons at full speed. No
second is judged while such a phase is open, and its time and text are
left out of the window after. Reasoning streamed as generated (Chat
reasoning_content, Responses reasoning_text) still counts.
- A long pause is a quarter of the window, at most 5 s, and no second is
judged whose last content is more than a second old: the burst an
upstream sends after holding tokens back is waited for.
- The answer's end is also seen by the format's last frame (Anthropic
message_stop, Chat [DONE], Responses response.completed), not only by
a stop reason.
- The upstream's connection is dropped at the cut, before the error
frame goes to the client.
- The affinity is dropped and the speed written to the log row only when
the stream's outcome is the cut.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>1 parent faa1ad5 commit b569e40
8 files changed
Lines changed: 550 additions & 146 deletions
File tree
- crates
- gateway/src
- lifecycle
- proxy
- test-support/tests
- db
- web/src/i18n
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
105 | 105 | | |
106 | 106 | | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
114 | 120 | | |
115 | 121 | | |
116 | 122 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
426 | 426 | | |
427 | 427 | | |
428 | 428 | | |
429 | | - | |
430 | | - | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
431 | 433 | | |
432 | 434 | | |
433 | 435 | | |
| |||
0 commit comments