{"record":{"id":"d56d2162c2d5721e","repo":"mlflow/mlflow","slug":"the-databricks-agents-package-is-required-to-use-d56d21","errorCode":null,"errorMessage":"The `databricks-agents` package is required to use `mlflow.genai.judges.{func.__name__}`. Please install it with `pip install databricks-agents`.","messagePattern":"The `databricks-agents` package is required to use `mlflow\\.genai\\.judges\\.(.+?)`\\. Please install it with `pip install databricks-agents`\\.","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"mlflow/genai/judges/builtin.py","lineNumber":57,"sourceCode":"        feedback: The Feedback object to convert.\n\n    Returns:\n        A new Feedback object with our CategoricalRating.\n    \"\"\"\n    feedback.value = CategoricalRating(feedback.value) if feedback.value else feedback.value\n    return feedback\n\n\ndef requires_databricks_agents(func):\n    \"\"\"Decorator to check if the `databricks-agents` package is installed.\"\"\"\n\n    @wraps(func)\n    def wrapper(*args, **kwargs):\n        try:\n            import databricks.agents.evals.judges  # noqa: F401\n\n        except ImportError:\n            raise ImportError(\n                f\"The `databricks-agents` package is required to use \"\n                f\"`mlflow.genai.judges.{func.__name__}`. \"\n                \"Please install it with `pip install databricks-agents`.\"\n            )\n\n        return func(*args, **kwargs)\n\n    return wrapper\n\n\n@format_docstring(_MODEL_API_DOC)\ndef is_context_relevant(\n    *,\n    request: str,\n    context: Any,\n    name: str | None = None,\n    model: str | None = None,\n    extra_headers: dict[str, str] | None = None,","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/mlflow/mlflow/blob/6a27f2decc0b76eb1b54af31849784addb357dbc/mlflow/genai/judges/builtin.py#L39-L75","documentation":"MLflow's built-in judges in `mlflow.genai.judges` are thin wrappers that delegate to the `databricks.agents.evals.judges` implementation shipped in the `databricks-agents` package. The `wrapper` decorator checks for that import at call time and raises ImportError when the package is missing.","triggerScenarios":"Calling any `mlflow.genai.judges.<builtin judge>` (e.g. RelevanceToQuery, Guidelines, IsContextGrounded) without `databricks-agents` installed in the environment.","commonSituations":"Running in a non-Databricks or slim environment (mlflow skinny) where databricks-agents was never installed; deploying to CI/production containers with only mlflow core deps; forgetting that builtin judges are Databricks-hosted.","solutions":["Run `pip install databricks-agents`.","Add databricks-agents to requirements/dependency files used by the deployment environment.","If you cannot install databricks-agents, use `custom_prompt_judge` or `make_judge` (OpenAI-compatible) judges that don't require the package.","Pin the version alongside mlflow (e.g. `pip install 'databricks-agents>=0.x'`) to match the judge API expected by your mlflow version."],"exampleFix":"// before\nfrom mlflow.genai.judges import RelevanceToQuery\nfb = RelevanceToQuery(name=\"rel\", ...)\n\n// after\n# terminal\npip install databricks-agents\nfrom mlflow.genai.judges import RelevanceToQuery\nfb = RelevanceToQuery(name=\"rel\", ...)","handlingStrategy":"try-catch","validationCode":"import importlib.util\nif importlib.util.find_spec(\"databricks.agents.evals.judges\") is None:\n    raise RuntimeError(\"pip install databricks-agents required for builtin judges\")","typeGuard":null,"tryCatchPattern":"try:\n    feedback = mlflow.genai.judges.RelevanceToQuery(...)\nexcept ImportError:\n    # fall back to a judge that needs no databricks-agents\n    feedback = custom_prompt_judge(name=\"rel\", prompt_template=tmpl, model=my_llm)(...)","preventionTips":["Add databricks-agents to requirements for any job using mlflow.genai.judges","Sanity-check imports at service startup, not first request","Prefer custom_prompt_judge/make_judge in non-Databricks environments"],"tags":["genai","import-error","missing-dependency","databricks"],"backgroundTag":"missing-package","analyzedSha":"6a27f2decc0b76eb1b54af31849784addb357dbc","analyzedAt":"2026-08-29T20:54:51.419Z","schemaVersion":2},"datasetVersion":"2026-08-29T22:17:34.462Z"}