decide options
The command takes QUESTION or @FILE. Start with its value and exit code.
| Option | What it does |
|---|---|
--threshold T or LOW:HIGH | The bar the probability of yes must reach. One number is a cut. Two numbers are a band, and the middle is not sure. The default is 0.5. |
--true TEXT | What a yes means, in the words the model reads. |
--false TEXT | What a no means. |
--quiet | Prints nothing. The exit code carries the answer. |
--input FILE | Reads the evidence from a file instead of standard input. |
--plan | Prints the plan and sends nothing. It needs no key. |
--lines, --jsonl, --csv, --tsv | Says how a stream of records is framed. Pick at most one. |
--field POINTER | Names the part of each record to judge, as a JSON Pointer. It may repeat. |
--jobs N | How many requests run at once, from 1 to 32. The default is 4. It works on a stream of records, annotate on one document, and relate on one entity set. |
--model NAME | The model the request carries. Name a version to pin a run. The default is jev-1.13.0. |
--url BASE | The server's base address. It outranks THINKTHEN_BASE_URL. |
--timeout SECONDS | How long one attempt may take. The default is 30. |
--max-retries N | How many times a retried status is sent again. A transport failure is never sent again. The default is 3. |
--record DIR | Calls the backend and saves each exchange in DIR. |
--replay DIR | Answers from DIR alone, with no key and no network. |
--cache DIR | Answers from DIR when it can and saves new exchanges there. |
--no-cache | Turns off the answer cache for one run. |
--profile FILE | Applies local backend limits and names the calibration profile in use. |
More examples
The send-back line lands in the band. decide exits 3, and the case sends it to a person. The script then exits 0.
question="Does the customer ask for a refund?"
printf '%s\n' "I want to send this back." |
thinkthen decide "$question" \
--quiet \
--threshold 0.2:0.8
refund_code=$?
case $refund_code in
0) echo "refund it" ;;
1) echo "answer it as usual" ;;
3) echo "send it to a person" ;;
esac
test "$refund_code" -eq 3Output
send it to a person
exit 0
The ticket asks for a refund. decide prints true and exits 0.
question="Does the customer ask for a refund?"
cat <<'EOF' |
I renewed once this morning, but my card shows two charges.
Please refund the duplicate.
EOF
thinkthen decide "$question"Output
true
exit 0: yes
Under these words, a cancellation is not money back. decide says false and exits 1.
question="Does the customer ask for a refund?"
yes="The customer asks for money back."
no="Anything else, such as a cancellation or a question."
cat <<'EOF' |
Please cancel my plan at the end of this month.
EOF
thinkthen decide "$question" \
--true "$yes" \
--false "$no"Output
false
exit 1: no
On GitHub: github.com/botassembly/thinkthen