Langchain.
import DocumentCompressorPipeline # redundant_filter = EmbeddingsRedundantFilter(embeddings=embeddings) relevant_filter = EmbeddingsFilter(embeddings=embeddings,k=5) #making the pipeline pipeline_compressor = DocumentCompressorPipeline(transformers=[redundant_filter,relevant_filter]) # compressor