Skip to content

Commit

Permalink
refactor: Limit file search results to top 5 based on relevance score
Browse files Browse the repository at this point in the history
  • Loading branch information
danny-avila committed Feb 18, 2025
1 parent b9fc383 commit 61b6956
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion api/app/clients/tools/util/fileSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ const createFileSearchTool = async ({ req, files, entity_id }) => {
relevanceScore,
})),
)
.sort((a, b) => b.relevanceScore - a.relevanceScore);
.sort((a, b) => b.relevanceScore - a.relevanceScore)
.slice(0, 5);

const formattedString = formattedResults
.map(
Expand Down

0 comments on commit 61b6956

Please sign in to comment.