Home / Function/ test_llm_chain_filter() — langchain Function Reference

test_llm_chain_filter() — langchain Function Reference

Architecture documentation for the test_llm_chain_filter() function in test_chain_filter.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  79196cd2_4239_99d3_5568_a33c92d55f20["test_llm_chain_filter()"]
  83f12139_5c72_cab6_bde9_b4e064061aeb["test_chain_filter.py"]
  79196cd2_4239_99d3_5568_a33c92d55f20 -->|defined in| 83f12139_5c72_cab6_bde9_b4e064061aeb
  style 79196cd2_4239_99d3_5568_a33c92d55f20 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/tests/unit_tests/retrievers/document_compressors/test_chain_filter.py lines 7–26

def test_llm_chain_filter() -> None:
    documents = [
        Document(
            page_content="Candlepin bowling is popular in New England.",
            metadata={"a": 1},
        ),
        Document(
            page_content="Candlepin bowling balls are smaller.",
            metadata={"b": 2},
        ),
        Document(page_content="The moon is round.", metadata={"c": 3}),
    ]
    llm = FakeListChatModel(responses=["YES", "YES", "NO"])
    doc_compressor = LLMChainFilter.from_llm(llm)
    output = doc_compressor.compress_documents(
        documents,
        "Tell me about Candlepin bowling.",
    )
    expected = documents[:2]
    assert output == expected

Domain

Subdomains

Frequently Asked Questions

What does test_llm_chain_filter() do?
test_llm_chain_filter() is a function in the langchain codebase, defined in libs/langchain/tests/unit_tests/retrievers/document_compressors/test_chain_filter.py.
Where is test_llm_chain_filter() defined?
test_llm_chain_filter() is defined in libs/langchain/tests/unit_tests/retrievers/document_compressors/test_chain_filter.py at line 7.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free