# `LlmCall.Conformance`
[🔗](https://github.com/gilbertwong96/llm_call/blob/main/lib/llm_call/conformance.ex#L1)

Assertions shared by `LlmCall.Codec.Conformance` and
`LlmCall.Media.Conformance`.

Test support, not a runtime dependency: it imports `ExUnit.Assertions` and is
meant to be called from a test.

# `assert_content_parts`

```elixir
@spec assert_content_parts([LlmCall.Content.part()], String.t()) :: :ok
```

Asserts that every part is a canonical content struct.

A provider-specific map in `content` means the codec leaked its wire shape into
the IR instead of mapping it.

# `assert_error`

```elixir
@spec assert_error(LlmCall.Error.t() | term(), String.t()) :: :ok
```

Asserts that a decoded error is a canonical `LlmCall.Error`.

The status is always `nil` — only the transport knows the HTTP status — and a
provider code is normalized to a string or `nil`, whatever the wire type was.
A codec never sets `reason` either; it is the client's structured transport
reason.

# `assert_info`

```elixir
@spec assert_info(module()) :: :ok
```

Asserts that `info/0` returns well-formed codec metadata.

`ir_version` must be `1`; `version` is a wire version string or `nil`.

# `assert_response`

```elixir
@spec assert_response(LlmCall.Response.t() | term(), String.t()) :: :ok
```

Asserts that a decoded completion response is canonical.

`content` holds canonical parts, `stop_reason` is in the closed union, `usage`
is canonical or `nil`, and `raw` is a map or `nil` — never a second response
model.

# `assert_stream_event`

```elixir
@spec assert_stream_event(LlmCall.StreamEvent.t() | term(), String.t()) :: :ok
```

Asserts that a stream event uses the canonical type union and its matching delta.

The index is a non-negative integer or `nil`. A content event carries the delta
its type names (`:text_delta` → `StreamDelta.Text`, and so on); a
`:message_delta` carries either the normalized delta or `StreamDelta.Raw` for an
unmapped provider field, which is how a codec preserves unknown data. A
structural event carries none.

# `assert_usage`

```elixir
@spec assert_usage(LlmCall.Usage.t() | term(), String.t()) :: :ok
```

Asserts that usage is `nil` or canonical, with non-negative integer counts.

# `credential_headers`

```elixir
@spec credential_headers() :: [String.t()]
```

The header names a codec must never emit (the transport adds them).

---

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