BerriAI/litellm · error · HTTPException

Template does not support LLM enrichment

Error message

Template does not support LLM enrichment

What it means

Validation helper (_validate_enrichment_request) for the policy-template enrichment endpoint. The template_id supplied in the EnrichTemplateRequest resolved to a template whose definition does not permit LLM-based enrichment (it lacks the enrichment configuration/schema), so the endpoint refuses to run LLM enrichment against it. This is a configuration-level restriction of the chosen template, not a malformed request; pick an enrichment-capable template or enrich without LLM assistance.

Source

Thrown at litellm/proxy/management_endpoints/policy_endpoints/endpoints.py:690

        default=None,
        description="Refinement instruction for modifying the competitor list (e.g. 'add 10 more from Asia')",
    )


def _validate_enrichment_request(data: EnrichTemplateRequest) -> tuple[dict, dict, str]:
    """
    Validate enrichment request and return (template, llm_enrichment, brand_name).

    Raises HTTPException on validation failure.
    """
    templates: Final = _load_policy_templates_from_local_backup()
    template: Final = next((t for t in templates if t.get("id") == data.template_id), None)
    if template is None:
        raise HTTPException(status_code=404, detail=f"Template '{data.template_id}' not found")

    llm_enrichment: Final = template.get("llm_enrichment")
    if llm_enrichment is None:
        raise HTTPException(status_code=400, detail="Template does not support LLM enrichment")

    # Validate competitors list size if provided
    if data.competitors and len(data.competitors) > MAX_COMPETITOR_NAMES:
        raise HTTPException(
            status_code=400,
            detail=f"competitors list exceeds maximum of {MAX_COMPETITOR_NAMES}",
        )

    brand_name: Final = data.parameters.get(llm_enrichment["parameter"], "")
    if not brand_name:
        raise HTTPException(
            status_code=400,
            detail=f"Parameter '{llm_enrichment['parameter']}' is required",
        )

    return template, llm_enrichment, brand_name

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Use a template that declares LLM enrichment support.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/management_endpoints/policy_endpoints/endpoints.py:690 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/9266ad9901a85ec0. Report an issue: GitHub.