# Class LittleGhost::ModelRequest

Documentation version: Edge

Canonical HTML: https://littleghostai.org/docs/LittleGhost/ModelRequest.html

Carries everything a provider needs for one model stream. Messages are
normalized to Message objects, and required capabilities become unique
symbols. The main request containers are frozen, but nested values are not
defensively copied.

Treat settings, output schemas, and tool-choice values as immutable after
construction. Create a separate copy before using mutable control data in
another request or thread.

## Inheritance

`LittleGhost::ModelRequest < Data`

## Attributes

<a id="attribute-i-cancellation_token"></a>
### `cancellation_token` (R)

The cooperative cancellation token shared with the provider.

<a id="attribute-i-deadline"></a>
### `deadline` (R)

The absolute request deadline, or `nil` when none was configured.

<a id="attribute-i-messages"></a>
### `messages` (R)

The normalized conversation in a frozen Array.

<a id="attribute-i-output_schema"></a>
### `output_schema` (R)

The requested structured-output schema, or `nil` for ordinary text. The
caller-owned value is retained and must not be mutated afterward.

<a id="attribute-i-required_capabilities"></a>
### `required_capabilities` (R)

The normalized capabilities the selected model must support.

<a id="attribute-i-settings"></a>
### `settings` (R)

Trusted provider settings in the caller's now-frozen Hash. Nested values
remain mutable and must not change after construction.

<a id="attribute-i-tool_choice"></a>
### `tool_choice` (R)

The requested tool-selection policy, when one applies. The caller-owned value
is retained and must not be mutated afterward.

<a id="attribute-i-tools"></a>
### `tools` (R)

The model-visible tool specifications in a frozen Array.

## Class methods

<a id="method-c-new"></a>
### `.new`

```ruby
new(messages:, tools: [], settings: {}, output_schema: nil,
    tool_choice: nil, required_capabilities: [],
    cancellation_token: Support::CancellationToken.new,
    deadline: nil) -> ModelRequest
```

Creates one normalized provider request with cooperative cancellation and
deadline controls. Freezing is shallow; retained nested control values must
not be mutated afterward.
