# `Gemini.Types.Response.BatchState`
[🔗](https://github.com/nshkrdotcom/gemini_ex/blob/v0.11.0/lib/gemini/types/response/batch_state.ex#L1)

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"

# `t`
[🔗](https://github.com/nshkrdotcom/gemini_ex/blob/v0.11.0/lib/gemini/types/response/batch_state.ex#L25)

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

# `from_string`
[🔗](https://github.com/nshkrdotcom/gemini_ex/blob/v0.11.0/lib/gemini/types/response/batch_state.ex#L53)

```elixir
@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`
[🔗](https://github.com/nshkrdotcom/gemini_ex/blob/v0.11.0/lib/gemini/types/response/batch_state.ex#L85)

```elixir
@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"

---

*Consult [api-reference.md](api-reference.md) for complete listing*
