osint-dashboard/news/summerizer
Repository files (latest commit first)
Filename Latest commit message Latest commit date
backend 625c935c80 fix(summarizer): fail loudly on a rejected model id; parallel map phase
The analyst produced no briefs for nine days because SUMMARY_MODEL had been
retired: every chat completion returned 404, nous_client.chat() swallowed it
into "", and the map phase "succeeded" with zero blocks.

- nous_client.chat(): log status_code + a 500-char body slice for every
  non-200. 400/404/422 now raise NousAPIError (bad model id / payload cannot
  succeed on a retry); 429/5xx are retried with backoff inside the call;
  401/other keep the old empty-return contract.
- Startup validation: one GET /models per process; if SUMMARY_MODEL is absent
  the run logs an ERROR with the configured id plus near matches and returns
  rc=2 before issuing any chat call. Fails open (warning) when /models itself
  is unreachable.
- Map phase: ThreadPoolExecutor fan-out capped by SUMMARY_MAP_CONCURRENCY
  (default 16). Grading still runs in batch order on the main thread; reduce
  stays serial; the 60 s per-call timeout is unchanged.
- summarize_news() now returns an exit code and __main__ sys.exit()s it:
  zero parsed map blocks, an empty reduce, or an unpersisted brief all exit
  non-zero. The scheduler logs rc at ERROR when it is not 0.
- Map calls start at 8192 completion tokens (they escalate to 16384): ~60% of
  real batches overflowed 4096 and were regenerated at 8192, doubling their
  wall time for no benefit.

Measured on the real backlog: NEWS_RECAP=1 NEWS_SUMMARIZE_FORCE=1
python summarizer.py over 2984 articles / 746 batches finished in 951 s
(15m51s), rc=0, 746/746 batches non-empty, 0 warnings.

Prompts, BATCH_SIZE=4, grading/rubric behaviour and the DB schema are
untouched (article_summaries.kind stays interval / daily_recap).
2026-12-04 23:34:54 -05:00
..
data news: per-article proximate geolocation + GET /api/news/blips 2026-11-19 22:50:59 -05:00
tests fix(summarizer): fail loudly on a rejected model id; parallel map phase 2026-12-04 23:34:54 -05:00
.dockerignore Add news pipeline: hourly scraper + Gemini summarizer in compose 2026-08-24 17:28:46 -04:00
Dockerfile news: per-article proximate geolocation + GET /api/news/blips 2026-11-19 22:50:59 -05:00
gazetteer.py news: per-article proximate geolocation + GET /api/news/blips 2026-11-19 22:50:59 -05:00
intel.py news: per-article proximate geolocation + GET /api/news/blips 2026-11-19 22:50:59 -05:00
nous_client.py fix(summarizer): fail loudly on a rejected model id; parallel map phase 2026-12-04 23:34:54 -05:00
requirements.txt chore: point news-summarizer compose at Nous portal 2026-08-28 17:06:55 -04:00
run_news_summarizer.py fix(summarizer): fail loudly on a rejected model id; parallel map phase 2026-12-04 23:34:54 -05:00
summarizer.py fix(summarizer): fail loudly on a rejected model id; parallel map phase 2026-12-04 23:34:54 -05:00