Skip to contents

System 1 calls (peter(question, x, model = "jev")) return typed vectors: a gptr_decision (logical), a gptr_choice (character) or a gptr_score (double, the expected 0-based level). They work in if(), while(), ifelse(), table(), sum() and comparisons like the bare vectors, and carry the model's probabilities as attributes. gptr_prob() reads them. Choices given as a factor, or .opts = list(output = "factor"), return a plain factor instead, which carries no probabilities.

Usage

gptr_prob(x, what = c("prob", "confidence", "probabilities"))

Arguments

x

A System 1 vector: a gptr_decision, gptr_choice or gptr_score.

what

"prob" (decisions: P(yes); choices: the probability of the chosen option; scores: the confidence), "confidence" (decisions: abs(2 * p - 1)) or "probabilities" (a matrix with one row per element and one column per option or level; for decisions the columns FALSE and TRUE).

Value

A numeric vector preserving the names of x (including no names), or a matrix for what = "probabilities".

Details

Probabilities are the model's own; they are empirically calibrated only when the printed footer says calibrated. Native decision models report calibration as unknown unless calibration evidence was recorded, and emulated answers are always uncalibrated. Answers combined from several calls (c(), [<-, vctrs::vec_c()) say calibrated only when every part is calibrated and uncalibrated when any part is uncalibrated.

Confidence is not the probability that the answer is correct. For a decision it is abs(2 * p - 1) on every engine, so min_confidence = 0.8 keeps only P(yes) at most 0.1 or at least 0.9. For choices and scores it is the engine's own measure of how concentrated the distribution is. TypeSafe Jev (and emulation) reports (n * max(p) - 1) / (n - 1) for a choice and 1 - E|level - mode| / d for a score, d being the levels' mean distance from their middle; Ollama's Clef and Clef Flash report 1 - H(p) / log(n) for both. The distribution 0.90, 0.05 and 0.05 has confidence 0.85 on Jev and 0.64 on Clef, so re-tune min_confidence when switching engine.

A score can be fractional: with levels low, medium and high (0, 1 and 2), probabilities 0.85, 0.10 and 0.05 give the score 0.20. It is not rounded to the most likely level. attr(x, "meta") records the model, engine, calibration state, cached elements, usage and available execution provenance such as locality, model digest and server version.

Input shape and uncertainty

Atomic vectors and unnamed lists give one input state per element; data frames give one per row. Fully named lists and I(x) give one structured state. These states can contain the actual input values sent to the provider; see gptr_egress. min_confidence makes low-confidence answers NA by default, including unknown confidence when the minimum is positive. Use isTRUE() in scalar control flow when abstention is possible, and handle uncertain inputs separately.

System 1 options

gptr.s1_max_active (8) concurrent requests, gptr.s1_rounds (3) bounded retry rounds, gptr.s1_state_max (2000) characters of a piped session's state and gptr.s1_max_elements (10000) elements per call.

Examples

judge = gptr_fake_provider(list(0.9, 0.2), name = "judge", type = "classifier")
d = peter("Is this about dogs?", c(a = "A puppy.", b = "A car."), model = judge)
#> System 1 judge/judge-s1: 2 uncached inputs (2 requests).
#> gptr_decision: 1 TRUE / 1 FALSE (judge-s1-1.0, 2026-11-29)
gptr_prob(d)
#>   a   b 
#> 0.9 0.2