-
Notifications
You must be signed in to change notification settings - Fork 6.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: enhance context handling by adding code context selection and implementing summary generation #1091
feat: enhance context handling by adding code context selection and implementing summary generation #1091
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have not reviewed the code in detail, but the nicely summarized general design looks like an interesting approach 👍
I wish we had a real context-management-api which allows to chain multiple operation that manipulate the context. Your LLM-summarization calls could be steps in them.
I added some questions to the code, but honestly, I am not really able to fully understand our codebase and what does which part now 😬
Thus, it's majorly trying to understand better. Hope you don't mind, @thecodacus
yes. still made it as an optional optimization feature |
Sorry, am bit out of things at the moment. Gut bit burned out juggling multiple things. Taking a look now, on surface, structurally looks good, close to how I was thinking this should work and we can experiment with alternative approaches of filtering chat and selecting files afterwards. So far I run a test for making a snake game with enabled and disabled context optimisation. What is weird. So it was better without :D But I have suspicion it just did not work for me even though I switched that switch in settings on and off. |
I run out of time I have at the moment, need to explore more but am bit short on time. |
Ok actually I do see chat summary in annotations in chat history |
No worries 😄
this needs some additional tokens for summary generation and context selection. so for smaller chats and smaller projects it takes more tokens but for larger chats and project it should reverse 😄 maybe we can dynamically switch it on when the context becomes large and for smaller one it defaults to the regular approach |
I testet out with a bigger project, and its not that much that is reduced in this case: Testproject: https://github.com/leex279/task-list-advanced |
I don't see the optimization is in place. |
@thecodacus thanks for the hint. Testet again and looks fine (maybe it was a cache thing or I mixed up the PRs as I was testing several at this time :D) |
@thecodacus it looks fine, but with Mistral + Codestral I see that the complete UI is blocking and no streaming seen as long as it is doing the implementation. Dont know if this has to do with the PR. |
is it not happening for main branch ? |
its also on the main, so forget it here. Seems a problem with Mistral/Codestral |
@thecodacus I think we should merge this now to main and to additional fixes in a new PR. |
@leex279 resolved the merge conflicts, need to approve again |
Dynamic LLM Context Optimization Implementation
Overview
This PR implements intelligent context management for LLM interactions by introducing two key optimizations:
PR attempts to solve :
#1041
#1042
Key Changes
1. Context Buffer Management
2. Chat Summarization
Technical Details
Context Selection System
Key implementation details from
select-context.ts
:Chat Summary Generation
From
create-summary.ts
:Progress Tracking
Implementation of progress annotations in
api.chat.ts
:Migration Impact
Future Improvements