# `GEPA.OptimizeAnything`
[🔗](https://github.com/nshkrdotcom/gepa_ex/blob/v0.3.0/lib/gepa/optimize_anything.ex#L1045)

Optimize an arbitrary candidate with a user-supplied evaluator.

This is the Elixir port of upstream `optimize_anything`: it wraps a normal
evaluator in a GEPA adapter, supports single-task and dataset modes, string
candidates, seed generation, evaluator diagnostics, cache-aware evaluation,
and the regular GEPA optimizer.

# `build_seed_generation_prompt`

```elixir
@spec build_seed_generation_prompt(keyword() | map()) :: String.t()
```

Build the seed-generation prompt used when `seed_candidate` is nil.

# `default_refiner_prompt`

```elixir
@spec default_refiner_prompt() :: String.t()
```

Return the default refiner prompt template.

# `generate_seed_candidate`

```elixir
@spec generate_seed_candidate(term(), keyword() | map()) ::
  {:ok, map()} | {:error, term()}
```

Generate an initial seed candidate using an LM.

# `get_log_context`

```elixir
@spec get_log_context() :: GEPA.OptimizeAnything.LogContext.Context.t()
```

Return the process-local optimize-anything diagnostic log.

# `log`

```elixir
@spec log(term()) :: :ok
```

Append a diagnostic message to the process-local optimize-anything log.

# `log`

```elixir
@spec log(
  term() | [term()],
  keyword()
) :: :ok
```

Append a formatted diagnostic message to the process-local optimize-anything log.

# `make_litellm_lm`

```elixir
@spec make_litellm_lm(
  String.t(),
  keyword()
) :: GEPA.LLM.Client.t()
```

Build a normalized hosted-provider LM client for optimize-anything helpers.

# `optimize_anything`

```elixir
@spec optimize_anything(keyword() | map() | GEPA.OptimizeAnything.Config.t()) ::
  {:ok, GEPA.Result.t()} | {:error, term()}
```

Optimize any candidate/evaluator pair.

# `set_log_context`

```elixir
@spec set_log_context(GEPA.OptimizeAnything.LogContext.Context.t()) :: :ok
```

Replace the process-local optimize-anything diagnostic log.

# `str_candidate_key`

```elixir
@spec str_candidate_key() :: String.t()
```

Return the internal key used to wrap string candidates.

---

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