Commit b5ecb1b
committed
fix(multimodal): collect all surrounding text as context instead of only the nearest segment
Previously, `get_image_context` only picked the single text item
immediately adjacent to the image (via `break`). When users placed
the image at the end of the `response` list (e.g. after a task
description + source + target), `context_above` would contain only
the last string (often a single word like "Off" or "Custom") while the
task description was silently dropped. This caused `ImageCoherenceGrader`
and `ImageHelpfulnessGrader` to receive near-empty context, resulting in
unstable and severely low scores (1–2) for the same content that scored 5
when the image was placed first.
The fix concatenates all text segments before/after the image,
ensuring task instructions and surrounding content are always fully
passed to the model regardless of image position.
Made-with: Cursor1 parent 0b5669d commit b5ecb1b
1 file changed
Lines changed: 19 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
79 | 80 | | |
80 | 81 | | |
0 commit comments