mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-26 05:02:00 +00:00
refactor: Remove double filtering based on score threshold
This commit is contained in:
parent
140ee7d337
commit
76ff6a5943
4 changed files with 13 additions and 7 deletions
|
|
@ -160,8 +160,11 @@ class FaissIndex(EmbeddingIndex):
|
|||
for d, i in zip(distances[0], indices[0], strict=False):
|
||||
if i < 0:
|
||||
continue
|
||||
score = 1.0 / float(d) if d != 0 else float("inf")
|
||||
if score < score_threshold:
|
||||
continue
|
||||
chunks.append(self.chunk_by_index[int(i)])
|
||||
scores.append(1.0 / float(d) if d != 0 else float("inf"))
|
||||
scores.append(score)
|
||||
|
||||
return QueryChunksResponse(chunks=chunks, scores=scores)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue