Caching and replay
ThinkThen saves each answer under its question. Ask the same question again, and it reads the saved answer. Nothing is sent, and nothing is charged.
Ask once
The answer cache is on by default. A second run of the same question over the same text reads the cache. What makes two questions the same says which changes make a new question. The Configuration page says where the cache lives.
Replay in a test
A folder of saved answers can sit beside your tests. --replay reads that folder alone. A test that names it runs with no key and no network. Every run on this page replays one small folder.
question="Is this a complaint?"
cat <<'EOF' |
Arrived a day early. Thank you!
The zipper broke the first time I used it.
Does this come in blue?
The strap snapped on day two.
EOF
thinkthen filter "$question" \
--replay recordingThe zipper broke the first time I used it. The strap snapped on day two.
The modes table says what each folder option reads, sends and saves.
The batch keeps the key
ThinkThen packs many records into one request. Each record still has its own question and its own key. So an answer saved under one batch setting replays under another.
question="Is this a complaint?"
cat <<'EOF' |
Arrived a day early. Thank you!
The zipper broke the first time I used it.
Does this come in blue?
The strap snapped on day two.
EOF
thinkthen filter "$question" \
--replay recording \
--batch 1The zipper broke the first time I used it. The strap snapped on day two.
Batching can still change a fresh answer. The recording reference gives the measurement.
A missing answer fails
A replay never sends. A question the folder lacks stops the run with exit 5. A replay miss shows one. Change the test to a question the folder holds, or save the new answer with a run that has a key.
Find answers no run reads
A folder can keep answers its tests no longer ask. thinkthen cache unused compares the folder with a list of the question keys your tests used. Here the list holds the keys of the four reviews.
e2018162b9b2bf8067a75320fa33d5fd95fbd5544f15b7d2110bc4fed8157d74 fe870f0f866f50ed863214c084754cec1f51b864cdcadf26aac8d98217a5a860 041db1b0797659998ff6f572f13a4c36b24af5c2e4814f7fb22eb6826f82424a d54261252759abb9dbb348f508f0a4fa20078ab9af17054e927a608a59d06a08
thinkthen cache unused recording \
--used used.txtunused from supplied keys: 1 unused 05260f8e83727a0f94c97d688da6f24d6c1d670d9d9db2da756ed83af804b22a
decide --details prints the keys of each record in meta.requests. filter --details leaves out the records it drops. Its keys make an incomplete list. An incomplete list reports answers as unused that a test still reads. The recording specification gives the rules. Pruning removes answers.
Recording and the answer cache · Configuration · Functional patterns
On GitHub: github.com/botassembly/thinkthen