Gemini.Types.Response.BatchState (GeminiEx v0.8.4)

View Source

Represents the state of an async batch embedding job.

States

  • :unspecified - State not specified
  • :pending - Job queued, not yet processing
  • :processing - Currently being processed
  • :completed - Successfully completed
  • :failed - Processing failed
  • :cancelled - Job was cancelled

Examples

# Convert from API response
BatchState.from_string("PROCESSING")
# => :processing

# Convert to API format
BatchState.to_string(:completed)
# => "COMPLETED"

Summary

Functions

Converts a string state from the API to an atom.

Converts an atom state to the API string format.

Types

t()

@type t() :: :unspecified | :pending | :processing | :completed | :failed | :cancelled

Functions

from_string(state_string)

@spec from_string(String.t()) :: t()

Converts a string state from the API to an atom.

Handles both uppercase API format (e.g., "PENDING") and lowercase format. Unknown states default to :unspecified.

Parameters

  • state_string: The state string from the API

Returns

The corresponding atom state

Examples

BatchState.from_string("PROCESSING")
# => :processing

BatchState.from_string("pending")
# => :pending

BatchState.from_string("UNKNOWN")
# => :unspecified

to_string(state)

@spec to_string(t()) :: String.t()

Converts an atom state to the API string format.

Parameters

  • state: The state atom

Returns

The API string representation

Examples

BatchState.to_string(:processing)
# => "PROCESSING"

BatchState.to_string(:completed)
# => "COMPLETED"