{"record":{"id":"47a17eab912db33e","repo":"mlflow/mlflow","slug":"the-databricks-agents-package-is-required-to-use-47a17e","errorCode":null,"errorMessage":"The `databricks-agents` package is required to use `mlflow.genai.judges.custom_prompt_judge` with model='databricks'. Please install it with `pip install databricks-agents`.","messagePattern":"The `databricks-agents` package is required to use `mlflow\\.genai\\.judges\\.custom_prompt_judge` with model='databricks'\\. Please install it with `pip install databricks-agents`\\.","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"mlflow/genai/judges/custom_prompt_judge.py","lineNumber":82,"sourceCode":"    underscores, but should not contain spaces or special characters.\n\n    It is required for the prompt template to request choices as outputs, with each choice\n    enclosed in square brackets. Choice names should be alphanumeric and can include\n    underscores and spaces.\n    \"\"\"\n    model = model or get_default_model()\n\n    if model == \"databricks\":\n        try:\n            from databricks.agents.evals.judges import custom_prompt_judge as db_custom_prompt_judge\n\n            return db_custom_prompt_judge(\n                name=name,\n                prompt_template=prompt_template,\n                numeric_values=numeric_values,\n            )\n        except ImportError:\n            raise ImportError(\n                \"The `databricks-agents` package is required to use \"\n                \"`mlflow.genai.judges.custom_prompt_judge` with model='databricks'. \"\n                \"Please install it with `pip install databricks-agents`.\"\n            )\n\n    # Extract choices from the prompt template\n    choices = _CHOICE_PATTERN.findall(prompt_template)\n\n    if not choices:\n        raise ValueError(\n            \"Prompt template must include choices denoted with [[CHOICE_NAME]]. \"\n            \"No choices found in the provided prompt template.\"\n        )\n\n    # Validate that choices match numeric_values keys if provided\n    if numeric_values is not None:\n        sorted_numeric_values = sorted(numeric_values.keys())\n        sorted_choices = sorted(choices)","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/mlflow/mlflow/blob/6a27f2decc0b76eb1b54af31849784addb357dbc/mlflow/genai/judges/custom_prompt_judge.py#L64-L100","documentation":"`custom_prompt_judge` with `model='databricks'` delegates to `databricks.agents.evals.judges.custom_prompt_judge`, which requires the `databricks-agents` package. When that import fails at call time, MLflow raises ImportError telling you to install it.","triggerScenarios":"Calling `mlflow.genai.judges.custom_prompt_judge(name=..., prompt_template=..., model='databricks')` in an environment without `databricks-agents` installed.","commonSituations":"Using the Databricks-hosted model option outside a Databricks-managed environment; mlflow skinny installs; CI containers lacking the extra dependency; user forgot to pass a custom LLM (e.g. ChatCompletions endpoint) so it defaults to the databricks path.","solutions":["Run `pip install databricks-agents`.","Add databricks-agents to your environment/requirements for deployments that use model='databricks'.","Alternatively pass an explicit LLM (e.g. a ChatCompletions-compatible model) so the databricks path is not used.","Switch to `make_judge` with a non-Databricks model if you want to avoid the Databricks dependency entirely."],"exampleFix":"// before\njudge = custom_prompt_judge(name=\"tone\", prompt_template=\"...\", model=\"databricks\")\n\n// after\n# terminal\npip install databricks-agents\njudge = custom_prompt_judge(name=\"tone\", prompt_template=\"...\", model=\"databricks\")","handlingStrategy":"validation","validationCode":"import importlib.util\nif model == \"databricks\" and importlib.util.find_spec(\"databricks.agents\") is None:\n    raise RuntimeError(\"model='databricks' requires: pip install databricks-agents\")","typeGuard":null,"tryCatchPattern":"try:\n    judge = custom_prompt_judge(name=n, prompt_template=t, model=\"databricks\")\nexcept ImportError:\n    judge = custom_prompt_judge(name=n, prompt_template=t, model=fallback_llm)","preventionTips":["Install databricks-agents wherever model='databricks' is configured","Or configure an explicit OpenAI-compatible LLM to avoid the dependency","Verify optional deps in environment smoke tests"],"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"}