rohitg00/ai-engineering-from-scratch · error · ValueError
max_rounds must be >= 1
Error message
max_rounds must be >= 1
What it means
Error "max_rounds must be >= 1" thrown in rohitg00/ai-engineering-from-scratch.
Source
Thrown at phases/19-capstone-projects/55-critic-loop/code/main.py:144
"final_mean": self.final_mean,
"trace": [t.to_dict() for t in self.trace],
}
class CriticLoop:
"""Drives critic -> reviser -> convergence-check until a stop condition fires."""
def __init__(
self,
critic: Critic,
reviser: Reviser,
max_rounds: int = 5,
target_score: float = 8.0,
plateau_epsilon: float = 0.1,
plateau_window: int = 2,
) -> None:
if max_rounds < 1:
raise ValueError("max_rounds must be >= 1")
if plateau_window < 1:
raise ValueError("plateau_window must be >= 1")
self.critic = critic
self.reviser = reviser
self.max_rounds = max_rounds
self.target_score = target_score
self.plateau_epsilon = plateau_epsilon
self.plateau_window = plateau_window
def _target_met(self, critique: Critique) -> bool:
return all(critique.scores.get(d, 0.0) >= self.target_score for d in DIMENSIONS)
def _plateau(self, trace: list[LoopTrace]) -> bool:
if len(trace) < self.plateau_window + 1:
return False
recent = trace[-(self.plateau_window + 1):]
for i in range(1, len(recent)):
if recent[i].mean - recent[i - 1].mean > self.plateau_epsilon:View on GitHub (pinned to 39ea8a1c6d)
When it happens
Trigger: Thrown at phases/19-capstone-projects/55-critic-loop/code/main.py:144 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of rohitg00/ai-engineering-from-scratch@39ea8a1c6d (2026-08-26).
Data as JSON: /api/errors/654425ec835c636e.
Report an issue: GitHub.