Make the three CV match weights a per-agent setting, applied when a role is served

cv_skills, cv_experience and cv_career live in agents.weights (30, 25, 30 by
default), edited on the Search agents page beside fit and recency. cv_score is
worked out at read time in the feed order, the row and the reader, so changing
them asks the model for nothing and leaves the judge's input_key alone.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Sonnet 5.5 committed 2026-10-03 22:25:44 +02:00
1 parent d5df707148
commit 585c332d74
8 files changed
+147 -28

No files matched your search

+4 -2
View File
@@ -3,8 +3,10 @@
A `ModelTask` beside `summarise`, after the `/rank` of A `ModelTask` beside `summarise`, after the `/rank` of
github.com/MadsLorentzen/ai-job-search: the model reads a posting against a github.com/MadsLorentzen/ai-job-search: the model reads a posting against a
written profile and scores skills, experience and career 0 to 100, with one written profile and scores skills, experience and career 0 to 100, with one
to three strengths and gaps. The total is `app.models.cv_score`, what the to three strengths and gaps. The total is `app.models.cv_score`, the three
feed's Best CV match sorts by. Culture and location are left out: the first numbers under the agent's `cv_*` weights, worked out when a role is served and
not stored, so the weights are no part of `input_key`; it is what the feed's
Best CV match sorts by. Culture and location are left out: the first
is guessed from ad text, the second is what the gates do. is guessed from ad text, the second is what the gates do.
The work is pairs, `(agent, role)`: an enabled agent with a CV, and a role The work is pairs, `(agent, role)`: an enabled agent with a CV, and a role
+24 -7
View File
@@ -1007,21 +1007,31 @@ def language_flag(required: list[RoleLanguage],
return "", "" return "", ""
def cv_score(skills: int, experience: int, career: int) -> float: def cv_score(skills: int, experience: int, career: int,
"""The one number of a CV match, 0 to 100: skills and career weigh 30, weights: "Weights | None" = None) -> float | None:
experience 25 (docs/decisions.md, the CV match).""" """The one number of a CV match, 0 to 100: the three numbers of the
return round((30 * skills + 25 * experience + 30 * career) / 85, 1) judge averaged by the agent's `cv_skills`, `cv_experience` and
`cv_career` weights (30, 25 and 30 by default). None when all three
weights are 0."""
w = weights or Weights()
total = w.cv_skills + w.cv_experience + w.cv_career
if not total:
return None
return round((w.cv_skills * skills + w.cv_experience * experience
+ w.cv_career * career) / total, 1)
class Judgement(Model): class Judgement(Model):
"""What `judge` read of one role for one agent (`role_judgements`): the """What `judge` read of one role for one agent (`role_judgements`): the
three dimensions 0 to 100, `cv_score` (`cv_score`), and 1 to 3 strengths three dimensions 0 to 100, `cv_score` (`cv_score`) and 1 to 3 strengths
and gaps grounded in the posting.""" and gaps grounded in the posting. `cv_score` is not read from the table:
`Store.judgement` sets it from the agent's weights; None when all three
are 0."""
skills: int skills: int
experience: int experience: int
career: int career: int
cv_score: float cv_score: float | None = None
strengths: JsonStrings = [] strengths: JsonStrings = []
gaps: JsonStrings = [] gaps: JsonStrings = []
judged_at: str judged_at: str
@@ -1403,6 +1413,13 @@ class Weights(Model):
affinity: float = Field(0.2, ge=0) affinity: float = Field(0.2, ge=0)
#: Cosine to the liked-minus-passed direction of the agent's votes. #: Cosine to the liked-minus-passed direction of the agent's votes.
taste: float = Field(0.2, ge=0) taste: float = Field(0.2, ge=0)
#: How much each of the judge's three numbers counts in `cv_score`. Not
#: a score term: they are read when a role is served, so changing them
#: asks the model for nothing. 0 leaves a number out, all three 0 means
#: no `cv_score`.
cv_skills: float = Field(30, ge=0, le=1000, allow_inf_nan=False)
cv_experience: float = Field(25, ge=0, le=1000, allow_inf_nan=False)
cv_career: float = Field(30, ge=0, le=1000, allow_inf_nan=False)
class Limits(Model): class Limits(Model):
+10 -2
View File
@@ -33,7 +33,8 @@
const { api, count, remoteHelpers: rh } = window; const { api, count, remoteHelpers: rh } = window;
const $ = (sel, root = document) => root.querySelector(sel); const $ = (sel, root = document) => root.querySelector(sel);
const DEFAULT_WEIGHTS = { fit: 0.6, recency: 0.2, affinity: 0.2, taste: 0.2 }; const DEFAULT_WEIGHTS = { fit: 0.6, recency: 0.2, affinity: 0.2, taste: 0.2,
cv_skills: 30, cv_experience: 25, cv_career: 30 };
// What the model reads after a pull, per agent: the best `extract_top` // What the model reads after a pull, per agent: the best `extract_top`
// roles scoring at least `extract_min` get their gate columns filled, the // roles scoring at least `extract_min` get their gate columns filled, the
// best `summarise_top` at `summarise_min` or more a summary. // best `summarise_top` at `summarise_min` or more a summary.
@@ -219,7 +220,8 @@
function weightsLine(row) { function weightsLine(row) {
const w = Object.assign({}, DEFAULT_WEIGHTS, row.weights); const w = Object.assign({}, DEFAULT_WEIGHTS, row.weights);
return `fit ${w.fit} · newness ${w.recency} · companies ${w.affinity} · liked ${w.taste}`; return `fit ${w.fit} · newness ${w.recency} · companies ${w.affinity} · liked ${w.taste}`
+ ` · CV match: skills ${w.cv_skills}, experience ${w.cv_experience}, career ${w.cv_career}`;
} }
// One gate as a phrase: "in Denmark or Sweden", "remote", "with seniority // One gate as a phrase: "in Denmark or Sweden", "remote", "with seniority
@@ -769,6 +771,9 @@
$("#a-recency", f).value = weights.recency; $("#a-recency", f).value = weights.recency;
$("#a-affinity", f).value = weights.affinity; $("#a-affinity", f).value = weights.affinity;
$("#a-taste", f).value = weights.taste; $("#a-taste", f).value = weights.taste;
$("#a-cv-skills", f).value = weights.cv_skills;
$("#a-cv-experience", f).value = weights.cv_experience;
$("#a-cv-career", f).value = weights.cv_career;
$("#a-extract-top", f).value = limits.extract_top; $("#a-extract-top", f).value = limits.extract_top;
$("#a-extract-min", f).value = limits.extract_min; $("#a-extract-min", f).value = limits.extract_min;
$("#a-summarise-top", f).value = limits.summarise_top; $("#a-summarise-top", f).value = limits.summarise_top;
@@ -875,6 +880,9 @@
recency: Number($("#a-recency", f).value), recency: Number($("#a-recency", f).value),
affinity: Number($("#a-affinity", f).value), affinity: Number($("#a-affinity", f).value),
taste: Number($("#a-taste", f).value), taste: Number($("#a-taste", f).value),
cv_skills: Number($("#a-cv-skills", f).value),
cv_experience: Number($("#a-cv-experience", f).value),
cv_career: Number($("#a-cv-career", f).value),
}, },
limits: { limits: {
extract_top: Number($("#a-extract-top", f).value), extract_top: Number($("#a-extract-top", f).value),
+54 -14
View File
@@ -119,14 +119,31 @@ _VOTED_SCORE = ("MIN(1.0, s.score * CASE v.vote WHEN -1 THEN 0.5 "
#: nothing, so `vote` and `voted_at` are NULL: one query shape either way. #: nothing, so `vote` and `voted_at` are NULL: one query shape either way.
_WITH_VOTES = "LEFT JOIN role_votes v ON v.uid = roles.uid AND v.agent_id = ?" _WITH_VOTES = "LEFT JOIN role_votes v ON v.uid = roles.uid AND v.agent_id = ?"
#: The agent's `judge` readings beside every role, the same way: `j.cv_score` #: The agent's `judge` readings beside every role, the same way: `j.skills`,
#: is NULL for a role not judged and with no agent. #: `j.experience` and `j.career` are NULL for a role not judged and with no
#: agent.
_WITH_JUDGEMENTS = ("LEFT JOIN role_judgements j ON j.uid = roles.uid AND j.agent_id = ? " _WITH_JUDGEMENTS = ("LEFT JOIN role_judgements j ON j.uid = roles.uid AND j.agent_id = ? "
"AND j.judged_at IS NOT NULL") "AND j.judged_at IS NOT NULL")
#: The order of Best CV match: the judged roles by `cv_score`, then the rest
#: by score, as `roles` orders them.
_BY_CV = "j.cv_score IS NULL, j.cv_score DESC, " def _cv_sql(weights: Weights | None) -> str:
"""`cv_score` as SQL for one agent's weights, unrounded (`app.models.cv_score`
rounds it): NULL for a role not judged, and for all three weights 0. The
numbers are the model's validated, finite floats, so they are written in
rather than bound, the select's placeholders being then no concern."""
w = weights or Weights()
total = w.cv_skills + w.cv_experience + w.cv_career
if not total:
return "NULL"
return (f"(({w.cv_skills!r} * j.skills + {w.cv_experience!r} * j.experience "
f"+ {w.cv_career!r} * j.career) / {total!r})")
def _by_cv(expression: str) -> str:
"""The order of Best CV match: the judged roles by `cv_score` (its SQL
`expression`), then the rest by score, as `roles` orders them."""
return f"{expression} IS NULL, {expression} DESC, "
#: How many days after today the feed's Closing soon filter reaches. #: How many days after today the feed's Closing soon filter reaches.
CLOSING_DAYS = 4 CLOSING_DAYS = 4
@@ -880,7 +897,8 @@ class Store:
def role(self, uid: str, agent_id: int | None = None) -> ScoredRole | None: def role(self, uid: str, agent_id: int | None = None) -> ScoredRole | None:
"""One role with its tags, and with `vote`, `voted_at`, `score`, """One role with its tags, and with `vote`, `voted_at`, `score`,
`gated_reason` and `prompt` as `agent_id` judged and scored it, and `gated_reason` and `prompt` as `agent_id` judged and scored it, and
its `judgement`, `cv_score` and language flag for that agent; None its `judgement`, `cv_score` (under the agent's weights as they are
now) and language flag for that agent; None
(unjudged, unscored) without an agent. The score is moved by the vote (unjudged, unscored) without an agent. The score is moved by the vote
as `roles` serves it.""" as `roles` serves it."""
row = self._row( row = self._row(
@@ -1122,7 +1140,8 @@ class Store:
With `by_cv` as well, the roles the agent's `judge` read come first With `by_cv` as well, the roles the agent's `judge` read come first
by `cv_score`, then the others by score (Best CV match). Every row by `cv_score`, then the others by score (Best CV match). Every row
carries the agent's `cv_score` (None when not judged) and the carries the agent's `cv_score` (None when not judged), computed
from the three numbers under the agent's weights at read time, and the
language flag of its languages against the agent's language flag of its languages against the agent's
(`language_flag`). `closing` keeps the roles whose `deadline` falls (`language_flag`). `closing` keeps the roles whose `deadline` falls
today or in the next `CLOSING_DAYS` days. today or in the next `CLOSING_DAYS` days.
@@ -1138,12 +1157,14 @@ class Store:
judged=judged, pay=pay, company_keys=company_keys, places=places, judged=judged, pay=pay, company_keys=company_keys, places=places,
seniority=seniority, seniority_unknown=seniority_unknown, pay_unknown=pay_unknown, seniority=seniority, seniority_unknown=seniority_unknown, pay_unknown=pay_unknown,
closing=closing) closing=closing)
select = "SELECT roles.*, v.vote, v.voted_at, j.cv_score" weights = self._weights_of(agent)
cv = _cv_sql(weights)
select = f"SELECT roles.*, v.vote, v.voted_at, {cv} AS cv_score"
order = "roles.posted_at DESC, roles.uid" order = "roles.posted_at DESC, roles.uid"
scored = agent is not None and by_score scored = agent is not None and by_score
if scored: if scored:
select += f", {_VOTED_SCORE} AS score, s.gated_reason, s.prompt" select += f", {_VOTED_SCORE} AS score, s.gated_reason, s.prompt"
order = (_BY_CV if by_cv else "") + "score DESC, " + order order = (_by_cv(cv) if by_cv else "") + "score DESC, " + order
elif open_only: elif open_only:
# Newest first, open only: idx_roles_posted covers this exactly # Newest first, open only: idx_roles_posted covers this exactly
# (posted_at DESC, uid, WHERE closed_at IS NULL), so it earns the # (posted_at DESC, uid, WHERE closed_at IS NULL), so it earns the
@@ -1162,8 +1183,15 @@ class Store:
r.tags = by_uid.get(r.uid, []) r.tags = by_uid.get(r.uid, [])
r.remote_where = areas.get(r.uid, "") r.remote_where = areas.get(r.uid, "")
r.lang_flag, r.lang_note = language_flag(r.languages_required, mine) r.lang_flag, r.lang_note = language_flag(r.languages_required, mine)
if r.cv_score is not None:
r.cv_score = round(r.cv_score, 1)
return found return found
def _weights_of(self, agent_id: int | None) -> Weights | None:
"""The agent's weights, None with no agent."""
found = self.agent(agent_id) if agent_id is not None else None
return found.weights if found else None
def _languages_of(self, agent_id: int | None) -> list[CvLanguage]: def _languages_of(self, agent_id: int | None) -> list[CvLanguage]:
"""The languages the agent's CV states, [] with no agent.""" """The languages the agent's CV states, [] with no agent."""
found = self.agent(agent_id) if agent_id is not None else None found = self.agent(agent_id) if agent_id is not None else None
@@ -1201,18 +1229,19 @@ class Store:
judged=judged, pay=pay, company_keys=company_keys, places=places, judged=judged, pay=pay, company_keys=company_keys, places=places,
seniority=seniority, seniority_unknown=seniority_unknown, pay_unknown=pay_unknown, seniority=seniority, seniority_unknown=seniority_unknown, pay_unknown=pay_unknown,
closing=closing) closing=closing)
cv = _cv_sql(self._weights_of(agent))
select = ( select = (
"SELECT roles.uid, roles.company_key, roles.company, roles.title, roles.place, " "SELECT roles.uid, roles.company_key, roles.company, roles.title, roles.place, "
"roles.country, roles.remote, roles.function, roles.seniority, roles.salary_min, " "roles.country, roles.remote, roles.function, roles.seniority, roles.salary_min, "
"roles.salary_max, roles.currency, roles.salary_text, roles.original_url, " "roles.salary_max, roles.currency, roles.salary_text, roles.original_url, "
"roles.posting_url, roles.posted_at, roles.read_at, roles.deadline, " "roles.posting_url, roles.posted_at, roles.read_at, roles.deadline, "
"roles.languages_required, v.vote, v.voted_at, j.cv_score, " f"roles.languages_required, v.vote, v.voted_at, {cv} AS cv_score, "
f"SUBSTR({_EXCERPT_SOURCE}, 1, {_EXCERPT_RAW}) AS excerpt") f"SUBSTR({_EXCERPT_SOURCE}, 1, {_EXCERPT_RAW}) AS excerpt")
order = "roles.posted_at DESC, roles.uid" order = "roles.posted_at DESC, roles.uid"
scored = agent is not None and by_score scored = agent is not None and by_score
if scored: if scored:
select += f", {_VOTED_SCORE} AS score, s.gated_reason, s.prompt" select += f", {_VOTED_SCORE} AS score, s.gated_reason, s.prompt"
order = (_BY_CV if by_cv else "") + "score DESC, " + order order = (_by_cv(cv) if by_cv else "") + "score DESC, " + order
elif open_only: elif open_only:
# Same reasoning as `roles`: the planner otherwise sorts every # Same reasoning as `roles`: the planner otherwise sorts every
# open role before applying LIMIT. # open role before applying LIMIT.
@@ -1224,6 +1253,8 @@ class Store:
for r in rows: for r in rows:
row = dict(r) row = dict(r)
row["excerpt"] = excerpt(row["excerpt"]) row["excerpt"] = excerpt(row["excerpt"])
if row["cv_score"] is not None:
row["cv_score"] = round(row["cv_score"], 1)
row["lang_flag"], row["lang_note"] = language_flag( row["lang_flag"], row["lang_note"] = language_flag(
role_languages(row.pop("languages_required")), mine) role_languages(row.pop("languages_required")), mine)
found.append(RoleRow.from_row(row)) found.append(RoleRow.from_row(row))
@@ -1859,7 +1890,8 @@ class Store:
experience: int, career: int, strengths: Sequence[str], experience: int, career: int, strengths: Sequence[str],
gaps: Sequence[str]) -> bool: gaps: Sequence[str]) -> bool:
"""Store `judge`'s reading of one role for one agent, replacing the """Store `judge`'s reading of one role for one agent, replacing the
one before, with `cv_score` (`app.models.cv_score`) and its tries one before, with `cv_score` (`app.models.cv_score`, at the default weights: the
table's column is not read, see `judgement`) and its tries
back at 0. False for an unknown role or agent.""" back at 0. False for an unknown role or agent."""
try: try:
with self.transaction() as conn: with self.transaction() as conn:
@@ -1901,12 +1933,20 @@ class Store:
return int(crossed) return int(crossed)
def judgement(self, agent_id: int | None, uid: str) -> Judgement | None: def judgement(self, agent_id: int | None, uid: str) -> Judgement | None:
"""The agent's judgement of one role, None when it has none.""" """The agent's judgement of one role, None when it has none, its
`cv_score` the three numbers under the agent's weights as they are
now, not as stored."""
if agent_id is None: if agent_id is None:
return None return None
row = self._row("SELECT * FROM role_judgements WHERE agent_id = ? AND uid = ? " row = self._row("SELECT * FROM role_judgements WHERE agent_id = ? AND uid = ? "
"AND judged_at IS NOT NULL", (agent_id, uid)) "AND judged_at IS NOT NULL", (agent_id, uid))
return Judgement.from_row(row) if row else None if row is None:
return None
found = Judgement.from_row(row)
agent = self.agent(agent_id)
found.cv_score = cv_score(found.skills, found.experience, found.career,
agent.weights if agent else None)
return found
def set_article_text(self, uid: str, text: str) -> Role | None: def set_article_text(self, uid: str, text: str) -> Role | None:
"""Store the posting page as plain text and stamp `article_at`. The """Store the posting page as plain text and stamp `article_at`. The
+7
View File
@@ -106,6 +106,13 @@
<label>Companies you like <input type="number" id="a-affinity" min="0" step="0.05" value="0.2"></label> <label>Companies you like <input type="number" id="a-affinity" min="0" step="0.05" value="0.2"></label>
<label>Roles you liked <input type="number" id="a-taste" min="0" step="0.05" value="0.2"></label> <label>Roles you liked <input type="number" id="a-taste" min="0" step="0.05" value="0.2"></label>
</fieldset> </fieldset>
<fieldset class="weights">
<legend>How much each counts in the CV match</legend>
<label>Skills <input type="number" id="a-cv-skills" min="0" step="5" value="30"></label>
<label>Experience <input type="number" id="a-cv-experience" min="0" step="5" value="25"></label>
<label>Career <input type="number" id="a-cv-career" min="0" step="5" value="30"></label>
</fieldset>
<span class="hint">The judge's three numbers are averaged with these shares into the CV match. Changing them re-sorts at once and asks the model for nothing; 0 leaves a number out, all three 0 means no CV match.</span>
<fieldset class="weights limits"> <fieldset class="weights limits">
<legend>What the model reads</legend> <legend>What the model reads</legend>
<label>Extract the best <input type="number" id="a-extract-top" min="0" step="10" value="500"></label> <label>Extract the best <input type="number" id="a-extract-top" min="0" step="10" value="500"></label>
+1 -1
View File
@@ -5,7 +5,7 @@ Written 2026-10-03. Taken from the `/rank` of github.com/MadsLorentzen/ai-job-se
## What the owner gets ## What the owner gets
- **Per agent, optional:** a CV (pasted, or a `.md`/`.txt` file read into the box by the browser), the languages it states with a level (a model suggests them from the CV once, the owner edits them), an "avoid / drains me" text (what drains energy, environments to avoid) and a "must-haves and deal-breakers" text (conditions such as security, flexibility, room to develop). The prompts stay "what I want and what excites me". Hard rules stay gates; the two texts are soft and read by the judge only. - **Per agent, optional:** a CV (pasted, or a `.md`/`.txt` file read into the box by the browser), the languages it states with a level (a model suggests them from the CV once, the owner edits them), an "avoid / drains me" text (what drains energy, environments to avoid) and a "must-haves and deal-breakers" text (conditions such as security, flexibility, room to develop). The prompts stay "what I want and what excites me". Hard rules stay gates; the two texts are soft and read by the judge only.
- **A third sort, "Best CV match"**, beside Best first and Newest first: one number 0 to 100, `(30 * skills + 25 * experience + 30 * career) / 85`, from a new model stage `judge`. The reader shows the three numbers, 1 to 3 strengths and 1 to 3 gaps. - **A third sort, "Best CV match"**, beside Best first and Newest first: one number 0 to 100, from a new model stage `judge`: the weighted mean of skills, experience and career, by default `(30 * skills + 25 * experience + 30 * career) / 85`. The three weights are per agent (`cv_skills`, `cv_experience`, `cv_career` in `agents.weights`, edited next to fit and recency) and applied when a role is served, so changing them needs no model call and does not change the `input_key`; 0 leaves a number out, all three 0 means no CV match. The reader shows the three numbers, 1 to 3 strengths and 1 to 3 gaps.
- **A language flag** on the row and in the reader: ⚠ when a posting requires a language the agent's languages lack or states a level above the agent's, ★ when it names one of the agent's languages as a plus. Deterministic, at read time; no flag when the agent has no languages. - **A language flag** on the row and in the reader: ⚠ when a posting requires a language the agent's languages lack or states a level above the agent's, ★ when it names one of the agent's languages as a plus. Deterministic, at read time; no flag when the agent has no languages.
- **A deadline**: a column, a "Closing soon" filter (today to today + 4 days), a badge "closes in N d" within those 4 days, and the date in the reader. - **A deadline**: a column, a "Closing soon" filter (today to today + 4 days), a badge "closes in N d" within those 4 days, and the date in the reader.
+45 -1
View File
@@ -16,7 +16,8 @@ from fastapi.testclient import TestClient
from app.config import Config, ServerConfig from app.config import Config, ServerConfig
from app.main import create_app from app.main import create_app
from app.models import CvLanguage, Prompt from app.jobs.judge import input_key
from app.models import CvLanguage, Prompt, Weights, cv_score
from app.storage import Store from app.storage import Store
from desk.models import Item from desk.models import Item
from desk.tools import agent from desk.tools import agent
@@ -90,6 +91,49 @@ def test_best_cv_match_puts_the_judged_first_by_cv_score(
"order": "best"}).status_code == 422 "order": "best"}).status_code == 422
def test_the_agents_weights_make_the_cv_score_at_read_time(
client: TestClient, store: Store) -> None:
owner, uid = setup(store)
# c: skills 100, experience 0, career 0; b: 60 on all three.
store.set_judgement(owner.id, uid["c"], "k", 100, 0, 0, ["Leads data."], ["Small team."])
key_before = input_key(owner, "text")
def asked() -> tuple[list[tuple[str, float | None]], float | None]:
rows = client.get("/api/roles", params={"agent": owner.id, "order": "cv"}).json()
one = client.get(f"/api/roles/{uid['c']}", params={"agent": owner.id}).json()
assert one["cv_score"] == one["judgement"]["cv_score"]
return [(r["uid"], r["cv_score"]) for r in rows["items"]], one["cv_score"]
rows, one = asked()
assert rows[:2] == [(uid["b"], 60.0), (uid["c"], round(3000 / 85, 1))] and one == 35.3
def weigh(**w: float) -> None:
store.save_agent("Data", prompts=owner.prompts, agent_id=owner.id,
weights=Weights(**w), cv_text=owner.cv_text)
weigh(cv_skills=1, cv_experience=0, cv_career=0)
rows, one = asked()
assert rows[:2] == [(uid["c"], 100.0), (uid["b"], 60.0)] and one == 100.0
weigh(cv_skills=0, cv_experience=0, cv_career=0)
rows, one = asked()
assert [c for _, c in rows] == [None, None, None] and one is None
assert [u for u, _ in rows] == [uid["a"], uid["b"], uid["c"]], "by score, as none is judged"
assert client.get(f"/api/roles/{uid['c']}",
params={"agent": owner.id}).json()["judgement"]["skills"] == 100
refreshed = store.agent(owner.id)
assert refreshed is not None and input_key(refreshed, "text") == key_before, \
"the weights are no part of what the judge read"
def test_the_weights_are_per_agent_json_with_the_old_values_as_default(store: Store) -> None:
owner = store.save_agent("Data", prompts=[Prompt(name="Lead", text="Head of data")])
assert (owner.weights.cv_skills, owner.weights.cv_experience,
owner.weights.cv_career) == (30, 25, 30)
assert cv_score(80, 60, 40, owner.weights) == round((2400 + 1500 + 1200) / 85, 1)
assert cv_score(80, 60, 40, Weights(cv_skills=0, cv_experience=1, cv_career=1)) == 50.0
assert cv_score(80, 60, 40, Weights(cv_skills=0, cv_experience=0, cv_career=0)) is None
def test_a_row_carries_the_deadline_and_the_language_flag( def test_a_row_carries_the_deadline_and_the_language_flag(
client: TestClient, store: Store) -> None: client: TestClient, store: Store) -> None:
owner, uid = setup(store) owner, uid = setup(store)
+2 -1
View File
@@ -1084,7 +1084,8 @@ def test_agents_are_created_updated_listed_and_deleted(client: TestClient) -> No
created = client.post("/api/agents", json=body) created = client.post("/api/agents", json=body)
assert created.status_code == 200 assert created.status_code == 200
agent = created.json() agent = created.json()
assert agent["weights"] == {"fit": 0.6, "recency": 0.2, "affinity": 0.2, "taste": 0.2} assert agent["weights"] == {"fit": 0.6, "recency": 0.2, "affinity": 0.2, "taste": 0.2,
"cv_skills": 30, "cv_experience": 25, "cv_career": 30}
assert agent["gates"][0]["weight"] == 1.0 assert agent["gates"][0]["weight"] == 1.0
updated = client.post("/api/agents", json={**body, "id": agent["id"], "enabled": False, updated = client.post("/api/agents", json={**body, "id": agent["id"], "enabled": False,