# `Tune.Adapter`
[🔗](https://github.com/mikehostetler/tune/blob/v0.5.0/lib/tune/adapter.ex#L1)

A pure prompt format.

An adapter renders a signature, demonstrations, and inputs into a ReqLLM
context and output descriptor, and parses a reply into a map of declared
output fields. It never calls a model, retries, repairs, or falls back to
another format. The caller validates the parsed map against the signature.

# `rendering`

```elixir
@type rendering() :: %{context: ReqLLM.Context.t(), output: ReqLLM.Output.t()}
```

A rendered request: the ReqLLM context and the output descriptor to request.

# `reply`

```elixir
@type reply() :: {:text, String.t()} | {:object, map()}
```

A reply to parse: raw response text for text output, or the validated
structured value for object output.

# `normalize_options`

```elixir
@callback normalize_options(keyword()) :: {:ok, keyword()} | {:error, Exception.t()}
```

Validates and normalizes adapter options once, when a model configuration is built.

# `parse`

```elixir
@callback parse(Tune.Signature.t(), reply(), keyword()) ::
  {:ok, map()} | {:error, Exception.t()}
```

Parses a reply into a string-keyed map of every declared output field.

# `render`

```elixir
@callback render(Tune.Signature.t(), [Tune.Demo.t()], map(), keyword()) ::
  {:ok, rendering()} | {:error, Exception.t()}
```

Renders a request. Inputs are already normalized and validated.

---

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