♻️ fix: Prevent Instructions from Removal when nearing Max Context (#5516)

* refactor: getMessagesWithinTokenLimit to accept params object

* refactor: always include instructions in payload if provided

* ci: remove obsolete test

* refactor: update logoutUser to accept request object and handle session destruction

* test: enhance getMessagesWithinTokenLimit tests for instruction handling
This commit is contained in:
Danny Avila 2025-01-27 20:37:38 -05:00 committed by GitHub
parent 528ee62eb1
commit 4110209494
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 185 additions and 83 deletions

View file

@ -416,7 +416,7 @@ class AnthropicClient extends BaseClient {
}
let { context: messagesInWindow, remainingContextTokens } =
await this.getMessagesWithinTokenLimit(formattedMessages);
await this.getMessagesWithinTokenLimit({ messages: formattedMessages });
const tokenCountMap = orderedMessages
.slice(orderedMessages.length - messagesInWindow.length)