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

This commit is contained in:
Eugene Yurtsev 2024-06-19 11:03:49 -04:00 committed by GitHub
parent 1007a715a5
commit a34e650f8b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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(