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

    LangChain Assistant

    Ask a question to get started

    Enter to send•Shift+Enter new line

    Menu

    MCP Adapters
    Standard Tests
    Text Splitters
    OverviewAgentsCallbacksChainsChat modelsEmbeddingsEvaluationGlobalsHubMemoryOutput parsersRetrieversRunnablesLangSmithStorage
    Language
    Theme
    Pythonlangchain-classicretrieversdocument_compressorschain_filterLLMChainFilter
    Classā—Since v1.0

    LLMChainFilter

    Copy
    LLMChainFilter()

    Bases

    BaseDocumentCompressor

    Attributes

    Methods

    View source on GitHub
    attribute
    llm_chain: Runnable

    LLM wrapper to use for filtering documents. The chain prompt is expected to have a BooleanOutputParser.

    attribute
    get_input: Callable[[str, Document], dict]

    Callable for constructing the chain input from the query and a Document.

    attribute
    model_config
    method
    compress_documents

    Filter down documents based on their relevance to the query.

    method
    acompress_documents

    Filter down documents based on their relevance to the query.

    method
    from_llm

    Create a LLMChainFilter from a language model.

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