# `GenAI.InferenceProviderBehaviour`

# `completion`

```elixir
@type completion() :: any()
```

# `context`

```elixir
@type context() :: any()
```

# `headers`

```elixir
@type headers() :: list()
```

# `messages`

```elixir
@type messages() :: list()
```

# `method`

```elixir
@type method() :: :get | :post | :put | :delete | :option | :patch
```

# `model`

```elixir
@type model() :: any()
```

# `options`

```elixir
@type options() :: any()
```

# `request_body`

```elixir
@type request_body() :: any()
```

# `session`

```elixir
@type session() :: any()
```

# `settings`

```elixir
@type settings() :: map()
```

# `tools`

```elixir
@type tools() :: list() | nil
```

# `uri`

```elixir
@type uri() :: url()
```

# `url`

```elixir
@type url() :: String.t()
```

# `chat`

```elixir
@callback chat(any(), any(), any(), any(), any(), any(), any()) ::
  {:ok, term()} | {:error, term()}
```

# `config_key`

```elixir
@callback config_key() :: atom()
```

Return config_key inference provide application config stored under :genai entry

# `effective_settings`

```elixir
@callback effective_settings(model(), session(), context(), options()) ::
  {:ok, {settings(), session()}} | {:error, term()}
```

Obtain map of effective settings: settings, model_settings, provider_settings, config_settings, etc.

# `endpoint`

```elixir
@callback endpoint(model(), settings(), session(), context(), options()) ::
  {:ok, {method(), uri()}}
  | {:ok, {{method(), uri()}, session()}}
  | {:error, term()}
```

Prepare endpoint and method to make inference call to

# `headers`

```elixir
@callback headers(model(), settings(), session(), context(), options()) ::
  {:ok, headers()} | {:ok, {headers(), session()}} | {:error, term()}
```

Prepare request headers

# `request_body`

```elixir
@callback request_body(
  model(),
  messages(),
  tools(),
  settings(),
  session(),
  context(),
  options()
) ::
  {:ok, headers()} | {:ok, {headers(), session()}} | {:error, term()}
```

Prepare request body to be passed to inference call.

# `run`

```elixir
@callback run(session(), context(), options()) ::
  {:ok, {completion(), session()}} | {:error, term()}
```

Build and run inference thread

# `standardize_model`

```elixir
@callback standardize_model(model()) :: model()
```

# `stream`

```elixir
@callback stream(session(), context(), options()) ::
  {:ok, {completion(), session()}} | {:error, term()} | :nyi
```

Build and run inference thread in streaming mode

---

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