Commit c2c3f3e
committed
fix: Address review feedback for configurable batch_size
Fixes for issues identified by Cursor bugbot:
1. Missing batch_size validation in embed method (Medium):
- Added validation to raise ValueError if batch_size < 1
- Applied to both sync and async embed methods
2. IndexError when using multiple embedding types with embed_stream (High):
- Fixed index calculation to use text position from parser
- Parser correctly tracks text index per embedding type
3. Fallback causes duplicate embeddings after partial ijson failure (Low):
- Collect all ijson embeddings into list before yielding
- Reset embeddings_yielded counter before fallback
- Only yield after successful complete parsing1 parent 13b57e6 commit c2c3f3e
4 files changed
Lines changed: 37 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1222 | 1222 | | |
1223 | 1223 | | |
1224 | 1224 | | |
1225 | | - | |
1226 | | - | |
1227 | | - | |
1228 | | - | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
1229 | 1231 | | |
1230 | | - | |
1231 | 1232 | | |
1232 | 1233 | | |
1233 | 1234 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
203 | 203 | | |
204 | 204 | | |
205 | 205 | | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
206 | 210 | | |
207 | 211 | | |
208 | 212 | | |
| |||
408 | 412 | | |
409 | 413 | | |
410 | 414 | | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
411 | 419 | | |
412 | 420 | | |
413 | 421 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
54 | | - | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
55 | 64 | | |
56 | 65 | | |
57 | 66 | | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | 67 | | |
63 | 68 | | |
| 69 | + | |
64 | 70 | | |
65 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
66 | 74 | | |
67 | 75 | | |
| 76 | + | |
| 77 | + | |
68 | 78 | | |
69 | 79 | | |
70 | 80 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
603 | 603 | | |
604 | 604 | | |
605 | 605 | | |
606 | | - | |
607 | | - | |
608 | | - | |
609 | | - | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
610 | 612 | | |
611 | | - | |
612 | 613 | | |
613 | 614 | | |
614 | 615 | | |
| |||
0 commit comments