rohitg00/ai-engineering-from-scratch · error · ParserError
no hypothesis block found
Error message
no hypothesis block found
What it means
Error "no hypothesis block found" thrown in rohitg00/ai-engineering-from-scratch.
Source
Thrown at phases/19-capstone-projects/50-hypothesis-generator/code/main.py:89
idx = int.from_bytes(h[:4], "big") % dim
sign = 1.0 if (h[4] & 1) == 0 else -1.0
vec[idx] += sign
norm = math.sqrt(sum(v * v for v in vec))
if norm == 0.0:
return vec
return [v / norm for v in vec]
def cosine_distance(a: list[float], b: list[float]) -> float:
dot = sum(x * y for x, y in zip(a, b))
dot = max(-1.0, min(1.0, dot))
return 1.0 - dot
def parse_response(raw: str) -> dict:
match = TAG_RE.search(raw)
if match is None:
raise ParserError("no hypothesis block found")
text = match.group("text").strip()
if not text:
raise ParserError("empty text")
metric = match.group("metric").strip()
if not metric:
raise ParserError("empty metric")
raw_vars = match.group("variables").strip()
variables = [v.strip() for v in raw_vars.split(",") if v.strip()]
if not variables:
raise ParserError("empty variables")
baseline = match.group("baseline")
baseline_ref = baseline.strip() if baseline and baseline.strip() else None
return {
"text": text,
"variables": variables,
"metric": metric,
"baseline_ref": baseline_ref,
}View on GitHub (pinned to 39ea8a1c6d)
When it happens
Trigger: Thrown at phases/19-capstone-projects/50-hypothesis-generator/code/main.py:89 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/c53dfa6e2577947e.
Report an issue: GitHub.