fix: degrade to partial results below the grounding floor
This commit is contained in:
parent
0ccc9a5d4e
commit
47cbeac87a
3 changed files with 68 additions and 3 deletions
|
|
@ -130,12 +130,19 @@ class RecommendationPipeline:
|
|||
)
|
||||
|
||||
pool = await self._grounded_pool(session_id, catalog, intent, taste)
|
||||
if len(pool) < self.settings.grounding_floor:
|
||||
if not pool:
|
||||
yield PipelineErrorEvent(
|
||||
code="insufficient_grounding",
|
||||
message="Not enough requested tracks could be verified safely.",
|
||||
code="no_grounded_results",
|
||||
message="None of the proposed tracks could be verified on Spotify.",
|
||||
)
|
||||
return
|
||||
if len(pool) < self.settings.grounding_floor:
|
||||
# Fewer verified tracks than promised is still an answer; an
|
||||
# empty error in its place would hide real results.
|
||||
yield PipelineWarningEvent(
|
||||
code="partial_results",
|
||||
message="Fewer tracks than usual could be verified; showing what held up.",
|
||||
)
|
||||
|
||||
selection = _TrackSelection(pool, self.settings.rerank_count)
|
||||
async for event in self._ranked_events(intent, taste.text, history, selection):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue