Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions openevolve/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ class Program:
# Metadata
metadata: Dict[str, Any] = field(default_factory=dict)

# Prompts
prompts: Optional[Dict[str, Any]] = None

# Artifact storage
artifacts_json: Optional[str] = None # JSON-serialized small artifacts
artifact_dir: Optional[str] = None # Path to large artifact files
Expand Down
12 changes: 12 additions & 0 deletions openevolve/iteration.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ async def run_iteration_with_shared_db(
# Handle artifacts if they exist
artifacts = evaluator.get_pending_artifacts(child_id)

# Set template_key of Prompts
template_key = (
"full_rewrite_user" if not config.diff_based_evolution else "diff_user"
)

# Create a child program
result.child_program = Program(
id=child_id,
Expand All @@ -132,6 +137,13 @@ async def run_iteration_with_shared_db(
"changes": changes_summary,
"parent_metrics": parent.metrics,
},
prompts={
template_key: {
"system": prompt["system"],
"user": prompt["user"],
"responses": [llm_response] if llm_response is not None else [],
}
} if database.config.log_prompts else None,
)

result.prompt = prompt
Expand Down