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.

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 named numeric vector, 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. For choices and scores the confidence describes how concentrated the distribution is, not the probability that the answer is correct.

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)
gptr_prob(d)
#>   a   b 
#> 0.9 0.2