An immutable typed predictor: a signature and its demonstrations.
prepare/3 and finish/2 are pure. call/3 composes them with one
ReqLLM.generate_text/3 request. There is no retry, repair, extraction call,
or format fallback; ReqLLM owns transport retries.
Summary
Functions
Prepares, executes one ReqLLM request, and finishes.
Checks a response against a prepared request and returns a validated step.
Builds a predictor.
Validates inputs and renders a request with the configured adapter.
Returns the predictor with new validated demonstrations.
Returns the predictor with new instructions.
Types
@type t() :: %Tune.Predictor{demos: [Tune.Demo.t()], signature: Tune.Signature.t()}
Functions
@spec call(t(), map(), Tune.ModelConfig.t(), non_neg_integer() | nil) :: {:ok, Tune.Step.t()} | {:error, Exception.t() | term()}
Prepares, executes one ReqLLM request, and finishes.
Input errors return before any request. A ReqLLM error is returned unchanged.
remaining_ms caps the request's :total_timeout.
@spec finish(Tune.Prepared.t(), ReqLLM.Response.t()) :: {:ok, Tune.Step.t()} | {:error, Exception.t()}
Checks a response against a prepared request and returns a validated step.
The response must have no error or refusal and a completed finish reason:
:stop, or :tool_calls for structured output only. Structured output must
be strictly valid with no ReqLLM repair. Makes no model request.
@spec new(keyword()) :: {:ok, t()} | {:error, Exception.t()}
Builds a predictor.
Options:
:signature- aTune.Signatureor signature options:demos- demonstrations validated against the signature
@spec prepare(t(), map(), Tune.ModelConfig.t()) :: {:ok, Tune.Prepared.t()} | {:error, Exception.t()}
Validates inputs and renders a request with the configured adapter.
Makes no model request and holds no credentials.
@spec put_demos(t(), list()) :: {:ok, t()} | {:error, Exception.t()}
Returns the predictor with new validated demonstrations.
@spec put_instructions(t(), String.t()) :: {:ok, t()} | {:error, Exception.t()}
Returns the predictor with new instructions.