Score each role's closeness to the agent's CV, let the judge also read the 50 closest the score leaves out, and order CV match's unjudged roles by it
The CV is cut into chunks inside e5's window, embedded like a prompt and cached per agent under a hash of the model, chunking and text. A role's cv_fit (scores.cv_fit, migration 31) is its best chunk cosine, scaled with its own calibration band: fit's clipped 88 of agent 2's ungated roles to 1. It is no term of the Agent match score. judge_cv_top (default 50) sits beside judge_top and judge_min on the agents page and card. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b481cb5692
commit
c23594507a
23 files changed
+603
-85
No files matched your search
@@ -387,6 +387,8 @@ CREATE TABLE IF NOT EXISTS role_votes (
|
||||
|
||||
-- A role is scored per agent. A gated role keeps its row, with the reason.
|
||||
-- prompt names the agent's prompt that gave the fit, '' when fit did not count.
|
||||
-- cv_fit is how close the role is to the agent's CV, 0..1, NULL without a CV
|
||||
-- or a vector and for a gated role; it is no term of score.
|
||||
CREATE TABLE IF NOT EXISTS scores (
|
||||
uid TEXT NOT NULL REFERENCES roles(uid) ON DELETE CASCADE,
|
||||
agent_id INTEGER NOT NULL REFERENCES agents(id) ON DELETE CASCADE,
|
||||
@@ -394,9 +396,21 @@ CREATE TABLE IF NOT EXISTS scores (
|
||||
gated_reason TEXT NOT NULL DEFAULT '',
|
||||
scored_at TEXT NOT NULL,
|
||||
prompt TEXT NOT NULL DEFAULT '',
|
||||
cv_fit REAL,
|
||||
PRIMARY KEY (uid, agent_id)
|
||||
);
|
||||
|
||||
-- The vectors of an agent's CV, one per chunk in order, for scores.cv_fit.
|
||||
-- vec_key is sha1 of the embedding model, the chunking and the CV text, the
|
||||
-- same on every row of an agent, so an unchanged CV is not embedded again.
|
||||
CREATE TABLE IF NOT EXISTS agent_cv_vectors (
|
||||
agent_id INTEGER NOT NULL REFERENCES agents(id) ON DELETE CASCADE,
|
||||
position INTEGER NOT NULL,
|
||||
vec_key TEXT NOT NULL,
|
||||
vec BLOB NOT NULL,
|
||||
PRIMARY KEY (agent_id, position)
|
||||
);
|
||||
|
||||
-- One agent's judge reading of a role against its CV. Its own table, since
|
||||
-- replace_scores rewrites scores every run and a judgement outlives that
|
||||
-- and the role closing. skills, experience and career are 0 to 100,
|
||||
@@ -713,6 +727,10 @@ UPDATE roles SET seniority = COALESCE(NULLIF(seniority_model, ''),
|
||||
# reads every role again (judge.FORMAT).
|
||||
(30, "agents.like_text: what the person likes, beside what they do not like",
|
||||
lambda conn: _add_like_text(conn)),
|
||||
# A Python step: it adds the column and the table only where they are
|
||||
# missing. The next score fills them.
|
||||
(31, "scores.cv_fit and agent_cv_vectors: how close each role is to the agent's CV",
|
||||
lambda conn: _add_cv_fit(conn)),
|
||||
)
|
||||
|
||||
#: What a file created from `SCHEMA` today is already at.
|
||||
@@ -1061,6 +1079,21 @@ def _add_like_text(conn: sqlite3.Connection) -> None:
|
||||
conn.execute("ALTER TABLE agents ADD COLUMN like_text TEXT NOT NULL DEFAULT ''")
|
||||
|
||||
|
||||
def _add_cv_fit(conn: sqlite3.Connection) -> None:
|
||||
"""Migration 31's step: `scores.cv_fit`, NULL on every row until the
|
||||
next score, and `agent_cv_vectors`, empty until then. Runs twice without
|
||||
harm."""
|
||||
columns = {r[1] for r in conn.execute("PRAGMA table_info(scores)")}
|
||||
if "cv_fit" not in columns:
|
||||
conn.execute("ALTER TABLE scores ADD COLUMN cv_fit REAL")
|
||||
conn.execute("""CREATE TABLE IF NOT EXISTS agent_cv_vectors (
|
||||
agent_id INTEGER NOT NULL REFERENCES agents(id) ON DELETE CASCADE,
|
||||
position INTEGER NOT NULL,
|
||||
vec_key TEXT NOT NULL,
|
||||
vec BLOB NOT NULL,
|
||||
PRIMARY KEY (agent_id, position))""")
|
||||
|
||||
|
||||
def _add_all_roles(conn: sqlite3.Connection) -> None:
|
||||
"""Migration 21's step. The column; the tag for every company that is a
|
||||
favourite of any agent, since favourite no longer widens what a pull
|
||||
|
||||
Reference in new issue
Block a user