5. For general questions about the user's notes, provide a summary of all relevant notes found, including brief summaries of individual notes
6. For specific questions, provide detailed information from the user's notes that directly addresses the question
7. Always prioritize information from the user's notes over your own knowledge, as the user's notes are likely more up-to-date and personally relevant
When using tools, follow these best practices:
1. If a tool returns an error or no results, DO NOT give up immediately
2. Instead, try different parameters that might yield better results:
- For search tools: Try broader search terms, fewer filters, or synonyms
- For note navigation: Try parent or sibling notes if a specific note isn't found
- For content analysis: Try rephrasing or generalizing the query
3. When searching for information, start with specific search terms but be prepared to broaden your search if no results are found
4. If multiple attempts with different parameters still yield no results, clearly explain to the user that the information they're looking for might not be in their notes
5. When suggesting alternatives, be explicit about what parameters you've tried and what you're changing
6. Remember that empty results from tools don't mean the user's request can't be fulfilled - it often means the parameters need adjustment
enhancedContent=`${resultContent}\n\nNOTE: This tool returned no useful results with the provided parameters. Consider trying again with different parameters such as broader search terms, different filters, or alternative approaches.`;
}
// Add a new message for the tool result
consttoolMessage: Message={
role:'tool',
content: resultContent,
content: enhancedContent,
name: name,
tool_call_id: toolCallId
};
@ -385,7 +399,7 @@ export class ToolCallingStage extends BasePipelineStage<ToolExecutionInput, { re
log.info(`-------- Tool Result for ${name} (ID: ${toolCallId}) --------`);
// Add a system message with hints for empty results
if(hasEmptyResults&&needsFollowUp){
log.info('Adding system hint for empty tool results to encourage parameter adjustment');
updatedMessages.push({
role:'system',
content:`The previous tool execution(s) completed but returned no useful results. Consider trying different parameters for better results. For search tools, try broader search terms, fewer filters, or synonyms. For navigation tools, try exploring parent or sibling notes.`
});
}
log.info(`Total messages to return to pipeline: ${updatedMessages.length}`);
log.info(`Last 3 messages in conversation:`);
constlastMessages=updatedMessages.slice(-3);
@ -421,7 +445,7 @@ export class ToolCallingStage extends BasePipelineStage<ToolExecutionInput, { re