batchEmbedContents method

  1. @override
Future<List<List<num>?>?> batchEmbedContents(
  1. List<String> texts, {
  2. String? modelName,
  3. List<SafetySetting>? safetySettings,
  4. GenerationConfig? generationConfig,
})

Embedding is a technique used to represent information as a list of floating point numbers in an array. With Gemini, you can represent text (words, sentences, and blocks of text) in a vectorized form, making it easier to compare and contrast embeddings. For example, two texts that share a similar subject matter or sentiment should have similar embeddings, which can be identified through mathematical comparison techniques such as cosine similarity.

Use the embedding-001 model with either embedContent or batchEmbedContents

Implementation

@override
Future<List<List<num>?>?> batchEmbedContents(List<String> texts,
        {String? modelName,
        List<SafetySetting>? safetySettings,
        GenerationConfig? generationConfig}) =>
    _impl.batchEmbedContents(texts,
        safetySettings: safetySettings,
        generationConfig: generationConfig,
        modelName: modelName);