forked from Archives/langchain
10e4b32ecb
Add DocumentTransformer abstraction so that in #2915 we don't have to wrap TextSplitter and RedundantEmbeddingFilter (neither of which uses the query) in the contextual doc compression abstractions. with this change, doc filter (doc extractor, whatever we call it) would look something like ```python class BaseDocumentFilter(BaseDocumentTransformer[_RetrievedDocument], ABC): @abstractmethod def filter(self, documents: List[_RetrievedDocument], query: str) -> List[_RetrievedDocument]: ... def transform_documents(self, documents: List[_RetrievedDocument], query: Optional[str] = None, **kwargs: Any) -> List[_RetrievedDocument]: if query is None: raise ValueError("Must pass in non-null query to DocumentFilter") return self.filter(documents, query) ``` |
||
---|---|---|
.. | ||
agents | ||
callbacks | ||
chains | ||
chat_models | ||
docstore | ||
document_loaders | ||
embeddings | ||
evaluation | ||
experimental | ||
graphs | ||
indexes | ||
llms | ||
memory | ||
output_parsers | ||
prompts | ||
retrievers | ||
tools | ||
utilities | ||
vectorstores | ||
__init__.py | ||
cache.py | ||
docker-compose.yaml | ||
example_generator.py | ||
formatting.py | ||
input.py | ||
model_laboratory.py | ||
py.typed | ||
python.py | ||
requests.py | ||
schema.py | ||
serpapi.py | ||
server.py | ||
sql_database.py | ||
text_splitter.py | ||
utils.py |