Skip to content

Commit 7bcbc5e

Browse files
committed
removed extra for loop in sampler
1 parent 287952c commit 7bcbc5e

File tree

2 files changed

+7
-18
lines changed

2 files changed

+7
-18
lines changed

openevolve/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class PromptConfig:
5858

5959
# Artifact rendering
6060
include_artifacts: bool = True
61-
max_artifact_bytes: int = 4 * 1024 # 4KB in prompt
61+
max_artifact_bytes: int = 20 * 1024 # 20KB in prompt
6262
artifact_security_filter: bool = True
6363

6464

openevolve/prompt/sampler.py

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -372,25 +372,14 @@ def _render_artifacts(self, artifacts: Dict[str, Union[str, bytes]]) -> str:
372372

373373
sections = []
374374

375-
# Prioritize stderr/stdout
376-
for key in ["stderr", "stdout", "traceback"]:
377-
if key in artifacts:
378-
content = self._safe_decode_artifact(artifacts[key])
379-
# Truncate if too long
380-
if len(content) > self.config.max_artifact_bytes:
381-
content = content[-self.config.max_artifact_bytes :] + "\n... (truncated)"
382-
383-
sections.append(f"### {key.title()}\n```\n{content}\n```")
384-
385-
# Add other artifacts using .items() for all remaining
375+
# Process all artifacts using .items()
386376
for key, value in artifacts.items():
387-
if key not in ["stderr", "stdout", "traceback"]:
388-
content = self._safe_decode_artifact(value)
389-
# Truncate if too long for inclusion
390-
if len(content) > self.config.max_artifact_bytes:
391-
content = content[: self.config.max_artifact_bytes] + "\n... (truncated)"
377+
content = self._safe_decode_artifact(value)
378+
# Truncate if too long
379+
if len(content) > self.config.max_artifact_bytes:
380+
content = content[: self.config.max_artifact_bytes] + "\n... (truncated)"
392381

393-
sections.append(f"### {key}\n```\n{content}\n```")
382+
sections.append(f"### {key}\n```\n{content}\n```")
394383

395384
if sections:
396385
return "## Last Execution Output\n\n" + "\n\n".join(sections)

0 commit comments

Comments
 (0)