ThinkThen

Pick one

choose: pick one option from your list.

Each of the first three messages names one team: billing, shipping, and account. The fourth names a parcel and a login. No team reaches 0.9, and it comes back null.
question="Which team owns this?"
teams=(
  --option "billing=Invoices, fees, and refunds."
  --option "shipping=Parcels and delivery."
  --option "account=Logins and passwords."
)

cat <<'EOF' |
Please refund the extra fee on my invoice.
My parcel went to the wrong address.
I cannot reset my password.
My parcel never came, and now I cannot log in to track it.
EOF
thinkthen choose "$question" "${teams[@]}" \
  --batch 1 \
  --lines \
  --threshold 0.9 |
jq -r .value
Output
billing
shipping
account
null
exit 0

You give it one question, one piece of evidence, and 2 to 255 options. You get back one of your options, or null.

Read the answer

On one piece of evidence, a pick under the threshold or an exact tie at the top prints null and exits 3. In a stream, the run exits 0. choose never exits 1.

Exit codeWhat it means
0an option came back
3not sure
2usage or input error
4the backend failed or refused, as it does for evidence over the size limit
5a local failure
70a defect in the tool

Send the not-sure answers to a person.

Call it from your language

The Bash example opens this page.

Jobs that use choose

Watch choose answer questions about Beatles songs: choose selects one option.