embedContentBatch abstract method

Future<List<List<double>>> embedContentBatch(
  1. int contextHandle,
  2. List<LlamaEmbeddingInput> inputs, {
  3. bool normalize = true,
})

Embeds ordered inputs, returning one vector per input in the same order.

Preserve part order and media; never flatten a mixed request to text. Adjacent text parts form one verbatim-concatenated text segment on every backend, including within mixed inputs. LiteRT-LM adapters must merge adjacent text before building runtime inputs; no separators or templates are added. Validate modalities, part shapes and media sources/decoding across the entire batch before inference. Check expanded-token limits before inference when the runtime exposes counts (required for llama.cpp). Runtimes without a token-count API, such as LiteRT-LM, may detect overflow during the batch, but must fail the whole call with LlamaInferenceException and no vectors. Earlier items may consume wasted compute; never truncate or return partial results. Empty batches return no vectors. With normalize, L2-normalize each pooled output. Otherwise return the full raw pooled vector.

Cancellation uses LlamaBackend.cancelGeneration, as for text embeddings. Keep native buffers alive until in-flight work settles, even on cancel. Unsupported combinations throw LlamaUnsupportedException; input/context capacity and execution failures throw LlamaInferenceException.

Implementation

Future<List<List<double>>> embedContentBatch(
  int contextHandle,
  List<LlamaEmbeddingInput> inputs, {
  bool normalize = true,
});