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

openai.error.InvalidRequestError, requested too many tokens #14

Closed
chrismarquardt opened this issue Dec 13, 2022 · 5 comments · Fixed by #44
Closed

openai.error.InvalidRequestError, requested too many tokens #14

chrismarquardt opened this issue Dec 13, 2022 · 5 comments · Fixed by #44

Comments

@chrismarquardt
Copy link

Worked great the other day, now I'm getting this, no matter the command:

openai.error.InvalidRequestError: This model's maximum context length is 4097 tokens, however you requested 6365 tokens (6109 in your prompt; 256 for the completion). Please reduce your prompt; or completion length.

@github-actions
Copy link

Message that will be displayed on users' first issue

@JoelKronander
Copy link
Collaborator

Hi @chrismarquardt

Sorry about that it seems your prompt got very long. Are you using the latest version terminal-copilot 1.0.7?

Could you run with the -v flag to see the prompt that gets sent to openai to help us debug?

@rafpaf
Copy link

rafpaf commented Dec 24, 2022

I ran into this problem when using copilot in a directory that contained a lot of hidden files. Once I deleted the files the problem went away.

@2mawi2
Copy link
Contributor

2mawi2 commented Mar 19, 2023

Yes directory_list = os.listdir() currently has no limits. If you have a lot of directories and files. We could add a max limit to the directory context.

@2mawi2
Copy link
Contributor

2mawi2 commented Mar 19, 2023

Implemented in #44

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 a pull request may close this issue.

4 participants