BerriAI/litellm · error · NotImplementedError

Bedrock Titan v2 batch embedding does not support pre-tokeni

Error message

Bedrock Titan v2 batch embedding does not support pre-tokenized integer inputs. Pass `input` as a string (model={model}).

What it means

Error "Bedrock Titan v2 batch embedding does not support pre-tokenized integer inputs. Pass `input` as a string (model={model})." thrown in BerriAI/litellm.

Source

Thrown at litellm/llms/bedrock/files/transformation.py:572

        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 6c2dcb801b)

Solutions

  1. Pass `input` as a string; pre-tokenized integer inputs are not supported for Titan v2 batch.

When it happens

Trigger: Thrown at litellm/llms/bedrock/files/transformation.py:572 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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