CopilotChat.nvim icon indicating copy to clipboard operation
CopilotChat.nvim copied to clipboard

Bug: Failed to get response: {"error":{"message":"prompt token count of 22298 exceeds the limit of 20000","param":"","code":"","type":""}}

Open tecfu opened this issue 1 year ago • 1 comments

Issue:

After a certain threshold of input/output in the Copilot chat window, I get the following kind of error:

Failed to get response: {"error":{"message":"prompt token count of 22298 exceeds the limit of 20000","param":"","code":"","type":""}}

Fix Request:

Can we expose a command to truncate the tokens created subsequent to the oldest n entries until we can back under the prompt token threshold?

tecfu avatar Oct 05 '24 12:10 tecfu

Also wonder if it would be possible to call an external service to refactor/compress the tokens we've accumulated.

tecfu avatar Oct 05 '24 12:10 tecfu

I have found that this bug occasionally occurs in my environment as well. Hopefully I'll be able to catch the exact moment it happens, in order to provide a more detailed and accurate report.

pidgeon777 avatar Oct 18 '24 13:10 pidgeon777

Also wonder if it would be possible to call an external service to refactor/compress the tokens we've accumulated.

Interesting idea.

pidgeon777 avatar Oct 18 '24 13:10 pidgeon777

I added auto trimming of history to #455, the oldest history message is simply discarded until theres enough space when asking new question.

deathbeam avatar Nov 05 '24 13:11 deathbeam