Reduce token usage in conversation search#302
Merged
mbklein merged 3 commits intodeploy/prototypefrom Mar 25, 2025
Merged
Conversation
Update the prompt to limit tool calls and avoid recursion errors.
kdid
approved these changes
Mar 25, 2025
charlesLoder
approved these changes
Mar 25, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Building on PR #296, which reduced cumulative token usage across multiple interactions by removing all non-current ToolMessages, this PR reduces token counts within a single interaction by:
On average, this reduces tool content byte size by about 90%, and token counts per interaction by about 80%. This allows complex questions to succeed by keeping tool recursion from overwhelming the LLM's max token count.
The PR also adds language to the system prompt to cap tool usage at 6 per interaction, with instructions to summarize results and ask for clarification if it still can't answer the question.