BerriAI/litellm · error · OCIError

OCI embed response does not match expected schema

Error message

OCI embed response does not match expected schema: {e}

What it means

Error "OCI embed response does not match expected schema: {e}" thrown in BerriAI/litellm.

Solutions

  1. Verify the OCI embedding model/endpoint returns the embedText schema; see the wrapped validation error {e}.

When it happens

Trigger: Thrown at litellm/llms/oci/embed/transformation.py:276 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/8d5714e57590923c. Report an issue: GitHub.

Appendix: source

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

    ) -> EmbeddingResponse:
        if raw_response.status_code != 200:
            raise OCIError(
                status_code=raw_response.status_code,
                message=raw_response.text,
            )

        try:
            json_response: Final = raw_response.json()
        except Exception as e:
            raise OCIError(
                status_code=raw_response.status_code,
                message=f"Failed to parse OCI embed response as JSON: {e}",
            )

        try:
            parsed: Final = OCIEmbedResponse(**json_response)
        except Exception as e:
            raise OCIError(
                status_code=500,
                message=f"OCI embed response does not match expected schema: {e}",
            )

        model_response.model = parsed.modelId
        model_response.data = [
            {
                "object": "embedding",
                "index": i,
                "embedding": embedding,
            }
            for i, embedding in enumerate(parsed.embeddings)
        ]

        if parsed.inputTextTokenCounts is not None:
            # Actual OCI API returns per-input token counts — sum for total usage
            total: Final = sum(parsed.inputTextTokenCounts)
            model_response.usage = Usage(prompt_tokens=total, total_tokens=total)

View on GitHub (pinned to 77b7c6c40c)