Apply an edit to the message list, returning the new token count.
This method should:
tokens parametermessages array in-place (if needed)Parameters for the editing operation
Function to count tokens in a message array
Array of messages to potentially edit (modify in-place)
Current token count of all messages
The updated token count after applying edits
Protocol describing a context editing strategy.
Implement this interface to create custom strategies for managing conversation context size. The
applymethod should modify the messages array in-place and return the updated token count.Example