ThinkThen

Bash techniques
Bash · Techniques

Set a cut or a band

One number is a cut. Two numbers are a band. An answer inside the band is not sure, and it prints null.

At a cut of 0.5, the send-back line counts as a refund.
question="Does the customer ask for a refund?"

cat <<'EOF' |
Please refund my order. It arrived broken.
Thanks for the quick help yesterday!
I want to send this back.
EOF
thinkthen decide "$question" \
  --batch 1 \
  --lines \
  --threshold 0.5 |
jq .value
Output
true
false
true
exit 0
With a band from 0.2 to 0.8, the same line is not sure, and it goes to a person.
question="Does the customer ask for a refund?"

cat <<'EOF' |
Please refund my order. It arrived broken.
Thanks for the quick help yesterday!
I want to send this back.
EOF
thinkthen decide "$question" \
  --batch 1 \
  --lines \
  --threshold 0.2:0.8 |
jq .value
Output
true
false
null
exit 0