# `Mojentic.LLM.CompletionConfig`
[🔗](https://github.com/svetzal/mojentic-ex/blob/v1.5.0/lib/mojentic/llm/completion_config.ex#L1)

Configuration for LLM completion requests.

Provides settings for temperature, context window size, and token limits.

## Examples

    iex> CompletionConfig.new()
    %CompletionConfig{temperature: 1.0, num_ctx: 32768, max_tokens: 16384, top_p: nil, top_k: nil, response_format: nil, reasoning_effort: nil, max_tool_iterations: 10}

    iex> CompletionConfig.new(temperature: 0.7, max_tokens: 1000)
    %CompletionConfig{temperature: 0.7, num_ctx: 32768, max_tokens: 1000, top_p: nil, top_k: nil, response_format: nil, reasoning_effort: nil, max_tool_iterations: 10}

    iex> CompletionConfig.new(top_p: 0.9, top_k: 40)
    %CompletionConfig{temperature: 1.0, num_ctx: 32768, max_tokens: 16384, top_p: 0.9, top_k: 40, response_format: nil, reasoning_effort: nil, max_tool_iterations: 10}

# `reasoning_effort`

```elixir
@type reasoning_effort() :: :low | :medium | :high
```

# `response_format`

```elixir
@type response_format() :: %{type: :json_object | :text, schema: map() | nil}
```

# `t`

```elixir
@type t() :: %Mojentic.LLM.CompletionConfig{
  max_tokens: pos_integer(),
  max_tool_iterations: pos_integer(),
  num_ctx: pos_integer(),
  num_predict: integer() | nil,
  reasoning_effort: reasoning_effort() | nil,
  response_format: response_format() | nil,
  temperature: float(),
  top_k: integer() | nil,
  top_p: float() | nil
}
```

# `new`

Creates a new configuration with optional overrides.

## Parameters

- `opts`: Keyword list of options to override defaults

## Examples

    iex> CompletionConfig.new(temperature: 0.5)
    %CompletionConfig{temperature: 0.5, num_ctx: 32768, max_tokens: 16384, top_p: nil, top_k: nil, response_format: nil, reasoning_effort: nil, max_tool_iterations: 10}

    iex> CompletionConfig.new(top_p: 0.95)
    %CompletionConfig{temperature: 1.0, num_ctx: 32768, max_tokens: 16384, top_p: 0.95, top_k: nil, response_format: nil, reasoning_effort: nil, max_tool_iterations: 10}

    iex> CompletionConfig.new(response_format: %{type: :json_object, schema: nil})
    %CompletionConfig{temperature: 1.0, num_ctx: 32768, max_tokens: 16384, top_p: nil, top_k: nil, response_format: %{type: :json_object, schema: nil}, reasoning_effort: nil, max_tool_iterations: 10}

---

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