Skip to content

Commit 52b8085

Browse files
committed
Add configurable program length check
1 parent e8e4ec3 commit 52b8085

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

openevolve/config.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,9 @@ class PromptConfig:
142142
max_artifact_bytes: int = 20 * 1024 # 20KB in prompt
143143
artifact_security_filter: bool = True
144144

145+
# Improvement areas
146+
code_length_threshold: Optional[int] = 500
147+
145148

146149
@dataclass
147150
class DatabaseConfig:

openevolve/prompt/sampler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def _identify_improvement_areas(
171171
improvement_areas = []
172172

173173
# Check program length
174-
if len(current_program) > 500:
174+
if self.config.code_length_threshold and len(current_program) > self.config.code_length_threshold:
175175
improvement_areas.append(
176176
"Consider simplifying the code to improve readability and maintainability"
177177
)

0 commit comments

Comments
 (0)