Reverted the change in handling the case of no chunks found.

This commit is contained in:
ilya-kolchinsky 2025-05-08 10:52:00 +02:00
parent 82b485b177
commit 57e28b5b9b
2 changed files with 2 additions and 16 deletions

View file

@ -129,7 +129,7 @@ class MemoryToolRuntimeImpl(ToolsProtocolPrivate, ToolRuntime, RAGToolRuntime):
scores = [s for r in results for s in r.scores]
if not chunks:
raise ValueError("The knowledge search tool did not find any information relevant to the query.")
return RAGQueryResult(content=None)
# sort by score
chunks, scores = zip(*sorted(zip(chunks, scores, strict=False), key=lambda x: x[1], reverse=True), strict=False) # type: ignore