Replace Batch API vision classification with inline classification in the fetch job #84
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
PR #81 shipped vision classification as a nightly Batch API job (
ai_batch.py+ anai_vision_batchcron). That should change: the Batch API gives no completion-time guarantee, so "classified by 5am" can't be met reliably.Why. Moonshot's Batch API only guarantees a job expires if it doesn't finish within
completion_window(12h/1d/3d); it makes no promise about when within that window it runs (docs describe it as for "low real-time requirements"). Empirically, a 2-image test batch satin_progressfor 5+ hours with 0/2 done. The 40% batch discount is ~$0.24/week at our volume — not worth losing deterministic completion.Decision. Classify images inline in the stream update job, immediately after the text check:
Work items.
ai_batch.pyJSONL/sharding/upload/poll) and theai_vision_batchcron job._classify_fetched_text), classifying the first image of each newly-fetched, text-passing post viaVisionClassifier.classify()(real-time single request).AI_BATCH_HOURsetting.ai_would_reject = NULL("pending"), notFalse("pass") — the currentai_batch.pysetsFalseon download failure..superpowersspec/plan to drop Batch API references.Agreed consequences.
Files that reference the batch approach (for when this is picked up):
.superpowers/specs/2026-08-13-fenliu-vision-ai-design.md— sections 5 (architecture diagram) and 8 (ai_batch.py), plus the "vision-in-batch unconfirmed" risk note..superpowers/plans/2026-08-13-fenliu-vision-ai.md— Task 5 (ai_batch.py) and Task 6 (scheduler wiring).packages/fenliu/src/fenliu/services/ai_batch.py— the batch processor (JSONL build/shard/upload/poll) to be replaced by a simple inline classify loop.packages/fenliu/src/fenliu/services/scheduler.py—_schedule_ai_batch_job/_ai_batch_jobcron to be removed; the vision step moves into_fetch_stream_jobafter_classify_fetched_text.packages/fenliu/src/fenliu/config.py—ai_batch_hourto be removed.packages/fenliu/docs/user-guide/ai-classification.md— batch references to update.