{"record":{"id":"f4f6e8e141ba51b5","repo":"headroomlabs-ai/headroom","slug":"openai-package-required-for-llm-judge-install-wit","errorCode":null,"errorMessage":"OpenAI package required for LLM judge. Install with: pip install openai","messagePattern":"OpenAI package required for LLM judge\\. Install with: pip install openai","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"headroom/evals/memory/judge.py","lineNumber":72,"sourceCode":"        model: OpenAI model to use (default: gpt-4o).\n        api_key: OpenAI API key (uses OPENAI_API_KEY env var if not provided).\n\n    Returns:\n        A judge function that takes (question, ground_truth, prediction)\n        and returns (score, reasoning).\n\n    Example:\n        judge_fn = create_openai_judge(model=\"gpt-4o-mini\")\n        score, reasoning = judge_fn(\n            \"What is Alice's favorite color?\",\n            \"Blue\",\n            \"Alice prefers blue\"\n        )\n    \"\"\"\n    try:\n        from openai import OpenAI\n    except ImportError as e:\n        raise ImportError(\n            \"OpenAI package required for LLM judge. Install with: pip install openai\"\n        ) from e\n\n    client = OpenAI(api_key=api_key) if api_key else OpenAI()\n\n    def judge(question: str, ground_truth: str, prediction: str) -> tuple[float, str]:\n        prompt = JUDGE_PROMPT.format(\n            question=question,\n            ground_truth=ground_truth,\n            prediction=prediction,\n        )\n\n        response = client.chat.completions.create(\n            model=model,\n            messages=[{\"role\": \"user\", \"content\": prompt}],\n            temperature=0.0,  # Deterministic scoring\n            max_tokens=200,\n        )","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/headroomlabs-ai/headroom/blob/322425c43bffde1ed0b64fecf3cf5951565dd82b/headroom/evals/memory/judge.py#L54-L90","documentation":"Error \"OpenAI package required for LLM judge. Install with: pip install openai\" thrown in headroomlabs-ai/headroom.","triggerScenarios":"Raised when the memory eval LLM judge is configured with the OpenAI provider but the `openai` package is not installed.","commonSituations":"See trigger scenarios.","solutions":["Install the OpenAI package: pip install openai","Set OPENAI_API_KEY in the environment before running the judge","Or install the evals extra: pip install headroom-ai[evals]"],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"322425c43bffde1ed0b64fecf3cf5951565dd82b","analyzedAt":"2026-08-15T01:03:05.481Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}