Set up a retriever using any type of retriever (for example, I used Pinecone).
Pass it into the ContextualCompressionRetriever.
If the base retriever returns empty documents,
It throws an error: cohere.error.CohereAPIError: invalid request: list of documents must not be empty
File "/workspaces/example/.venv/lib/python3.10/site-packages/langchain/retrievers/contextual_compression.py", line 37, in get_relevant_documents
compressed_docs = self.base_compressor.compress_documents(docs, query)
File "/workspaces/example/.venv/lib/python3.10/site-packages/langchain/retrievers/document_compressors/cohere_rerank.py", line 57, in compress_documents
results = self.client.rerank(
File "/workspaces/example/.venv/lib/python3.10/site-packages/cohere/client.py", line 633, in rerank
reranking = Reranking(self._request(cohere.RERANK_URL, json=json_body))
File "/workspaces/example/.venv/lib/python3.10/site-packages/cohere/client.py", line 692, in _request
self._check_response(json_response, response.headers, response.status_code)
File "/workspaces/example/.venv/lib/python3.10/site-packages/cohere/client.py", line 642, in _check_response
raise CohereAPIError(
cohere.error.CohereAPIError: invalid request: list of documents must not be empty
System Info
Who can help?
No response
Information
Related Components
Reproduction
Code is Like
Expected behavior
no error throws and return empty list