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_compressors
    Module●Since v1.0

    document_compressors

    Classes

    class
    DocumentCompressorPipeline

    Document compressor that uses a pipeline of Transformers.

    class
    LLMChainExtractor

    LLM Chain Extractor.

    Document compressor that uses an LLM chain to extract the relevant parts of documents.

    class
    LLMChainFilter

    Filter that drops documents that aren't relevant to the query.

    class
    CrossEncoderReranker

    Document compressor that uses CrossEncoder for reranking.

    class
    EmbeddingsFilter

    Embeddings Filter.

    Document compressor that uses embeddings to drop documents unrelated to the query.

    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.

    deprecatedclass
    CohereRerank

    Document compressor that uses Cohere Rerank API.

    Modules

    module
    flashrank_rerank
    module
    cross_encoder
    module
    chain_extract

    DocumentFilter that uses an LLM chain to extract the relevant parts of documents.

    module
    cohere_rerank
    module
    cross_encoder_rerank
    module
    chain_filter

    Filter that uses an LLM to drop documents that aren't relevant to the query.

    module
    listwise_rerank

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

    module
    embeddings_filter
    module
    chain_extract_prompt
    module
    chain_filter_prompt
    module
    base
    View source on GitHub