mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-07-16 09:58:10 +00:00
fix: handle case where distance is 0 by setting score to infinity
This commit is contained in:
parent
ef885d2147
commit
fea01c5a25
1 changed files with 1 additions and 1 deletions
|
@ -112,7 +112,7 @@ class FaissIndex(EmbeddingIndex):
|
|||
if i < 0:
|
||||
continue
|
||||
chunks.append(self.chunk_by_index[int(i)])
|
||||
scores.append(1.0 / float(d))
|
||||
scores.append(1.0 / float(d) if d != 0 else float("inf"))
|
||||
|
||||
return QueryChunksResponse(chunks=chunks, scores=scores)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue