rohitg00/ai-engineering-from-scratch · error · ValueError

unknown post_process rule: {rule}

Error message

unknown post_process rule: {rule}

What it means

Error "unknown post_process rule: {rule}" thrown in rohitg00/ai-engineering-from-scratch.

Source

Thrown at phases/19-capstone-projects/70-task-spec-format/code/main.py:262

    if rule == "strip_whitespace":
        return text.strip()
    if rule == "lower":
        return text.lower()
    if rule == "extract_letter":
        m = LETTER_RE.search(text)
        if m:
            return m.group(1)
        m2 = LETTER_FALLBACK_RE.search(text)
        return m2.group(0) if m2 else ""
    if rule == "extract_code_block":
        m = CODE_BLOCK_RE.search(text)
        return m.group(1) if m else text
    if rule == "extract_first_line":
        for line in text.splitlines():
            if line.strip():
                return line.strip()
        return ""
    raise ValueError(f"unknown post_process rule: {rule}")


def fixture_tasks() -> list[dict]:
    return [
        {
            "task_id": "arith_001",
            "category": "arithmetic",
            "prompt": "Compute the result.\nQuestion: 17 + 24\nAnswer:",
            "targets": ["41"],
            "metric_name": "exact_match",
            "post_process": "strip_whitespace",
            "few_shot_examples": [{"prompt": "Question: 2 + 2\nAnswer:", "completion": "4"}],
            "metadata": {"difficulty": "easy"},
        },
        {
            "task_id": "arith_002",
            "category": "arithmetic",
            "prompt": "Compute the result.\nQuestion: 144 / 12\nAnswer:",

View on GitHub (pinned to 39ea8a1c6d)

When it happens

Trigger: Thrown at phases/19-capstone-projects/70-task-spec-format/code/main.py:262 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/5e8d35af95982837. Report an issue: GitHub.