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

Check early if file tokens exceed or near limit #42

Merged
merged 2 commits into from
Aug 4, 2023
Merged

Conversation

biobootloader
Copy link
Member

No description provided.

mentat/app.py Outdated
@@ -57,7 +57,7 @@ def run(paths: Iterable[str], exclude_paths: Optional[Iterable[str]] = None):
try:
loop(paths, exclude_paths, cost_tracker)
except (EOFError, KeyboardInterrupt) as e:
print(e)
cprint("\n" + str(e), color="red")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

? Why is this here? All it does for me is print a lot of newlines

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the error has a message (like the new ones I introduced) then it prints it here - you shouldn't be getting more than 2 new lines even if there error has no message, right?

The "\n" is there to separate the error from the file tree

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But the error is EOF or KeyboardInterrupt; why would it have a message?

Copy link
Member

@PCSwingle PCSwingle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM; feel free to merge

@biobootloader
Copy link
Member Author

I just realized we need to take into account the prompt tokens when doing this check, I'll update before merging

@PCSwingle PCSwingle merged commit 8fb7603 into main Aug 4, 2023
8 checks passed
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.

2 participants