Skip to content

Commit

Permalink
set max reference based on rrf score size
Browse files Browse the repository at this point in the history
  • Loading branch information
devxpy committed Oct 10, 2023
1 parent b81a36e commit 1b17837
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions daras_ai_v2/vector_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,8 @@ def get_top_k_references(
) * k

# Final ranking
top_k = np.argpartition(rrf_scores, -request.max_references)[
-request.max_references :
]
max_references = min(request.max_references, len(rrf_scores))
top_k = np.argpartition(rrf_scores, -max_references)[-max_references:]
final_ranks = sorted(
top_k,
key=lambda idx: rrf_scores[idx],
Expand Down

0 comments on commit 1b17837

Please sign in to comment.