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}
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}
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}
Summary
Functions
Creates a new configuration with optional overrides.
Types
@type reasoning_effort() :: :low | :medium | :high
@type response_format() :: %{type: :json_object | :text, schema: map() | nil}
@type t() :: %Mojentic.LLM.CompletionConfig{ max_tokens: 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 }
Functions
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}
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}
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}