ContextualCompressionRetriever._get_relevant_documents() returns a list of _DocumentWithState instead of a list of Document #28511
Labels
🤖:bug
Related to a bug, vulnerability, unexpected error with an existing feature
Checked other resources
Example Code
Error Message and Stack Trace (if applicable)
No response
Description
According to LangChain's documentation,
retrieved_docs
shoud be a list ofDocument
objects.But it happens to be a list of
_DocumentWithState
objects, which is similar but includes the embedded representations of the documents.In my case, this is a problem because the embedded vectors are big, and passing them to an LLM in the generation phase of a RAG application is not ideal.
The problem origins in the
EmbeddingsRedundantFilter.transform_documents()
method that returns:return [stateful_documents[i] for i in sorted(included_idxs)]
which are then forwarded to the retriever output.
System Info
System Information
Package Information
Optional packages not installed
Other Dependencies
The text was updated successfully, but these errors were encountered: