BerriAI/litellm · error · NotImplementedError

map_generate_content_optional_params is not implemented

Error message

map_generate_content_optional_params is not implemented

What it means

Error "map_generate_content_optional_params is not implemented" thrown in BerriAI/litellm.

Source

Thrown at litellm/llms/base_llm/google_genai/transformation.py:92

        return ("safetySettings", "toolConfig", "cachedContent", "labels")

    @abstractmethod
    def map_generate_content_optional_params(
        self,
        generate_content_config_dict: GenerateContentConfigDict,
        model: str,
    ) -> dict[str, Any]:
        """
        Map Google GenAI parameters to provider-specific format.

        Args:
            generate_content_optional_params: Optional parameters for generate content
            model: The model name

        Returns:
            Mapped parameters for the provider
        """
        raise NotImplementedError("map_generate_content_optional_params is not implemented")

    @abstractmethod
    def validate_environment(
        self,
        api_key: str | None,
        headers: dict | None,
        model: str,
        litellm_params: GenericLiteLLMParams | dict | None,
    ) -> dict:
        """
        Validate the environment and return headers for the request.

        Args:
            api_key: API key
            headers: Existing headers
            model: The model name
            litellm_params: LiteLLM parameters

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Use a concrete Google GenAI config subclass implementing map_generate_content_optional_params.

When it happens

Trigger: Thrown at litellm/llms/base_llm/google_genai/transformation.py:92 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/e81f6815aea3f4bd. Report an issue: GitHub.