Commit 6ee2618
committed
[ML] Refactor SSE Parsing (elastic#125959)
ServerSentEvent is now a record with `event` and `data`, rather than
it being a record for value with a separate `ServerSentEventField`.
- `value` was renamed to `data`
- `hasValue` was renamed to `hasData`
- Parsing was refactored to read more like its spec: writing to a buffer
and flushing when we reach a blank newline
- We now support multiline data payloads1 parent 49601ae commit 6ee2618
File tree
15 files changed
+209
-158
lines changed- x-pack/plugin/inference
- qa/inference-service-tests/src/javaRestTest/java/org/elasticsearch/xpack/inference
- src
- internalClusterTest/java/org/elasticsearch/xpack/inference/rest
- main/java/org/elasticsearch/xpack/inference
- common
- external
- anthropic
- googleaistudio
- openai
- response/streaming
- test/java/org/elasticsearch/xpack/inference
- external
- openai
- response/streaming
- services/anthropic
15 files changed
+209
-158
lines changedLines changed: 12 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
299 | 299 | | |
300 | 300 | | |
301 | 301 | | |
302 | | - | |
| 302 | + | |
303 | 303 | | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | | - | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | | - | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
313 | 309 | | |
314 | 310 | | |
315 | 311 | | |
| |||
331 | 327 | | |
332 | 328 | | |
333 | 329 | | |
334 | | - | |
| 330 | + | |
335 | 331 | | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | | - | |
| 332 | + | |
| 333 | + | |
340 | 334 | | |
341 | 335 | | |
342 | 336 | | |
| |||
359 | 353 | | |
360 | 354 | | |
361 | 355 | | |
362 | | - | |
| 356 | + | |
363 | 357 | | |
364 | | - | |
365 | | - | |
366 | | - | |
367 | | - | |
| 358 | + | |
| 359 | + | |
368 | 360 | | |
369 | 361 | | |
370 | 362 | | |
| |||
Lines changed: 2 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
55 | 54 | | |
56 | 55 | | |
57 | 56 | | |
| |||
364 | 363 | | |
365 | 364 | | |
366 | 365 | | |
367 | | - | |
368 | | - | |
369 | | - | |
| 366 | + | |
| 367 | + | |
370 | 368 | | |
371 | 369 | | |
372 | 370 | | |
| |||
Lines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | 14 | | |
16 | 15 | | |
17 | 16 | | |
| |||
40 | 39 | | |
41 | 40 | | |
42 | 41 | | |
43 | | - | |
| 42 | + | |
44 | 43 | | |
45 | 44 | | |
46 | 45 | | |
| |||
Lines changed: 2 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | 21 | | |
23 | 22 | | |
24 | 23 | | |
| |||
42 | 41 | | |
43 | 42 | | |
44 | 43 | | |
45 | | - | |
46 | | - | |
| 44 | + | |
| 45 | + | |
47 | 46 | | |
48 | 47 | | |
49 | 48 | | |
| |||
Lines changed: 2 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | 21 | | |
23 | 22 | | |
24 | 23 | | |
| |||
37 | 36 | | |
38 | 37 | | |
39 | 38 | | |
40 | | - | |
41 | | - | |
| 39 | + | |
| 40 | + | |
42 | 41 | | |
43 | 42 | | |
44 | 43 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
127 | | - | |
| 127 | + | |
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
131 | | - | |
| 131 | + | |
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
| |||
Lines changed: 6 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | 22 | | |
24 | 23 | | |
25 | 24 | | |
| |||
62 | 61 | | |
63 | 62 | | |
64 | 63 | | |
65 | | - | |
66 | 64 | | |
67 | 65 | | |
68 | 66 | | |
| |||
83 | 81 | | |
84 | 82 | | |
85 | 83 | | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
93 | 87 | | |
94 | 88 | | |
95 | 89 | | |
96 | 90 | | |
97 | 91 | | |
98 | | - | |
| 92 | + | |
99 | 93 | | |
100 | 94 | | |
101 | 95 | | |
| |||
118 | 112 | | |
119 | 113 | | |
120 | 114 | | |
121 | | - | |
| 115 | + | |
122 | 116 | | |
123 | 117 | | |
124 | 118 | | |
125 | | - | |
| 119 | + | |
126 | 120 | | |
127 | 121 | | |
128 | 122 | | |
| |||
Lines changed: 13 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | | - | |
14 | 12 | | |
15 | | - | |
| 13 | + | |
16 | 14 | | |
17 | 15 | | |
| 16 | + | |
18 | 17 | | |
19 | | - | |
20 | | - | |
| 18 | + | |
| 19 | + | |
21 | 20 | | |
22 | 21 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
| 22 | + | |
| 23 | + | |
27 | 24 | | |
28 | 25 | | |
29 | | - | |
30 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
31 | 33 | | |
32 | 34 | | |
Lines changed: 0 additions & 38 deletions
This file was deleted.
0 commit comments