fix: format error return for file_search tool in two-tuple as expected

This commit is contained in:
Dustin Healy
2025-11-17 09:20:32 -08:00
parent 1b2f1ff09b
commit 4fb27dbaff

View File

@@ -78,11 +78,11 @@ const createFileSearchTool = async ({ userId, files, entity_id, fileCitations =
return tool( return tool(
async ({ query }) => { async ({ query }) => {
if (files.length === 0) { if (files.length === 0) {
return 'No files to search. Instruct the user to add files for the search.'; return ['No files to search. Instruct the user to add files for the search.', {}];
} }
const jwtToken = generateShortLivedToken(userId); const jwtToken = generateShortLivedToken(userId);
if (!jwtToken) { if (!jwtToken) {
return 'There was an error authenticating the file search request.'; return ['There was an error authenticating the file search request.', {}];
} }
/** /**
@@ -122,7 +122,7 @@ const createFileSearchTool = async ({ userId, files, entity_id, fileCitations =
const validResults = results.filter((result) => result !== null); const validResults = results.filter((result) => result !== null);
if (validResults.length === 0) { if (validResults.length === 0) {
return 'No results found or errors occurred while searching the files.'; return ['No results found or errors occurred while searching the files.', {}];
} }
const formattedResults = validResults const formattedResults = validResults