Skip to content

Commit 9dd137b

Browse files
committed
Fix metadata field access in PromptSampler (algorithmicsuperintelligence#203)
- Fix changes field access: program.get("changes") → program.get("metadata", {}).get("changes") - Fix parent_metrics field access: program.get("parent_metrics") → program.get("metadata", {}).get("parent_metrics") These fields are stored in Program.metadata but were being accessed at the top level, causing evolution history to always show "Unknown changes" instead of actual modifications. Fixes algorithmicsuperintelligence#203
1 parent 87148a0 commit 9dd137b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

openevolve/prompt/sampler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ def _format_evolution_history(
249249

250250
for i, program in enumerate(reversed(selected_previous)):
251251
attempt_number = len(previous_programs) - i
252-
changes = program.get("changes", "Unknown changes")
252+
changes = program.get("metadata", {}).get("changes", "Unknown changes")
253253

254254
# Format performance metrics using safe formatting
255255
performance_parts = []
@@ -264,7 +264,7 @@ def _format_evolution_history(
264264
performance_str = ", ".join(performance_parts)
265265

266266
# Determine outcome based on comparison with parent (only numeric metrics)
267-
parent_metrics = program.get("parent_metrics", {})
267+
parent_metrics = program.get("metadata", {}).get("parent_metrics", {})
268268
outcome = "Mixed results"
269269

270270
# Safely compare only numeric metrics

0 commit comments

Comments
 (0)