test_llm_chain_extractor() — langchain Function Reference
Architecture documentation for the test_llm_chain_extractor() function in test_chain_extract.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD f2c8c45a_f46c_0246_ab87_8fd4cc6f2a3c["test_llm_chain_extractor()"] c49efd50_ed8a_1b2b_a881_4d0166e93a94["test_chain_extract.py"] f2c8c45a_f46c_0246_ab87_8fd4cc6f2a3c -->|defined in| c49efd50_ed8a_1b2b_a881_4d0166e93a94 style f2c8c45a_f46c_0246_ab87_8fd4cc6f2a3c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain/tests/unit_tests/retrievers/document_compressors/test_chain_extract.py lines 7–46
def test_llm_chain_extractor() -> None:
documents = [
Document(
page_content=(
"The sky is blue. Candlepin bowling is popular in New England."
),
metadata={"a": 1},
),
Document(
page_content=(
"Mercury is the closest planet to the Sun. "
"Candlepin bowling balls are smaller."
),
metadata={"b": 2},
),
Document(page_content="The moon is round.", metadata={"c": 3}),
]
llm = FakeListChatModel(
responses=[
"Candlepin bowling is popular in New England.",
"Candlepin bowling balls are smaller.",
"NO_OUTPUT",
],
)
doc_compressor = LLMChainExtractor.from_llm(llm)
output = doc_compressor.compress_documents(
documents,
"Tell me about Candlepin bowling.",
)
expected = 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},
),
]
assert output == expected
Domain
Subdomains
Source
Frequently Asked Questions
What does test_llm_chain_extractor() do?
test_llm_chain_extractor() is a function in the langchain codebase, defined in libs/langchain/tests/unit_tests/retrievers/document_compressors/test_chain_extract.py.
Where is test_llm_chain_extractor() defined?
test_llm_chain_extractor() is defined in libs/langchain/tests/unit_tests/retrievers/document_compressors/test_chain_extract.py at line 7.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free