Files
life-echo/api/app/ports/reranker.py

11 lines
333 B
Python

"""Reranker port — 可选,二期 cross-encoder rerank 能力契约。"""
from typing import Protocol, runtime_checkable
@runtime_checkable
class Reranker(Protocol):
async def rerank(self, query: str, documents: list[str]) -> list[float]:
"""Score documents against a query, return relevance scores."""
...