A pull that brings a role a better text, as fetch text does, puts it back in extract's queue beside dropping its vector, so a role extract read from its title alone is read again from its text.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
7ac63dea7c
commit
0b92f19f4d
3 files changed
+77
-10
No files matched your search
+19
-10
@@ -65,7 +65,8 @@ _EXTRACT_TEXT = ("place", "country", "currency", "permit")
|
||||
GIVE_UP_AFTER = 3
|
||||
|
||||
#: A role `extract` has yet to read: still open, no copy of another
|
||||
#: (`rebuild_dupes`), not given up, and either never answered, without a
|
||||
#: (`rebuild_dupes`), not given up, and either never answered (or answered
|
||||
#: before a better text came, `upsert_role`), without a
|
||||
#: model level, never asked where a remote hire may live
|
||||
#: (`remote_where_model` NULL), or never asked for its languages and deadline
|
||||
#: (`languages_required` NULL). The last three make `extract` the
|
||||
@@ -835,8 +836,9 @@ class Store:
|
||||
the way a board's own structured field is (docs/decisions.md, "a
|
||||
guess is not a board field"). So once a role has been through
|
||||
`extract` (`extracted_at` is set), this upsert leaves `function`
|
||||
alone for good, whatever the plugin's raw guess now says — see
|
||||
`set_extracted` for the other half of the rule.
|
||||
alone, whatever the plugin's raw guess now says, until a better text
|
||||
puts the role back in extract's queue (below) — see `set_extracted`
|
||||
for the other half of the rule.
|
||||
|
||||
The role's places (`role_places`) are the texts of `raw["places"]`,
|
||||
else `raw["place"]` cut at `;` (`gazetteer.texts`), written unresolved
|
||||
@@ -848,9 +850,13 @@ class Store:
|
||||
under the same keep-filled rule. `teaser` is kept-filled too.
|
||||
|
||||
A role is embedded from its description, else its teaser, else its
|
||||
title (`app.jobs.embed.document`). When a pull brings a better one of
|
||||
these than the role had, its vector is dropped so the next `embed`
|
||||
reads it.
|
||||
title (`app.jobs.embed.document`), and `extract` reads the same. When
|
||||
a pull brings a better one of these than the role had, its vector is
|
||||
dropped so the next `embed` reads it, and `extracted_at` and
|
||||
`extract_tries` are reset so `extract` reads it again (if it is still
|
||||
in a cut). That read overwrites the model's own columns and fills
|
||||
what is still empty (`set_extracted`); until it comes, `function` is
|
||||
the plugin's guess's again, as for any role not yet read.
|
||||
"""
|
||||
if not item.source:
|
||||
raise ValueError(f"item {item.source_id!r} has no source; the runner sets it")
|
||||
@@ -937,14 +943,17 @@ class Store:
|
||||
if before is not None:
|
||||
conn.execute("UPDATE roles SET prep_due = prep_due + 1 WHERE uid = ?",
|
||||
(row["uid"],))
|
||||
# `embed` encodes a role once, from the best text it has. When a
|
||||
# later pull brings a better one, as a host that states the text
|
||||
# on the role's own page does, the vector goes, so the next
|
||||
# `embed` reads it.
|
||||
# `embed` encodes a role once, from the best text it has, and
|
||||
# `extract` reads it once. When a later pull brings a better one,
|
||||
# as fetch text does for a host that states the text on the
|
||||
# role's own page, the vector goes and the role waits for
|
||||
# extract again, so both read the new text.
|
||||
if before is not None and _text_rank(row["description"] or before["description"],
|
||||
row["teaser"] or before["teaser"]) \
|
||||
> _text_rank(before["description"], before["teaser"]):
|
||||
conn.execute("DELETE FROM vectors WHERE uid=?", (row["uid"],))
|
||||
conn.execute("UPDATE roles SET extracted_at = NULL, extract_tries = 0 "
|
||||
"WHERE uid=?", (row["uid"],))
|
||||
return before is None
|
||||
|
||||
def role(self, uid: str, agent_id: int | None = None) -> ScoredRole | None:
|
||||
|
||||
Reference in new issue
Block a user