Skip to content

The agent engineering platform.

core[patch]: Add doc-string to document compressor (#23085)

Eugene Yurtseva34e650f8bab
diff --git a/libs/core/langchain_core/documents/compressor.py b/libs/core/langchain_core/documents/compressor.py
index 228caf660a..6ed597a1e5 100644
--- a/libs/core/langchain_core/documents/compressor.py
+++ b/libs/core/langchain_core/documents/compressor.py
@@ -10,7 +10,20 @@ from langchain_core.runnables import run_in_executor
class BaseDocumentCompressor(BaseModel, ABC):
- """Base class for document compressors."""
+ """Base class for document compressors.
+
+ This abstraction is primarily used for
+ post-processing of retrieved documents.
+
+ Documents matching a given query are first retrieved.
+ Then the list of documents can be further processed.
+
+ For example, one could re-rank the retrieved documents
+ using an LLM.
+
+ **Note** users should favor using a RunnableLambda
+ instead of sub-classing from this interface.
+ """
@abstractmethod
def compress_documents(