Fix live multi-turn: pass the resolved drug, stop did-you-mean garbage
This commit is contained in:
@@ -26,6 +26,27 @@ class AnswerGenerationUnavailable(RuntimeError):
|
||||
"""
|
||||
|
||||
|
||||
class RerankUnavailable(RuntimeError):
|
||||
"""The reranker could not be reached.
|
||||
|
||||
Same fail-open contract as the other provider errors, but softer: losing the
|
||||
reranker only means the candidates keep their original order, so the caller
|
||||
catches this and proceeds rather than abstaining. Rerank is an ordering
|
||||
improvement on the fallback, never a precondition for an answer.
|
||||
"""
|
||||
|
||||
|
||||
class Reranker(Protocol):
|
||||
"""Reorders candidate texts by joint relevance to the query.
|
||||
|
||||
Returns indices into `documents`, most relevant first. A cross-encoder pass
|
||||
that recovers precision the bi-encoder embedding cannot; applied only to the
|
||||
similarity/overview fallback, never to the deterministic section route.
|
||||
"""
|
||||
|
||||
def rerank(self, query: str, documents: list[str], top_n: int | None = None) -> list[int]: ...
|
||||
|
||||
|
||||
class AnswerGenerator(Protocol):
|
||||
"""Rewrites retrieved evidence into prose. Never a source of facts.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user