mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-07-16 01:53:10 +00:00
Merge branch 'main' into feat/add-url-to-paginated-response
This commit is contained in:
commit
91a5b1d921
5 changed files with 157 additions and 2 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)
|
||||
|
||||
|
|
|
@ -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