DocumentCompressorPipeline#

class langchain.retrievers.document_compressors.base.DocumentCompressorPipeline[source]#

Bases: BaseDocumentCompressor

Document compressor that uses a pipeline of Transformers.

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

param transformers: List[BaseDocumentTransformer | BaseDocumentCompressor] [Required]#

List of document filters that are chained together and run in sequence.

async acompress_documents(documents: Sequence[Document], query: str, callbacks: List[BaseCallbackHandler] | BaseCallbackManager | None = None) Sequence[Document][source]#

Compress retrieved documents given the query context.

Parameters:
Return type:

Sequence[Document]

compress_documents(documents: Sequence[Document], query: str, callbacks: List[BaseCallbackHandler] | BaseCallbackManager | None = None) Sequence[Document][source]#

Transform a list of documents.

Parameters:
Return type:

Sequence[Document]

Examples using DocumentCompressorPipeline