A setup holds one complete decision: the decider, the questions, the
reference images, the image settings and, if you want, a calibrator.
decide() takes a setup in place of decider and questions.
write_setup() saves it as one JSON file that R code, a Shiny app and an
agent can share, and read_setup() reads it.
Usage
decision_setup(
decider,
questions,
references = NULL,
max_size = 768,
upscale = FALSE,
crop = "none",
calibrator = NULL
)Arguments
- decider
A decider from
decider_typesafe(),decider_openai(),decider_foundry(),decider_openrouter()ordecider_systemone().- questions
One question from
question_noul(),question_choice()orquestion_score(), or a named list of questions, as indecide().- references
Reference images for the answers, or
NULL(the default), as indecide(): a named list in which each name is an allowed answer of the question and each element holds the images of that answer (paths, URLs or magick images). This release takes references with one question only.- max_size, upscale, crop
The image settings, as in
decide():max_sizeisNULLor one number of 1 or more, andupscaleisTRUEorFALSE. They apply to the references now and to the inputs ofdecide(). A crop function works in R, butwrite_setup()cannot save it.- calibrator
NULL(the default), or a probably calibrator, for example fromprobably::cal_estimate_isotonic(), fitted on the output ofdecide()for this question: its truth is a factor whose levels are the answers, and its estimates are the.pred_columns of the answers. A setup with a calibrator has one question.decide()applies the calibrator (see the value ofdecide()). To add a calibrator to a setup that exists, see Details.
Value
A setup: an S7 object of class decision_setup with the
properties decider, questions (a named list), references (the
prepared JPEG bytes, or NULL), max_size, upscale, crop and
calibrator. It holds no key.
Details
decision_setup() prepares each reference image once, with the
image settings of the setup (and with three color channels for
decider_systemone(image_format = "images")), and keeps its JPEG bytes.
So decide(), the file of write_setup() and read_setup() use the
same bytes, and a run with path has the same hash whether it starts
from a setup or from its pieces.
A model that reads only text cannot take references, and bad image settings are refused: the setup stops with an error before it reads the images.
To add a calibrator to a setup that exists, set its property:
setup@calibrator <- calibrator. This works for a setup from
decision_setup() and for a setup from read_setup(), whose
references are prepared images that decision_setup() cannot take
again. The setup checks the calibrator, as decision_setup() does, and
its references, its settings and its run hash do not change. Then
write_setup() stores the calibrator with that hash.
See also
decide() to use a setup, and score_setup() to score it.
Other setups:
read_setup(),
write_setup()
Examples
refund <- question_noul("Does the message ask for a refund?")
setup <- decision_setup(decider_typesafe("jev-1.13.0"), list(refund = refund))
setup
#> <decisions::decision_setup>
#> * Model: jev-1.13.0
#> * URL: https://api.typesafe.ai/v1/systemone
#> * Questions: refund (2 answers)
#> * Reference images: 0
#> * Image settings: max_size = 768, upscale = FALSE, crop = "none"
#> * Calibrated: no