# `GEPA.LM`
[🔗](https://github.com/nshkrdotcom/gepa_ex/blob/v0.3.0/lib/gepa/lm.ex#L1)

Upstream-compatible LM wrapper for reflection models.

Existing `gepa_ex` code should keep using `GEPA.LLM`.  This module provides a
small compatibility layer for code ported from Python's `gepa.lm`: it tracks
approximate token counts and delegates text generation to either a callable or
a normalized `GEPA.LLM` client.

# `t`

```elixir
@type t() :: %GEPA.LM{
  client: term(),
  completion_kwargs: keyword(),
  counter: pid(),
  defaults: keyword(),
  model: term()
}
```

# `batch_complete`

```elixir
@spec batch_complete(t(), [GEPA.LLM.prompt()], keyword()) ::
  {:ok, [String.t()]} | {:error, term()}
```

# `calls`

```elixir
@spec calls(t()) :: non_neg_integer()
```

# `complete`

```elixir
@spec complete(t() | term(), GEPA.LLM.prompt(), keyword()) ::
  {:ok, String.t()} | {:error, term()}
```

# `counters`

```elixir
@spec counters(t()) :: map()
```

# `new`

```elixir
@spec new(
  term(),
  keyword()
) :: t()
```

# `total_cost`

```elixir
@spec total_cost(t()) :: float()
```

# `total_tokens_in`

```elixir
@spec total_tokens_in(t()) :: non_neg_integer()
```

# `total_tokens_out`

```elixir
@spec total_tokens_out(t()) :: non_neg_integer()
```

---

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