mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-06-28 02:53:30 +00:00
fix: handle case where distance is 0 by setting score to infinity
This commit is contained in:
parent
33ecefd284
commit
6f8312ddd0
1 changed files with 1 additions and 1 deletions
|
@ -116,7 +116,7 @@ class PGVectorIndex(EmbeddingIndex):
|
|||
scores = []
|
||||
for doc, dist in results:
|
||||
chunks.append(Chunk(**doc))
|
||||
scores.append(1.0 / float(dist))
|
||||
scores.append(1.0 / float(dist) if dist != 0 else float("inf"))
|
||||
|
||||
return QueryChunksResponse(chunks=chunks, scores=scores)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue