Tune.ModelConfig (Tune v0.5.0)

Copy Markdown View Source

One explicit, fixed model configuration: a ReqLLM model, a prompt adapter, adapter options, and ReqLLM request options.

{:ok, config} =
  Tune.ModelConfig.new(
    model: "openai:gpt-4o-mini",
    adapter: Tune.Adapter.Chat,
    request_options: [temperature: 0.0]
  )

The adapter is always explicit. Request options pass through to ReqLLM, except options that would replace the prepared output contract, change the prompt, add tools, stream, or repair output. Managed requests always send json_repair: false.

Request options can hold credentials. They are never copied into prepared requests, steps, results, or artifacts.

Summary

Functions

Returns non-secret identifiers for provenance and reports.

Builds a model configuration.

Returns ReqLLM options for one managed request.

Types

t()

@type t() :: %Tune.ModelConfig{
  adapter: module(),
  adapter_options: keyword(),
  model: term(),
  model_id: String.t(),
  request_options: keyword()
}

Functions

describe(config)

@spec describe(t()) :: map()

Returns non-secret identifiers for provenance and reports.

new(config)

@spec new(t() | keyword()) :: {:ok, t()} | {:error, Exception.t()}

Builds a model configuration.

Options:

  • :model - required ReqLLM model input, resolved through ReqLLM.model/1
  • :adapter - required module implementing Tune.Adapter
  • :adapter_options - options validated by the adapter
  • :request_options - ReqLLM generation options

request_options(model_config, output, remaining_ms \\ nil)

@spec request_options(t(), ReqLLM.Output.t(), non_neg_integer() | nil) :: keyword()

Returns ReqLLM options for one managed request.

output is the prepared output descriptor. remaining_ms, when given, caps :total_timeout so the request cannot outlive the run deadline.