Writes a setup to one JSON file that R code, a Shiny app and an agent can share. The file holds no key. An agent can edit the descriptions as text, and git shows the changes.
Arguments
- setup
A setup from
decision_setup()orread_setup().- path
The path of the JSON file, in a folder that exists. An existing file is replaced.
Details
The file holds one JSON object, indented with two spaces:
version:1, the version of the layout.decider:provider,base_url,model,format,image_format(nullfor OpenAI and OpenRouter) andinput(nullwhen the input type is not checked). It holds no key and no credentials function:read_setup()gives the decider its credentials.questions: an object keyed by question name, in order. Each question hastype("noul","choice"or"score"),instructionsandanswers: an object keyed by answer, in order, whose values are the descriptions (nullfor none).references:null, or an object keyed by answer whose values are arrays of the prepared JPEG images, each in base64 on one line.image_settings:max_size(nullto keep the size),upscaleandcrop("none","center"or a box[x, y, width, height]).calibrator:null, or the calibrator as base64 ofserialize().calibrator_hash:null, or the hash of all that changes the answers of the model when the calibrator was stored: the decider (provider, server URL, model, request format and image format), the questions, the references and the image settings. It is the hash of apathfile ofdecide()(seeread_setup()).
A crop function cannot be saved: give crop as "none", "center" or
a box.
The file goes to a temporary file in the same folder first, which then
replaces path, so a crash during the write leaves the previous file
whole.
See also
Other setups:
decision_setup(),
read_setup()
Examples
refund <- question_noul("Does the message ask for a refund?")
setup <- decision_setup(decider_typesafe("jev-1.13.0"), list(refund = refund))
path <- tempfile(fileext = ".json")
write_setup(setup, path)
read_setup(path)
#> <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