Commit 603ccfe
authored
fix(gepa): collect and save trajectory feedback in optimization results (#819)
Fixes Issue ErikBjare/bob#128
Problem:
- TrajectoryAnalyzer and trajectory_feedback_metric existed
- GEPA received and used trajectory metric internally
- But _evaluate_prompt didn't collect trajectory feedback
- Results saved without trajectory_feedback field
Root cause:
- DSPy GEPA uses trajectory metric during optimization but doesn't expose feedback
- _evaluate_prompt only calculated scores, no trajectory feedback collection
Solution:
- Store trajectory_metric in PromptOptimizer when creating GEPA optimizer
- In _evaluate_prompt: collect trajectory feedback for each validation example
- Add trajectory_feedback to results dict with score + feedback per example
This enables:
- Phase 3.2 Tests 2-4 validation (previously blocked)
- Phase 3.3-4 performance validation
- Trajectory-based prompt optimization
Testing:
- All 17 dspy tests pass
- 1 test fails due to missing API key (expected, not code issue)1 parent 1bdd9de commit 603ccfe
1 file changed
+21
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
268 | 268 | | |
269 | 269 | | |
270 | 270 | | |
| 271 | + | |
271 | 272 | | |
272 | 273 | | |
273 | 274 | | |
| |||
314 | 315 | | |
315 | 316 | | |
316 | 317 | | |
| 318 | + | |
317 | 319 | | |
318 | 320 | | |
319 | 321 | | |
| |||
328 | 330 | | |
329 | 331 | | |
330 | 332 | | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
331 | 345 | | |
332 | 346 | | |
333 | 347 | | |
| |||
340 | 354 | | |
341 | 355 | | |
342 | 356 | | |
343 | | - | |
| 357 | + | |
344 | 358 | | |
345 | 359 | | |
346 | 360 | | |
| |||
353 | 367 | | |
354 | 368 | | |
355 | 369 | | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
356 | 376 | | |
357 | 377 | | |
358 | 378 | | |
| |||
0 commit comments