Commit 35df77f
committed
docs(stdlib): fix example for delta semantics and note validator latency
Two documentation fixes following the per-chunk semantics correction:
- streaming_chunking.py: MaxSentencesReq previously counted sentence-end
punctuation in the chunk, which worked under the old accumulated-text
behaviour but returns at most 1 per sentence under delta semantics.
Rewritten to increment self._count once per chunk -- the canonical
pattern for a requirement that needs context beyond a single chunk.
- stream_with_chunking docstring: add a Note that chunks are emitted to
the consumer only after every active validator returns for that chunk.
A slow stream_validate (e.g. an LLM-based one) therefore adds latency
to every chunk. The invariant preserved is that the consumer never
sees unvalidated content; a concurrent-emission fast path may be added
in future if a concrete use case calls for it.
Assisted-by: Claude Code1 parent ea6bdb0 commit 35df77f
2 files changed
Lines changed: 22 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
27 | 33 | | |
28 | 34 | | |
29 | 35 | | |
| |||
35 | 41 | | |
36 | 42 | | |
37 | 43 | | |
38 | | - | |
39 | | - | |
| 44 | + | |
| 45 | + | |
40 | 46 | | |
41 | 47 | | |
42 | 48 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
247 | 247 | | |
248 | 248 | | |
249 | 249 | | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
250 | 263 | | |
251 | 264 | | |
252 | 265 | | |
| |||
0 commit comments