Langchain.
EmbeddingsFilter provides a cheaper and faster option by embedding the documents and query and only returning those documents which have sufficiently similar embeddings to the query. from langchain.document_transformers import EmbeddingsRedundantFilter from langchain.retrievers.document_compressors