Rankers

Rankers rank documents by specific criteria using pre-trained models. They're used in query pipelines after retrievers to improve retrieval results.

Available rankers:

  • CohereRanker: Ranks documents based on their similarity to the query using Cohere models.
  • LostInTheMiddleRanker: Puts the most relevant documents and the beginning and at the end of input for an LLM.
  • MetaFieldRanker: Ranks documents based on a value of their metadata field.
  • SentenceTransformersDiversityRanker: Ranks documents to maximize their diversity.
  • TopPSampler: Uses nucleus sampling to select the most relevant documents based on their similarity to a query.
  • TransformersSimilarityRanker: Uses a cross-encoder model to embed both the query and the documents and then rank documents by their similarity to the query.