# Class LittleGhost::Model

Documentation version: Edge

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

Model is the resolved connection between an agent selection and a provider. It
keeps provider behavior behind one executable interface whether an agent
selected a role, canonical target, or inline configuration.

It merges profile settings into every ModelRequest, validates attachment
modalities declared in metadata, lets providers prepare capability-sensitive
requests, and delegates the normalized stream to the provider.

## Inheritance

`LittleGhost::Model < Object`

## Includes

- `LittleGhost::ModelInterface`

## Attributes

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

Provider object, canonical target, default settings, normalized model details,
and logical application role.

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

Provider object, canonical target, default settings, normalized model details,
and logical application role.

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

Provider object, canonical target, default settings, normalized model details,
and logical application role.

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

Provider object, canonical target, default settings, normalized model details,
and logical application role.

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

Provider object, canonical target, default settings, normalized model details,
and logical application role.

## Class methods

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

```ruby
.new(provider:, target:, settings: {}, details: nil, role: nil)
```

Connects a provider adapter to its canonical `target`, profile `settings`,
optional model `details`, and logical `role`.

## Instance methods

<a id="method-i-capabilities"></a>
### `#capabilities`

```ruby
#capabilities()
```

Uses advertised provider capabilities.

<a id="method-i-embed"></a>
### `#embed`

```ruby
#embed(request)
```

Applies profile settings and executes an Embeddings::Request.

Returns an Embeddings::Response with one vector per input. A provider that
returns another shape raises ProtocolError.

<a id="method-i-model_id"></a>
### `#model_id`

```ruby
#model_id()
```

Provider-owned identifier from the canonical target.

<a id="method-i-stream"></a>
### `#stream`

```ruby
#stream(request, &block)
```

Streams `request` through the configured provider.

Profile settings are defaults; settings on `request` take precedence.
