decide
decide answers a yes-or-no question about a piece of text. It says yes (true) or no (false), or, when you set a low and a high bar, not sure (unsure).
echo 'Please refund my order.' | thinkthen decide 'Does the customer request a refund?'Output
true
Yes: the message asks for a refund.
echo 'Where is my parcel?' | thinkthen decide 'Does the customer request a refund?'Output
false
No: the message asks about a delivery, not a refund.
Not sure
Section titled “Not sure”Set a low bar and a high bar. decide says no below the low bar, yes at or above the high bar, and not sure in between.
echo 'I was charged twice for one invoice.' | thinkthen decide --low 0.2 --high 0.8 \ 'Does the customer request a refund?'Output
unsure
Not sure: a double charge might be a refund request, or might not. Send not sure to a person. Never treat it as a no.
See why
Section titled “See why”See why
--json prints the details. This jq keeps the two that explain the answer.
echo 'I was charged twice for one invoice.' | thinkthen decide --low 0.2 --high 0.8 --json \ 'Does the customer request a refund?' | jq -c '{status, probability}'Output
{"status":"unsure","probability":0.7}
probability is the chance of yes. 0.7 falls between the bars of 0.2 and 0.8, so decide is not sure. JSON output lists every field.
Move the bar
Section titled “Move the bar”Move the bar
With one bar, --threshold, decide always says yes or no. Raise the bar to 0.8 and the same text is a no, because 0.7 is below it.
echo 'I was charged twice for one invoice.' | thinkthen decide --threshold 0.8 \ 'Does the customer request a refund?'Output
false
The default bar is 0.5. Lower it to say yes more often. Raise it to say yes only when the model is sure.
Use the answer in a script
Section titled “Use the answer in a script”Use the answer in a script
--check turns the answer into the exit code.
message='Please refund my order.'if echo "$message" | thinkthen decide --check \ 'Does the customer request a refund?' > /dev/nullthen echo 'send to the refunds queue'else status=$? case "$status" in 1|3) ;; *) exit "$status" ;; esacfiOutput
send to the refunds queue
| Answer | Exit code with --check |
|---|---|
true |
0 |
false |
1 |
unsure |
3 |
Without --check, decide exits 0 whenever it answers. Exit codes lists every code.
Answer every row of a CSV file
Section titled “Answer every row of a CSV file”Answer every row of a CSV file
id,texta1,Please refund my order.a2,Where is my parcel?a3,I was charged twice for one invoice.thinkthen decide 'Does the customer request a refund?' \ --from csv --column text --into is_refund < messages.csvOutput
id,text,is_refund
a1,Please refund my order.,TRUE
a2,Where is my parcel?,FALSE
a3,I was charged twice for one invoice.,TRUE
--column names the column to read, and --into names the new answer column. A CSV file holds TRUE and FALSE, which Excel reads as yes and no. With no bars, the double charge is a yes. File types covers TSV, Excel and other files.
Options
Section titled “Options”Options
| Option | What it does |
|---|---|
<QUESTION> | Question to ask |
[FILE]... | Input files; default: standard input |
--name <NAME> | Optional execution identity |
--text <TEXT> | Judge this text instead of reading input |
--threshold <THRESHOLD> | Required probability |
--low <LOW> | Low probability bar |
--high <HIGH> | High probability bar |
--check [=<CHECK>] | Return the verdict as an exit code |
--true <TEXT> | Meaning of a true answer |
--false <TEXT> | Meaning of a false answer |
--column <COLUMN> | Field column; repeat; replaces a saved pointer |
--details [=<DETAILS>] | Add status, probability, error, detail and source columns |
--in-place [=<IN-PLACE>] | Replace source with backup |
--into <INTO> | Answer field for JSON Lines; column for tables |
--output <OUTPUT> | Destination path |
--sheet <SHEET> | Worksheet |
If decide can't answer a text, it prints an error and exits with code 2, 4, 5 or 6. Troubleshooting lists each error and its fix.
In code: Python · TypeScript · Go · Java · Kotlin · C# · R · Ruby · Rust · Swift · Zig · C · C++ · DuckDB · SQLite · PostgreSQL
Next: choose picks one answer from your list.