Rag.Reranker.Passthrough (rag v0.3.4)
View SourceA simple passthrough reranker that returns documents unchanged.
This reranker is useful for:
- Baseline comparisons when evaluating reranking strategies
- Testing pipelines without the overhead of LLM calls
- Cases where the initial retrieval scores are already optimal
Usage
reranker = %Rag.Reranker.Passthrough{}
{:ok, documents} = Rag.Reranker.rerank(reranker, query, documents)The documents are returned in their original order with original scores.
Summary
Functions
Returns documents unchanged without any reranking.
Types
Functions
@spec rerank(t(), String.t(), [Rag.Reranker.document()], keyword()) :: {:ok, [Rag.Reranker.document()]}
Returns documents unchanged without any reranking.
Parameters
reranker- The passthrough reranker structquery- The search query (ignored)documents- List of documentsopts- Options (ignored)
Returns
{:ok, documents}- The same documents in the same order
Examples
reranker = %Rag.Reranker.Passthrough{}
docs = [
%{id: 1, content: "...", score: 0.8, metadata: %{}},
%{id: 2, content: "...", score: 0.6, metadata: %{}}
]
{:ok, ^docs} = Rag.Reranker.Passthrough.rerank(reranker, "query", docs, [])