Merge pull request 'feat(summarizer): score articles in the map phase, brief only the important ones' (#53) from wt/t_87992985 into master
Some checks failed
build-and-deploy / build-push-deploy (push) Failing after 8s
Some checks failed
build-and-deploy / build-push-deploy (push) Failing after 8s
This commit is contained in:
commit
2c41737d42
8 changed files with 775 additions and 37 deletions
28
docs/news.md
28
docs/news.md
|
|
@ -63,8 +63,29 @@ if `article_summaries` already has a row in the last interval, the summarizer
|
|||
|
||||
The `articles` and `article_summaries` tables are created by the idempotent
|
||||
alembic migration `003_news` (also created by the scraper's own
|
||||
`CREATE TABLE IF NOT EXISTS`). `news_items` is alembic `005_news_items`.
|
||||
Container startup order doesn't matter.
|
||||
`CREATE TABLE IF NOT EXISTS`). `news_items` is alembic `005_news_items` and
|
||||
`article_scores` is `012_article_scores` (also created by the summarizer's own
|
||||
`ensure_tables()`). Container startup order doesn't matter.
|
||||
|
||||
## Grading and selection
|
||||
|
||||
The map phase grades every article 0-100 against the rubric in the map prompt
|
||||
(90-100 breaking geopolitical/military/security or major disaster, 70-89
|
||||
significant national/international news, 40-69 notable regional/economic/tech/
|
||||
health, 10-39 routine crime and local interest, 0-9 noise: sport, celebrity,
|
||||
entertainment, market tape, promotional and event-calendar listings). The
|
||||
summarizer parses the first `Score:` line in each `Article <n>:` block, clamps
|
||||
it to 0-100, and falls back to the `Importance:` label (critical 95, high 78,
|
||||
medium 50, low 22, none 5) when the line is missing or unparsable — a block is
|
||||
never dropped and the fallback count is logged per batch. Only blocks scoring
|
||||
`>= SUMMARY_MIN_SCORE` (default 60) reach the reduce prompt, best first, capped
|
||||
at `SUMMARY_TOP_N` (default 12). If nothing clears the bar the top
|
||||
`SUMMARY_FALLBACK_TOP` blocks (default 3) are used so the HUD is not blank;
|
||||
`SUMMARY_FALLBACK_TOP=0` passes an empty DATA section instead. The reduce prompt
|
||||
no longer asks for filler: it leads with the highest-scoring stories and never
|
||||
promotes an item above its score. Every graded article is persisted to
|
||||
`article_scores` (score, category, selected, model, summary_id) so the operator
|
||||
can tune the thresholds against real data.
|
||||
|
||||
## Keys and Settings
|
||||
|
||||
|
|
@ -243,6 +264,9 @@ map. `summary_en` lands in `article_summaries.summary_text`.
|
|||
| `NOUS_BASE_URL` | `https://inference-api.nousresearch.com/v1` | Read-only in Settings. |
|
||||
| `SUMMARY_MODEL` | `Hermes-4.3-36B` | Compose default. Operator-facing choice is Settings → `app_settings.SUMMARY_MODEL`. |
|
||||
| `NEWS_BATCH_SIZE` | `50` | Articles per map-phase batch (compose maps to container `BATCH_SIZE`). |
|
||||
| `SUMMARY_MIN_SCORE` | `60` | Map-phase score a block must reach to enter the reduce brief. |
|
||||
| `SUMMARY_TOP_N` | `12` | Max blocks passed to the reduce phase (best score first). |
|
||||
| `SUMMARY_FALLBACK_TOP` | `3` | Blocks used when nothing clears `SUMMARY_MIN_SCORE`; `0` = empty DATA. |
|
||||
| `SUMMARY_WINDOW_MINUTES` | `15` | How far back the summarizer looks for new articles. |
|
||||
| `NEWS_SCRAPE_INTERVAL_S` | `10` | Pause after each crawl before the next (scraper is otherwise continuous). |
|
||||
| `NEWS_SUMMARIZE_INTERVAL_S` | `900` | Seconds between analyst runs (default 15 min). |
|
||||
|
|
|
|||
Loading…
Reference in a new issue