BerriAI/litellm · error · OCIError

oci_serving_mode must be 'ON_DEMAND' or 'DEDICATED'.

Error message

oci_serving_mode must be 'ON_DEMAND' or 'DEDICATED'.

What it means

Error "oci_serving_mode must be 'ON_DEMAND' or 'DEDICATED'." thrown in BerriAI/litellm.

Solutions

  1. Set oci_serving_mode to 'ON_DEMAND' or 'DEDICATED'.

When it happens

Trigger: Thrown at litellm/llms/oci/embed/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/a2fc581dfda2c64f. Report an issue: GitHub.

Appendix: source

Thrown at litellm/llms/oci/embed/transformation.py:222

                            "Convert token lists to strings before calling embedding()."
                        ),
                    )
                texts.append(item if isinstance(item, str) else str(item))
        else:
            texts = [str(input)]

        if len(texts) > OCI_EMBED_BATCH_LIMIT:
            raise OCIError(
                status_code=400,
                message=(
                    f"OCI embedText accepts at most {OCI_EMBED_BATCH_LIMIT} inputs per request "
                    f"(got {len(texts)}). Batch your requests."
                ),
            )

        serving_mode_type: Final = optional_params.get("oci_serving_mode", "ON_DEMAND").upper()
        if serving_mode_type not in {"ON_DEMAND", "DEDICATED"}:
            raise OCIError(
                status_code=400,
                message="oci_serving_mode must be 'ON_DEMAND' or 'DEDICATED'.",
            )

        if serving_mode_type == "DEDICATED":
            endpoint_id: Final = optional_params.get("oci_endpoint_id", model)
            serving_mode = OCIServingMode(servingType="DEDICATED", endpointId=endpoint_id)
        else:
            serving_mode = OCIServingMode(servingType="ON_DEMAND", modelId=model)

        # Map input_type from OpenAI convention to OCI/Cohere convention
        input_type = optional_params.get("input_type")
        if input_type:
            input_type = _INPUT_TYPE_MAP.get(input_type.lower(), input_type.upper())

        request: Final = OCIEmbedRequest(
            compartmentId=compartment_id,
            servingMode=serving_mode,

View on GitHub (pinned to 77b7c6c40c)