Commit 42462de
committed
fix(streaming): merge tool_call deltas by logical index, not physical position
Fixes accumulate_delta treating the \"index\" field as a physical list
position. Servers using speculative decoding (e.g. vLLM) can emit two
entries with the same logical index in a single chunk. The old code
stored both and later merged subsequent deltas only into acc_value[0],
leaving the second duplicate stranded with an incomplete arguments string.
The fix builds a logical-index-to-physical-position map over acc_value
and uses it for all lookups, so entries are always matched by their
\"index\" field regardless of how many duplicates arrived in earlier chunks.1 parent 658be64 commit 42462de
1 file changed
Lines changed: 23 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
40 | 54 | | |
41 | 55 | | |
42 | 56 | | |
| |||
49 | 63 | | |
50 | 64 | | |
51 | 65 | | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
57 | 70 | | |
58 | 71 | | |
59 | | - | |
60 | | - | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
61 | 77 | | |
62 | 78 | | |
63 | 79 | | |
| |||
0 commit comments