Home / Function/ test_list_rerank() — langchain Function Reference

test_list_rerank() — langchain Function Reference

Architecture documentation for the test_list_rerank() function in test_listwise_rerank.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  8b9f20c5_c3f2_4304_3799_8c009fdd1f19["test_list_rerank()"]
  5d196400_1364_48c8_05ae_528901cd85d6["test_listwise_rerank.py"]
  8b9f20c5_c3f2_4304_3799_8c009fdd1f19 -->|defined in| 5d196400_1364_48c8_05ae_528901cd85d6
  style 8b9f20c5_c3f2_4304_3799_8c009fdd1f19 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/tests/integration_tests/retrievers/document_compressors/test_listwise_rerank.py lines 8–25

def test_list_rerank() -> None:
    from langchain_openai import ChatOpenAI

    documents = [
        Document("Sally is my friend from school"),
        Document("Steve is my friend from home"),
        Document("I didn't always like yogurt"),
        Document("I wonder why it's called football"),
        Document("Where's waldo"),
    ]

    reranker = LLMListwiseRerank.from_llm(
        llm=ChatOpenAI(model="gpt-3.5-turbo"),
        top_n=3,
    )
    compressed_docs = reranker.compress_documents(documents, "Who is steve")
    assert len(compressed_docs) == 3
    assert "Steve" in compressed_docs[0].page_content

Domain

Subdomains

Frequently Asked Questions

What does test_list_rerank() do?
test_list_rerank() is a function in the langchain codebase, defined in libs/langchain/tests/integration_tests/retrievers/document_compressors/test_listwise_rerank.py.
Where is test_list_rerank() defined?
test_list_rerank() is defined in libs/langchain/tests/integration_tests/retrievers/document_compressors/test_listwise_rerank.py at line 8.

Analyze Your Own Codebase

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

Try Supermodel Free