test_listwise_rerank.py — langchain Source File
Architecture documentation for test_listwise_rerank.py, a python file in the langchain codebase. 3 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 5d196400_1364_48c8_05ae_528901cd85d6["test_listwise_rerank.py"] 6a98b0a5_5607_0043_2e22_a46a464c2d62["langchain_core.documents"] 5d196400_1364_48c8_05ae_528901cd85d6 --> 6a98b0a5_5607_0043_2e22_a46a464c2d62 033008d0_bf89_578a_80e2_890155c01cc0["langchain_classic.retrievers.document_compressors.listwise_rerank"] 5d196400_1364_48c8_05ae_528901cd85d6 --> 033008d0_bf89_578a_80e2_890155c01cc0 2cad93e6_586a_5d28_a74d_4ec6fd4d2227["langchain_openai"] 5d196400_1364_48c8_05ae_528901cd85d6 --> 2cad93e6_586a_5d28_a74d_4ec6fd4d2227 style 5d196400_1364_48c8_05ae_528901cd85d6 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
from langchain_core.documents import Document
from langchain_classic.retrievers.document_compressors.listwise_rerank import (
LLMListwiseRerank,
)
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
Functions
Dependencies
- langchain_classic.retrievers.document_compressors.listwise_rerank
- langchain_core.documents
- langchain_openai
Source
Frequently Asked Questions
What does test_listwise_rerank.py do?
test_listwise_rerank.py is a source file in the langchain codebase, written in python. It belongs to the LangChainCore domain, MessageInterface subdomain.
What functions are defined in test_listwise_rerank.py?
test_listwise_rerank.py defines 1 function(s): test_list_rerank.
What does test_listwise_rerank.py depend on?
test_listwise_rerank.py imports 3 module(s): langchain_classic.retrievers.document_compressors.listwise_rerank, langchain_core.documents, langchain_openai.
Where is test_listwise_rerank.py in the architecture?
test_listwise_rerank.py is located at libs/langchain/tests/integration_tests/retrievers/document_compressors/test_listwise_rerank.py (domain: LangChainCore, subdomain: MessageInterface, directory: libs/langchain/tests/integration_tests/retrievers/document_compressors).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free