A retriever that wraps a base retriever and compresses the results. It
retrieves relevant documents based on a given query and then compresses
these documents using a specified document compressor.
Example
constretriever = newContextualCompressionRetriever({ baseCompressor:newLLMChainExtractor(), baseRetriever:newHNSWLib().asRetriever(), }); constretrievedDocs = awaitretriever.getRelevantDocuments( "What did the speaker say about Justice Breyer?", );
A retriever that wraps a base retriever and compresses the results. It retrieves relevant documents based on a given query and then compresses these documents using a specified document compressor.
Example