mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-12 06:13:36 +00:00
core[patch]: Add doc-string to document compressor (#23085)
This commit is contained in:
parent
1007a715a5
commit
a34e650f8b
@ -10,7 +10,20 @@ from langchain_core.runnables import run_in_executor
|
|||||||
|
|
||||||
|
|
||||||
class BaseDocumentCompressor(BaseModel, ABC):
|
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
|
@abstractmethod
|
||||||
def compress_documents(
|
def compress_documents(
|
||||||
|
Loading…
Reference in New Issue
Block a user