BerriAI/litellm · error · NotImplementedError

transform_ocr_response must be implemented by provider

Error message

transform_ocr_response must be implemented by provider

What it means

Error "transform_ocr_response must be implemented by provider" thrown in BerriAI/litellm.

Solutions

  1. Use a provider that implements OCR; transform_ocr_response is abstract in the base class.
  2. Implement transform_ocr_response in the custom provider's transformation class.
  3. Verify the model string routes to a provider with OCR support.

When it happens

Trigger: Thrown at litellm/llms/base_llm/ocr/transformation.py:222 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/3f6abd27668f9643. Report an issue: GitHub.

Appendix: source

Thrown at litellm/llms/base_llm/ocr/transformation.py:222

            model=model,
            document=document,
            optional_params=optional_params,
            headers=headers,
            **kwargs,
        )

    def transform_ocr_response(
        self,
        model: str,
        raw_response: httpx.Response,
        logging_obj: LiteLLMLoggingObj,
        **kwargs,
    ) -> OCRResponse:
        """
        Transform provider-specific OCR response to standard format.
        Override in provider-specific implementations.
        """
        raise NotImplementedError("transform_ocr_response must be implemented by provider")

    async def async_transform_ocr_response(
        self,
        model: str,
        raw_response: httpx.Response,
        logging_obj: LiteLLMLoggingObj,
        **kwargs,
    ) -> OCRResponse:
        """
        Async transform provider-specific OCR response to standard format.
        Optional method - providers can override if they need async transformations
        (e.g., Azure Document Intelligence for async operation polling).

        Default implementation falls back to sync transform_ocr_response.

        Args:
            model: Model name
            raw_response: Raw HTTP response

View on GitHub (pinned to 77b7c6c40c)