Summarise and fetch text: a summary stage after score, two role routes

app/jobs/summarise.py is a ModelTask beside extract: about 60 words per role
from title, company, place and the fetched page else the description (capped
at 8000 characters). The pull cascade gains a summarise stage after score that
takes only roles without a summary in the top summarise.per_agent of an
enabled agent's ungated scores, and finds nothing when summarise.enabled is
false or no model is reachable. A reply that leaves a role unanswered is
counted in the state table and the role is given up after three.

POST /api/roles/{uid}/text scrapes original_url once and stores
article_text; POST /api/roles/{uid}/summarise queues a summarise_batch for
that uid alone, deduped per role.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Fable 5.1 committed 2026-09-25 21:39:43 +02:00
1 parent 7d31cca394
commit 9035529e0d
12 files changed
+733 -10

No files matched your search

+17
View File
@@ -49,6 +49,22 @@ class ExtractConfig(ModelTaskConfig):
batch_size: int = Field(20, ge=1)
class SummariseConfig(ModelTaskConfig):
"""About 60 words on a role, for the list and the read page. See
app/jobs/summarise.py. Off by default like extract; on, a pull summarises
only the best `per_agent` of each enabled agent, so the cost is bounded
whatever the backlog. The read page's Summarise button asks for one role
whether this is on or not."""
enabled: bool = False
model: str = "claude-haiku-4-5-20251001"
#: A description is capped at 8000 characters per role, so ten is about
#: 20k tokens of input per call.
batch_size: int = Field(10, ge=1)
#: How deep into each enabled agent's ranking a pull summarises.
per_agent: int = Field(30, ge=0)
class EmbedConfig(Section):
"""Turning a role into a vector for `fit`. Needs sentence-transformers;
without it `embed` says so and does nothing, and `score` leaves fit out.
@@ -109,6 +125,7 @@ class Config(Section):
#: Who answers when a job needs a model. See desk/tools/agent.py.
agent: AgentConfig = Field(default_factory=AgentConfig)
extract: ExtractConfig = Field(default_factory=ExtractConfig)
summarise: SummariseConfig = Field(default_factory=SummariseConfig)
embed: EmbedConfig = Field(default_factory=EmbedConfig)
#: Starter agents, imported once into an empty table.
agents: list[AgentSeed] = Field(default_factory=list)