Bash · Recipes
Fill a form by selection
Every field is a pick from a list you wrote, or true or false. No character in the form comes from a model.
form.json, a file the script reads
{
"version": 1,
"questions": {
"plan": {
"choose": "Which plan is the sender on?",
"options": [
"free",
"team",
"enterprise"
]
},
"topic": {
"choose": "What is this about?",
"options": [
"billing",
"access",
"export"
]
},
"call": {
"decide": "Does the sender ask for a call?"
}
}
}Each request gets a plan, a topic, and whether to call back, all from the lists in the form.
cat <<'EOF' |
{"id": "R-1", "text": "We are on the team plan and cannot export to CSV."}
{"id": "R-2", "text": "Our enterprise account was billed twice. Call me today."}
{"id": "R-3", "text": "New here on the free plan. How do I reset my password?"}
EOF
thinkthen annotate form.json \
--batch 1 \
--jsonl \
--field /text |
jq 'del(.text)'Output
{
"id": "R-1",
"plan": "team",
"topic": "export",
"call": false
}
{
"id": "R-2",
"plan": "enterprise",
"topic": "billing",
"call": true
}
{
"id": "R-3",
"plan": "free",
"topic": "access",
"call": false
}exit 0
On GitHub: github.com/botassembly/thinkthen