LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • MCP Adapters
    • Overview
    • Agents
    • Callbacks
    • Chains
    • Chat models
    • Embeddings
    • Evaluation
    • Globals
    • Hub
    • Memory
    • Output parsers
    • Retrievers
    • Runnables
    • LangSmith
    • Storage
    Standard Tests
    Text Splitters
    ⌘I

    LangChain Assistant

    Ask a question to get started

    Enter to send•Shift+Enter new line

    Menu

    MCP Adapters
    OverviewAgentsCallbacksChainsChat modelsEmbeddingsEvaluationGlobalsHubMemoryOutput parsersRetrieversRunnablesLangSmithStorage
    Standard Tests
    Text Splitters
    Language
    Theme
    Pythonlangchain-classicretrieversdocument_compressorslistwise_rerank
    Module●Since v1.0

    listwise_rerank

    Filter that uses an LLM to rerank documents listwise and select top-k.

    Classes

    class
    LLMListwiseRerank

    Document compressor that uses Zero-Shot Listwise Document Reranking.

    Adapted from: https://arxiv.org/pdf/2305.02156.pdf

    LLMListwiseRerank uses a language model to rerank a list of documents based on their relevance to a query.

    Note

    Requires that underlying model implement with_structured_output.

    View source on GitHub