Skip to content

Questions

System One answers four question shapes. Build them with static helpers on Question, then read typed answers from SystemOneResult.

Need Builder Answer
One of a defined set Question.Choice choice, probabilities, confidence
Degree on ordered levels Question.Score score, legend, probabilities, confidence
Is this true? Question.Noul noul ∈ [0, 1] — no separate confidence
Where is it in the image? Question.Box box edges as fractions, nullable confidence

See TypeSafe primitives for conceptual background.

("category", Question.Choice(
"What is this ticket about?",
("billing", null),
("technical", "Product bugs, outages, or how-to"),
("other", null)))

Choice criteria is still a map on the wire. The tuple pairs are converted to that map; pass a Dictionary<string, object?> when you already have one. Duplicate labels throw.

var answer = response.GetChoice("category");
Console.WriteLine(answer.Choice);
Console.WriteLine(answer.Confidence);

Levels are ordered from low to high. Pass at least two level labels after the instructions.

("urgency", Question.Score(
"How urgent is this?",
"not urgent",
"soon",
"blocking"))
var answer = response.GetScore("urgency");
Console.WriteLine(answer.Score);
Console.WriteLine(string.Join(" → ", answer.Legend));

Probability that the statement is true.

("is_refund", Question.Noul("Is the customer asking for a refund?"))
var answer = response.GetNoul("is_refund");
Console.WriteLine(answer.Noul);

Locates what the instructions describe in the request’s image. See Images.

("damage", Question.Box("The damaged area of the product"))

Independent questions share one request. Prefer one SystemOneAsync call over many round trips when the questions do not depend on each other.

var response = await client.SystemOneAsync(
state,
("category", Question.Choice("What is this ticket about?",
("billing", null),
("technical", null),
("other", null))),
("urgency", Question.Score("How urgent is this?", "not urgent", "soon", "blocking")),
("is_refund", Question.Noul("Is the customer asking for a refund?")));

For model, per-call options, or a cancellation token, pass Question.Map(...) to the dictionary overload (or set SystemOneRequest.Questions).

MIT · Copyright (c) Dario Kondratiuk. · not affiliated with TypeSafe beyond being a client of the public API