Two levels of work
The outer graph starts with fetch. route_to_articles then creates one LangGraph Send task per item. Each task receives its own FeedItem; result and error lists use additive reducers so parallel branches can contribute without replacing earlier results. This structure makes a run over many articles conceptually different from the workflow for one article.
The per-article graph is currently linear. Translation produces a title and body for each configured language, reusing the original text when the source language is already a target. Categorization chooses one configured label. Summarization runs on each language version, evaluation scores the produced material, and embedding prepares text for search. Persistence is the final node in normal ingestion.
graph.add_edge(START, "translate")
graph.add_edge("translate", "categorize")
graph.add_edge("categorize", "summarize")
graph.add_edge("summarize", "evaluate")
graph.add_edge("evaluate", "embed")
graph.add_edge("embed", "persist")
graph.add_edge("persist", END)State makes dependencies explicit
ArticleState carries the item and, as nodes complete, translations, category, summaries, evaluation, embeddings, and finally the database ID. Nodes return only the keys they produce. The require helper turns a missing prerequisite into a clear KeyError rather than allowing a later lookup to fail obscurely.
The Deps object supplies settings, the database pool, task-specific chat models, an embedding provider, and a shared semaphore. Language-level translation and summary calls use asyncio.gather; the semaphore limits concurrent model and embedding requests across graph work. This controls bursts, but there is no provider-specific rate-limit policy or retry/backoff loop in the nodes.
Prompts and provider choices
The prompts name the task, constrain the requested output, and tell the model to treat article text as untrusted data rather than instructions. Translation, category selection, and evaluation request JSON; parse_json_object extracts a JSON object and can repair a limited number of missing closing braces. These steps improve format handling, but they do not prove that the content is factually correct.
A provider factory selects either Mistral, OpenAI-compatible chat endpoints, or a deterministic stub. Mistral can use separate model settings for translation, categorization, summarization, and evaluation; the OpenAI chat option uses one configured model for all four. Stub mode enables an offline smoke test, but its translations are labels, its categorizer is keyword-based, and its embeddings are hashed token vectors.
A score is a review signal, not a proof
The evaluator returns a score that the code clamps to 0–10. Wassla derives the stored verdict from EVAL_MIN_SCORE (6 by default); it does not branch back to a model for correction. Low-scoring articles are still embedded and stored, with status needs_review, so the score marks editorial attention rather than filtering the collection.
There is an important scope limit in the current evaluation payload: it includes the original title and only the first 2,000 characters of the original body, plus translated titles and summaries. It does not include translated article bodies. Therefore the score cannot be read as a full-body translation audit. An invalid category is replaced with the first configured category, another fallback that favors pipeline completion over a visible classification failure.