Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(today): bring back jev figure marks on report pages (#112590)

Shy Alter4ce4d2aa32b8
diff --git a/products/today/backend/logic/figure_sources.py b/products/today/backend/logic/figure_sources.py
index 651ba897666c..102f3e847c4f 100644
--- a/products/today/backend/logic/figure_sources.py
+++ b/products/today/backend/logic/figure_sources.py
@@ -17,7 +17,7 @@ FIGURE_MODEL = "posthog/hogference/jevk5-fp8-0.2"
KIND_THRESHOLD = 0.7
SOURCE_THRESHOLD = 0.6
RELATION_THRESHOLD = 0.6
-NAMED_THRESHOLD = 0.75
+UNNAMED_THRESHOLD = 0.75
_MAX_MARKS = 4
_MAX_CLAIMS = 12
_MAX_CANDIDATES = 6
@@ -290,6 +290,7 @@ def match_figures(
matches = [
FigureMatch(claim=claim, source=candidate)
for claim, candidate in same
- if _sure(named.get(named_item(candidate)), NAMED, NAMED_THRESHOLD)
+ # Jev's named answers sit near 0.5 even for clear sentences, so only a sure "unnamed" drops a mark.
+ if not _sure(named.get(named_item(candidate)), UNNAMED, UNNAMED_THRESHOLD)
]
return _people_first(matches, lambda match: match.claim.figure, _MAX_MARKS)
diff --git a/products/today/backend/tests/test_figure_sources.py b/products/today/backend/tests/test_figure_sources.py
index 853afebe3557..50bf9ee65817 100644
--- a/products/today/backend/tests/test_figure_sources.py
+++ b/products/today/backend/tests/test_figure_sources.py
@@ -6,7 +6,6 @@ from products.today.backend.facade.enums import FigureText
from products.today.backend.logic.figure_sources import (
KIND_LABELS,
KIND_QUESTION,
- NAMED_LABELS,
NAMED_QUESTION,
RELATION_QUESTION,
SOURCE_QUESTION,
@@ -71,11 +70,11 @@ class TestFigureSources(SimpleTestCase):
ALL_QUESTIONS,
),
(
- "drops the mark when Jev is unsure the source says what the number counts",
+ "keeps the mark when Jev is unsure whether the source says what the number counts",
"The export failed for 212 users.",
["On Monday the export failed for 212 users."],
- {NAMED_QUESTION: JevPick(label=NAMED_LABELS[0], probability=0.6)},
- [],
+ {NAMED_QUESTION: JevPick(label=UNNAMED, probability=0.6)},
+ [("212", "On Monday the export failed for 212 users.")],
ALL_QUESTIONS,
),
]