PtcRunner.LLM.Requirements (PtcRunner v0.15.0)

Copy Markdown View Source

Closed, bounded model-contract requirements sealed into a prepared target.

Kernel constructs this map after manifest selection and before credentials. PtcRunner.LLM.prepare/2 validates both the requested map and the adapter attestation, then requires exact canonical equality. The output-limit binding records whether the effective application limit, installation parameter, or both selected the effective max_tokens; adapters carry that fact into authenticated truncation metadata.

Summary

Types

cost_tariff()

@type cost_tariff() :: %{currency: String.t(), id: binary()}

exact_options()

@type exact_options() :: %{
  :max_tokens => pos_integer(),
  optional(:temperature) => float(),
  optional(:seed) => non_neg_integer(),
  optional(:top_p) => float(),
  optional(:presence_penalty) => float(),
  optional(:frequency_penalty) => float(),
  optional(:reasoning_effort) => :none | :minimal | :low | :medium | :high
}

output_limit_binding()

@type output_limit_binding() :: :application_limit | :installation_param | :configured

reservation()

@type reservation() :: %{total_tokens?: boolean(), cost_tariff: cost_tariff() | nil}

t()

@type t() :: %{
  exact_options: exact_options(),
  output_limit_bindings: [output_limit_binding(), ...],
  structured_output_mode: :json_schema | :json_object | :unsupported,
  usage_guarantees: usage_guarantees(),
  reservation: reservation()
}

usage_guarantees()

@type usage_guarantees() :: %{tokens: boolean(), cost_currency: String.t() | nil}

Functions

canonical(requirements)

@spec canonical(term()) :: {:ok, t()} | :error

equal?(left, right)

@spec equal?(t(), t()) :: boolean()

interim(exact_options)

@spec interim(exact_options()) :: t()

Returns a requirement map for direct embedders that do not request reporting guarantees or reservation authority.

interim(exact_options, mode)

@spec interim(exact_options(), :json_schema | :json_object | :unsupported) :: t()

live(params, output_tokens, structured_output_mode, usage_guarantees, reservation)

@spec live(
  map(),
  pos_integer(),
  :json_schema | :json_object | :unsupported,
  usage_guarantees(),
  reservation()
) :: {:ok, t()} | :error

probe(params, usage_guarantees)

@spec probe(map(), usage_guarantees()) :: {:ok, t()} | :error

probe(params, usage_guarantees, reservation)

@spec probe(map(), usage_guarantees(), reservation()) :: {:ok, t()} | :error