GEPA.LM (GEPA v0.3.0)

Copy Markdown View Source

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.

Summary

Types

t()

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

Functions

batch_complete(lm, prompts, opts \\ [])

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

calls(lm)

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

complete(lm_or_other, prompt, opts \\ [])

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

counters(lm)

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

new(model, opts \\ [])

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

total_cost(lm)

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

total_tokens_in(lm)

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

total_tokens_out(lm)

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