BerriAI/litellm · error · ValueError

No embedding data found in response: {response}

Error message

No embedding data found in response: {response}

What it means

After a successful Amazon Titan Embeddings v2 call, the response must contain embedding data under 'embeddingsByType.binary', 'embeddingsByType.float', or the legacy 'embedding' key. If none is present, LiteLLM cannot build the Embedding result and raises ValueError including the raw response.

Source

Thrown at litellm/llms/bedrock/embed/amazon_titan_v2_transformation.py:101

        for index, response in enumerate(response_list):
            _parsed_response = AmazonTitanV2EmbeddingResponse(**response)

            # According to AWS docs, embeddingsByType is always present
            # If binary was requested (encoding_format="base64"), use binary data
            # Otherwise, use float data from embeddingsByType or fallback to embedding field
            embedding_data: list[float] | list[int]

            if "embeddingsByType" in _parsed_response and "binary" in _parsed_response["embeddingsByType"]:
                # Use binary data if available (for encoding_format="base64")
                embedding_data = _parsed_response["embeddingsByType"]["binary"]
            elif "embeddingsByType" in _parsed_response and "float" in _parsed_response["embeddingsByType"]:
                # Use float data from embeddingsByType
                embedding_data = _parsed_response["embeddingsByType"]["float"]
            elif "embedding" in _parsed_response:
                # Fallback to legacy embedding field
                embedding_data = _parsed_response["embedding"]
            else:
                raise ValueError(f"No embedding data found in response: {response}")

            transformed_responses.append(
                Embedding(
                    embedding=embedding_data,
                    index=index,
                    object="embedding",
                )
            )
            total_prompt_tokens += _parsed_response["inputTextTokenCount"]

        usage: Final = Usage(
            prompt_tokens=total_prompt_tokens,
            completion_tokens=0,
            total_tokens=total_prompt_tokens,
        )
        return EmbeddingResponse(model=model, usage=usage, data=transformed_responses)

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. Inspect the response embedded in the error message to see which keys AWS actually returned
  2. Upgrade LiteLLM to the latest version so the parser matches the current Titan v2 schema
  3. Remove any intermediate proxies that rewrite the response body

Example fix

# before: relying on default response shape
litellm.embedding(model='bedrock/amazon.titan-embed-text-v2:0', input=['hi'])

# after: pin embedding types the parser understands
litellm.embedding(
    model='bedrock/amazon.titan-embed-text-v2:0',
    input=['hi'],
    embeddingTypes=['float'],
)
Defensive patterns

Strategy: try-catch

Try / catch

try:
    resp = litellm.embedding(model="bedrock/amazon.titan-embed-text-v2:0", input=texts, embeddingTypes=["float"])
except ValueError as e:
    if "No embedding data found in response" in str(e):
        # schema drift: pin/upgrade litellm, inspect raw response in the message
        raise RuntimeError(f"Titan v2 response schema changed: {e}") from e
    raise

Prevention

When it happens

Trigger: AWS changes or regional variants returning a different response schema; requesting an embeddingType combination Titan v2 rejects so the response omits all data fields; or a proxy/gateway mangling the JSON body.

Common situations: Version drift between LiteLLM's Titan v2 parser and the AWS API, or downstream middlewares (debug proxies, payload filters) stripping response fields.

Related errors


AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15). Data as JSON: /api/errors/294253ee761cb0d6. Report an issue: GitHub.