computeEmbedding method

Future<Float32List> computeEmbedding(
  1. List<Content> contents
)

The embedding of contents: at most one text part (its task prefix already in front), any image parts and at most one audio part, one vector for all of them. Throws EmbedderInputTooLongException for an input over the limit (never truncated), ArgumentError for contents it does not take and StateError after close.

Implementation

Future<Float32List> computeEmbedding(List<Content> contents) async {
  if (_closed) throw StateError('The embedding engine is closed.');
  final input = embedderInputOfContents(contents, info.modalities);
  return Float32List.fromList(await _embedder.embed(input));
}