BerriAI/litellm · error · NotImplementedError
Bedrock Titan v2 batch embedding does not support…
Error message
Bedrock Titan v2 batch embedding does not support pre-tokenized integer inputs. Pass `input` as a string (model={model}). What it means
Normalization guard in the embedding-input coercion: the input looks pre-tokenized (list of ints / token-list-of-lists, per the OpenAI spec), which Bedrock Titan v2 batch embedding cannot accept — it only takes a raw string in inputText.
Solutions
- Pass `input` as a raw string, not token ids.
- Detokenize inputs before creating the batch file.
- Use a model/route that supports pre-tokenized input if required.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at litellm/llms/bedrock/files/transformation.py:632 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/8012158aa4e10ee4.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/llms/bedrock/files/transformation.py:632
if isinstance(raw_input, list):
if len(raw_input) == 1:
candidate = raw_input[0]
else:
raise ValueError(
"Bedrock batch embedding requires one input per JSONL "
"record. Got a list with "
f"{len(raw_input)} items for model={model}; emit one "
"JSONL line per input string instead."
)
else:
candidate = raw_input
# Catches pre-tokenized inputs (List[int] from OpenAI spec, or a
# single int slipping past the list-unwrap above).
# NOTE: bool is a subclass of int but treating True/False as a token
# is meaningless either way, so the broad check is fine.
if isinstance(candidate, (list, int)):
raise NotImplementedError(
"Bedrock Titan v2 batch embedding does not support "
"pre-tokenized integer inputs. Pass `input` as a string "
f"(model={model})."
)
if not isinstance(candidate, str):
raise ValueError(
"Bedrock batch embedding `input` must be a string (or a "
"single-element list of strings). Got type "
f"{type(candidate).__name__} for model={model}."
)
return candidate
def _map_openai_embedding_to_bedrock_params(
self,
openai_request_body: _OpenAIBatchRecordBody,
model: str,
) -> dict[str, object]:
"""View on GitHub (pinned to 77b7c6c40c)