Skip to content
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

Raise exception if max tokens exceeded #686

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

g-eoj
Copy link
Contributor

@g-eoj g-eoj commented Feb 17, 2025

I've seen a few issues reported that were resolved by raising max tokens. The aim of this PR is to avoid misleading error messages and report if tokens are exhausted. It also provides the ground work for stopping agent execution early if there are no tokens left as I believe that is an unrecoverable situation.

Currently the PR only applies to MLX models but should be easy to apply to other model types if the proposed solution is accepted. @aymeric-roucher can you take a quick look and let me know what you think?

Closes #607

Before

Screenshot 2025-02-17 at 10 11 21 AM

After

Screenshot 2025-02-17 at 10 15 01 AM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Agent raises warning/error if max_tokens exhausted in a step
1 participant