{"record":{"id":"791c6fd4339767c4","repo":"rohitg00/ai-engineering-from-scratch","slug":"empty-text","errorCode":null,"errorMessage":"empty text","messagePattern":"empty text","errorType":"exception","errorClass":"ParserError","httpStatus":null,"severity":"error","filePath":"phases/19-capstone-projects/50-hypothesis-generator/code/main.py","lineNumber":92,"sourceCode":"    norm = math.sqrt(sum(v * v for v in vec))\n    if norm == 0.0:\n        return vec\n    return [v / norm for v in vec]\n\n\ndef cosine_distance(a: list[float], b: list[float]) -> float:\n    dot = sum(x * y for x, y in zip(a, b))\n    dot = max(-1.0, min(1.0, dot))\n    return 1.0 - dot\n\n\ndef parse_response(raw: str) -> dict:\n    match = TAG_RE.search(raw)\n    if match is None:\n        raise ParserError(\"no hypothesis block found\")\n    text = match.group(\"text\").strip()\n    if not text:\n        raise ParserError(\"empty text\")\n    metric = match.group(\"metric\").strip()\n    if not metric:\n        raise ParserError(\"empty metric\")\n    raw_vars = match.group(\"variables\").strip()\n    variables = [v.strip() for v in raw_vars.split(\",\") if v.strip()]\n    if not variables:\n        raise ParserError(\"empty variables\")\n    baseline = match.group(\"baseline\")\n    baseline_ref = baseline.strip() if baseline and baseline.strip() else None\n    return {\n        \"text\": text,\n        \"variables\": variables,\n        \"metric\": metric,\n        \"baseline_ref\": baseline_ref,\n    }\n\n\ndef temperature_bucket(temperature: float) -> int:","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/rohitg00/ai-engineering-from-scratch/blob/39ea8a1c6d0b61f071226eff7ede4d4105fed820/phases/19-capstone-projects/50-hypothesis-generator/code/main.py#L74-L110","documentation":"Error \"empty text\" thrown in rohitg00/ai-engineering-from-scratch.","triggerScenarios":"Thrown at phases/19-capstone-projects/50-hypothesis-generator/code/main.py:92 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"39ea8a1c6d0b61f071226eff7ede4d4105fed820","analyzedAt":"2026-08-26T03:13:46.626Z","schemaVersion":2},"datasetVersion":"2026-08-26T07:17:17.940Z"}