Skip to content

Commit

Permalink
community: AzureSearch: fix reranking for empty lists (#27104)
Browse files Browse the repository at this point in the history
**Description:** 
  Fix reranking for empty lists 

**Issue:** 
```
ValueError: not enough values to unpack (expected 3, got 0)
    documents, scores, vectors = map(list, zip(*docs))
  File langchain_community/vectorstores/azuresearch.py", line 1680, in _reorder_results_with_maximal_marginal_relevance
```

Co-authored-by: Oleksii Pokotylo <[email protected]>
  • Loading branch information
pokotylo and Oleksii Pokotylo authored Oct 7, 2024
1 parent 8454a74 commit 37ca468
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1769,6 +1769,8 @@ def _reorder_results_with_maximal_marginal_relevance(
)
for result in results
]
if not docs:
return []
documents, scores, vectors = map(list, zip(*docs))

# Get the new order of results.
Expand Down

0 comments on commit 37ca468

Please sign in to comment.