langchain icon indicating copy to clipboard operation
langchain copied to clipboard

Fix: Handle empty documents in ContextualCompressionRetriever (Issue #5304)

Open hanguofeng opened this issue 1 year ago • 0 comments

Fix: Handle empty documents in ContextualCompressionRetriever (Issue #5304)

Fixes #5304

Prevent cohere.error.CohereAPIError caused by an empty list of documents by adding a condition to check if the input documents list is empty in the compress_documents method. If the list is empty, return an empty list immediately, avoiding the error and unnecessary processing.

@dev2049

hanguofeng avatar May 26 '23 16:05 hanguofeng