Gemini.Types.Response.BatchEmbedContentsResponse (GeminiEx v0.3.0)

View Source

Response structure for batch embedding requests.

Contains embeddings for multiple content items in the same order as the input requests.

Fields

  • embeddings: List of content embeddings

Examples

%BatchEmbedContentsResponse{
  embeddings: [
    %ContentEmbedding{values: [0.1, 0.2, ...]},
    %ContentEmbedding{values: [0.3, 0.4, ...]},
    %ContentEmbedding{values: [0.5, 0.6, ...]}
  ]
}

Summary

Functions

Creates a new batch embedding response from API response data.

Gets all embedding values as a list of lists.

Types

t()

@type t() :: %Gemini.Types.Response.BatchEmbedContentsResponse{
  embeddings: [Gemini.Types.Response.ContentEmbedding.t()]
}

Functions

from_api_response(map)

@spec from_api_response(map()) :: t()

Creates a new batch embedding response from API response data.

Parameters

  • data: Map containing the API response

Examples

BatchEmbedContentsResponse.from_api_response(%{
  "embeddings" => [
    %{"values" => [0.1, 0.2]},
    %{"values" => [0.3, 0.4]}
  ]
})

get_all_values(batch_embed_contents_response)

@spec get_all_values(t()) :: [[float()]]

Gets all embedding values as a list of lists.

Examples

response = %BatchEmbedContentsResponse{...}
all_values = BatchEmbedContentsResponse.get_all_values(response)
# => [[0.1, 0.2, ...], [0.3, 0.4, ...], ...]