-
-
Notifications
You must be signed in to change notification settings - Fork 48
Open
Description
When calling /match with a threshold higher than the default, the response still includes results scored below threshold unless the deprecated cutoff parameter is explicitly provided and set to the same value.
threshold: float = Query(
default=settings.SCORE_THRESHOLD,
title="Score threshold for results to be considered matches",
),
cutoff: float = Query(
deprecated=True,
default=settings.SCORE_THRESHOLD,
title="Deprecated, use `threshold` instead. Lower bound of score for results to be returned at all",
),
...
cutoff = min(cutoff, threshold)
...
total, scored = await score_results(
algorithm_type,
entity,
ents,
threshold=threshold,
cutoff=cutoff,
limit=limit,
config=ScoringConfig(weights=match.weights, config=match.config),
)As a result, a higher threshold does not tighten the lower-bound filter unless cutoff is also raised. Given that cutoff is marked deprecated, this is surprising behavior.
Expected behavior
Setting a higher threshold should be sufficient to prevent results below that threshold from appearing in the response, even if cutoff is not passed.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels