Let the model report a verdict per must-have and cap career at 39 in code when one is broken
The judge numbers an agent's must-haves (one per line) and answers met, broken or unclear for each; career is stored as the model gave it and counts as at most BROKEN_CAP when a role is served, in cv_score, Store.judgement and the SQL of Best CV match. Migration 29 adds role_judgements.musts and broken; the judge's input_key carries a format version so earlier judgements are made again. The reader lists the must-haves with their verdicts and the cap. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
64fecf57ad
commit
001fc9002b
19 files changed
+336
-61
No files matched your search
@@ -91,6 +91,37 @@ def test_best_cv_match_puts_the_judged_first_by_cv_score(
|
||||
"order": "best"}).status_code == 422
|
||||
|
||||
|
||||
def test_a_broken_must_have_caps_career_in_the_order_and_the_reader(
|
||||
client: TestClient, store: Store) -> None:
|
||||
owner, uid = setup(store)
|
||||
# c: 90 on all three, but one must-have broken: career counts as 39.
|
||||
musts = [{"id": "M1", "text": "Permanent", "verdict": "met"},
|
||||
{"id": "M2", "text": "Remote", "verdict": "broken"}]
|
||||
store.set_judgement(owner.id, uid["c"], "k", 90, 90, 90, [], [], musts)
|
||||
capped = round((30 * 90 + 25 * 90 + 30 * 39) / 85, 1)
|
||||
rows = client.get("/api/roles", params={"agent": owner.id, "order": "cv"}).json()["items"]
|
||||
assert [(r["uid"], r["cv_score"]) for r in rows[:2]] == [(uid["c"], capped), (uid["b"], 60.0)]
|
||||
# With career weighted up the capped value drops under b's 60.
|
||||
store.save_agent("Data", prompts=owner.prompts, agent_id=owner.id, cv_text=owner.cv_text,
|
||||
weights=Weights(cv_skills=0, cv_experience=0, cv_career=1))
|
||||
rows = client.get("/api/roles", params={"agent": owner.id, "order": "cv"}).json()["items"]
|
||||
assert [(r["uid"], r["cv_score"]) for r in rows[:2]] == [(uid["b"], 60.0), (uid["c"], 39.0)]
|
||||
one = client.get(f"/api/roles/{uid['c']}", params={"agent": owner.id}).json()
|
||||
j = one["judgement"]
|
||||
assert (j["career"], j["career_capped"], j["broken"]) == (90, 39, 1)
|
||||
assert j["musts"] == musts and one["cv_score"] == j["cv_score"] == 39.0
|
||||
|
||||
|
||||
def test_a_met_or_unclear_must_have_leaves_career_as_the_model_gave_it(
|
||||
client: TestClient, store: Store) -> None:
|
||||
owner, uid = setup(store)
|
||||
musts = [{"id": "M1", "text": "Permanent", "verdict": "met"},
|
||||
{"id": "M2", "text": "Remote", "verdict": "unclear"}]
|
||||
store.set_judgement(owner.id, uid["c"], "k", 90, 90, 90, [], [], musts)
|
||||
j = client.get(f"/api/roles/{uid['c']}", params={"agent": owner.id}).json()["judgement"]
|
||||
assert (j["career"], j["career_capped"], j["broken"], j["cv_score"]) == (90, 90, 0, 90.0)
|
||||
|
||||
|
||||
def test_the_agents_weights_make_the_cv_score_at_read_time(
|
||||
client: TestClient, store: Store) -> None:
|
||||
owner, uid = setup(store)
|
||||
|
||||
Reference in new issue
Block a user