Gemini.Types.Response.EmbedContentBatch (GeminiEx v0.9.0)

Copy Markdown View Source

Complete async batch embedding job status and results.

Returned by get_batch_status and get_batch_result operations. Represents the full state of an async batch embedding job including progress, timing, and results.

Fields

  • model: Model used for embeddings
  • name: Batch identifier (format: "batches/{batchId}")
  • display_name: Human-readable batch name
  • input_config: Input configuration (file or inline)
  • output: Output containing results (when complete)
  • create_time: When batch was created
  • end_time: When batch completed/failed
  • update_time: Last update timestamp
  • batch_stats: Progress and completion statistics
  • state: Current batch state
  • priority: Processing priority

Examples

%EmbedContentBatch{
  model: "models/gemini-embedding-001",
  name: "batches/abc123def456",
  display_name: "Knowledge Base Embeddings",
  state: :processing,
  batch_stats: %EmbedContentBatchStats{
    request_count: 1000,
    successful_request_count: 750,
    failed_request_count: 50,
    pending_request_count: 200
  },
  create_time: ~U[2025-10-14 17:00:00Z],
  ...
}

Summary

Functions

Checks if the batch is complete (either succeeded or failed).

Checks if the batch failed.

Creates a batch from API response data.

Checks if the batch is currently processing.

Calculates the progress percentage of the batch.

Types

t()

@type t() :: %Gemini.Types.Response.EmbedContentBatch{
  batch_stats: Gemini.Types.Response.EmbedContentBatchStats.t() | nil,
  create_time: DateTime.t() | nil,
  display_name: String.t(),
  end_time: DateTime.t() | nil,
  input_config: Gemini.Types.Request.InputEmbedContentConfig.t() | nil,
  model: String.t(),
  name: String.t(),
  output: Gemini.Types.Response.EmbedContentBatchOutput.t() | nil,
  priority: integer() | nil,
  state: Gemini.Types.Response.BatchState.t(),
  update_time: DateTime.t() | nil
}

Functions

complete?(arg1)

@spec complete?(t()) :: boolean()

Checks if the batch is complete (either succeeded or failed).

Examples

EmbedContentBatch.complete?(batch)
# => true

failed?(arg1)

@spec failed?(t()) :: boolean()

Checks if the batch failed.

Examples

EmbedContentBatch.failed?(batch)
# => false

from_api_response(data)

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

Creates a batch from API response data.

Parameters

  • data: Map containing the API response

Examples

EmbedContentBatch.from_api_response(%{
  "model" => "models/gemini-embedding-001",
  "name" => "batches/abc123",
  "displayName" => "My Batch",
  "state" => "PROCESSING",
  ...
})

processing?(arg1)

@spec processing?(t()) :: boolean()

Checks if the batch is currently processing.

Examples

EmbedContentBatch.processing?(batch)
# => true

progress_percentage(embed_content_batch)

@spec progress_percentage(t()) :: float() | nil

Calculates the progress percentage of the batch.

Returns nil if batch stats are not available.

Examples

EmbedContentBatch.progress_percentage(batch)
# => 75.5