Sometimes ChatLab is off to the races cranking on analysis and then it runs out of tokens.

We need to do two things:
- Count the number of tokens with tiktoken
- Remove earlier messages with a strategy. Allow users to pick from various strategies while we figure out a good default
The simplest strategy could be "remove the first message until under the token limit". Advanced strategies could include taking out the system message or even parts of it.
Sometimes ChatLab is off to the races cranking on analysis and then it runs out of tokens.
We need to do two things:
The simplest strategy could be "remove the first message until under the token limit". Advanced strategies could include taking out the system message or even parts of it.