-
Notifications
You must be signed in to change notification settings - Fork 748
fix(chat): Prune history if it's too large, ignore log window as active file #6989
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
Conversation
|
c43d50f to
fd340bf
Compare
| } else { | ||
| this.logger.debug('No valid starting user message found in the history, clearing') | ||
| this.history = [] | ||
| private calculateHistoryCharacterCount(): number { |
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.
can we make use of the logic here? https://github.com/aws/aws-toolkit-vscode/blob/master/packages/core/src/codewhispererChat/controllers/chat/chatRequest/converter.ts#L34
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 think the usecase are too different and the history truncation/handling already exists in chatHistory.ts
| } | ||
| } while ( | ||
| this.calculateHistoryCharacterCount() > MaxConversationHistoryCharacters && | ||
| this.history.length > 2 |
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.
is it possible to exceed the chars count with history.length === 2?
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.
not possible
| // Maximum number of messages to keep in history | ||
| const MaxConversationHistoryLength = 100 | ||
| // Maximum number of characters to keep in history | ||
| const MaxConversationHistoryCharacters = 600_000 |
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.
Should we be more conservative with this number to leave room for the system prompt?
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.
this is already conservative given each token is roughly 3.5 chars
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.
You also need to make sure that the validation logic inside Maestro is honored when pruning history
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.
yep, we handle that in ensureCurrentMessageIsValid
| customization: getSelectedCustomization(), | ||
| toolResults: toolResults, | ||
| origin: Origin.IDE, | ||
| context: session.context ?? [], |
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.
setting falcon context here in the toolResults response will waste tokens, hence removing it
57ee56c to
f3e9247
Compare
253c90b to
d398c74
Compare
2e58d0c to
0bbf73e
Compare
…ror msg, ignore log window as activeFile
Problem
Input is too long.by pruning historySolution
feature/xbranches will not be squash-merged at release time.