Fetch terms narrow what big boards read with the wide reach send (WP F2)
An agent has fetch_terms (migration 23, API, a chip field in the agent
editor). The terms of a pull are the union over the enabled agents, none
when one of them has none. They go only to wide reads: a company tagged All
roles, or a reach ask_for drops as too many countries for a one host; a
board's {"terms": false} switches them off. SmartRecruiters q,
SuccessFactors q, Workday searchText, Phenom keywords, Eightfold query and
Oracle keyword declare query="one"; the runner makes one series per term
times the country series, drops the places first over MAX_SERIES, then the
terms. A term read is narrowed: it writes no ats:size, closes nothing and
prunes no per-role state, and the 10% guard holds it to its own
fingerprint. The Companies reach line counts the terms.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3917b31209
commit
0fd45b333a
28 files changed
+839
-113
No files matched your search
+13
-6
@@ -26,7 +26,7 @@ from app.models import (
|
||||
ApplicationEvent, Candidate, Company, Gate, Limits, Prompt, Role, RoleCopy, RolePlace,
|
||||
RoleRow, ScoredRole,
|
||||
Subscription, Weights, check_prompts, company_fold, company_key, country_of, excerpt, place_key,
|
||||
host_word, posted_at, posted_host, remote_of, title_key,
|
||||
fetch_terms as normal_terms, host_word, posted_at, posted_host, remote_of, title_key,
|
||||
)
|
||||
from app.storage import gazetteer, schema
|
||||
|
||||
@@ -1712,10 +1712,13 @@ class Store:
|
||||
def save_agent(self, name: str, intent: str = "", gates: Sequence[Gate] = (),
|
||||
weights: Weights | None = None, enabled: bool = True,
|
||||
agent_id: int | None = None, limits: Limits | None = None,
|
||||
prompts: Sequence[Prompt] | None = None) -> Agent:
|
||||
prompts: Sequence[Prompt] | None = None,
|
||||
fetch_terms: Sequence[str] | None = None) -> Agent:
|
||||
"""Create an agent, or with `agent_id` replace that one's fields and
|
||||
prompts. Without `prompts`, a non-empty `intent` is its one prompt,
|
||||
named after the agent. A prompt whose text is unchanged keeps its
|
||||
named after the agent. Without `fetch_terms` an update keeps the
|
||||
stored ones and a new agent has none, so a caller that does not know
|
||||
them (the CLI's prompt edit) loses none. A prompt whose text is unchanged keeps its
|
||||
cached vector, whatever its name or place, so an edit re-embeds only
|
||||
the prompts it changed. Raises ValueError on an empty or taken name,
|
||||
or two prompts of one name, KeyError on an unknown id."""
|
||||
@@ -1725,18 +1728,22 @@ class Store:
|
||||
if prompts is None:
|
||||
prompts = [Prompt(name=name, text=intent)] if intent.strip() else []
|
||||
prompts = check_prompts(list(prompts))
|
||||
terms = None if fetch_terms is None else json.dumps(
|
||||
normal_terms(list(fetch_terms)), ensure_ascii=False)
|
||||
fields = (name, json.dumps([g.model_dump() for g in gates]),
|
||||
(weights or Weights()).model_dump_json(),
|
||||
(limits or Limits()).model_dump_json(), int(enabled))
|
||||
(limits or Limits()).model_dump_json(), int(enabled), terms)
|
||||
try:
|
||||
with self.transaction() as conn:
|
||||
if agent_id is None:
|
||||
agent_id = conn.execute(
|
||||
"""INSERT INTO agents (name, gates, weights, limits, enabled,
|
||||
created_at) VALUES (?,?,?,?,?,?)""",
|
||||
fetch_terms, created_at)
|
||||
VALUES (?,?,?,?,?,COALESCE(?, '[]'),?)""",
|
||||
(*fields, self.now())).lastrowid
|
||||
elif not conn.execute(
|
||||
"""UPDATE agents SET name=?, gates=?, weights=?, limits=?, enabled=?
|
||||
"""UPDATE agents SET name=?, gates=?, weights=?, limits=?, enabled=?,
|
||||
fetch_terms=COALESCE(?, fetch_terms)
|
||||
WHERE id=?""",
|
||||
(*fields, agent_id)).rowcount:
|
||||
raise KeyError(agent_id)
|
||||
|
||||
Reference in new issue
Block a user