{"record":{"id":"29b7c7b18fa408cd","repo":"rohitg00/ai-engineering-from-scratch","slug":"unknown-op-op","errorCode":null,"errorMessage":"unknown op {op}","messagePattern":"unknown op (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"phases/19-capstone-projects/39-instruction-tuning-sft/code/main.py","lineNumber":239,"sourceCode":"    (\"list\", \"an ordered, mutable sequence of values.\"),\n    (\"dict\", \"a mapping from keys to values.\"),\n    (\"string\", \"a sequence of characters.\"),\n    (\"integer\", \"a whole number without a fractional part.\"),\n    (\"float\", \"a number with a fractional part stored in binary.\"),\n    (\"module\", \"a file of python code that can be imported.\"),\n]\n\n\ndef _arithmetic_response(a: int, b: int, op: str) -> str:\n    if op == \"+\":\n        return f\"{a} + {b} = {a + b}\"\n    if op == \"-\":\n        return f\"{a} - {b} = {a - b}\"\n    if op == \"*\":\n        return f\"{a} * {b} = {a * b}\"\n    if op == \"/\":\n        return f\"{a} / {b} = {a // b}\"\n    raise ValueError(f\"unknown op {op}\")\n\n\ndef make_dataset(seed: int = 0) -> Tuple[List[Dict[str, str]], List[str]]:\n    \"\"\"Returns (pairs, categories). Each pair has instruction, response.\"\"\"\n    rng = random.Random(seed)\n    pairs: List[Dict[str, str]] = []\n    categories: List[str] = []\n\n    # Capitals (40 pairs: 10 base x 4 templates)\n    cap_templates = [\n        \"What is the capital of {country}?\",\n        \"Name the capital city of {country}.\",\n        \"Capital of {country}?\",\n        \"Tell me the capital of {country}.\",\n    ]\n    cap_resp_templates = [\n        \"the capital of {country} is {city}.\",\n        \"{city} is the capital of {country}.\",","sourceCodeStart":221,"sourceCodeEnd":257,"githubUrl":"https://github.com/rohitg00/ai-engineering-from-scratch/blob/39ea8a1c6d0b61f071226eff7ede4d4105fed820/phases/19-capstone-projects/39-instruction-tuning-sft/code/main.py#L221-L257","documentation":"Error \"unknown op {op}\" thrown in rohitg00/ai-engineering-from-scratch.","triggerScenarios":"Thrown at phases/19-capstone-projects/39-instruction-tuning-sft/code/main.py:239 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"}