ian-kent / gptchat

A GPT-4 client which gives your favourite AI a memory and tools for self-improvement

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ERROR: ChatCompletion failed: error, status code: 400 (Context Limit)

NeauraNightsong opened this issue · comments

commented

After only a few mins of chatting with the AI through this program, I keep getting:
ERROR: ChatCompletion failed: error, status code: 400, message: This model's maximum context length is 8192 tokens. However, your messages resulted in 8708 tokens. Please reduce the length of the messages.
This happens no matter how short my message is, and it seems impossible to move forward.
am I doing something wrong?

Hey @NeauraNightsong 👋

gptchat attempts to send the entire conversation history every time (which includes all of the supporting prompts for things like memory and plugins), so you're not doing anything wrong, it's just exceeded the 8k token limit.

At the moment you'd need to start a new conversation to clear the history which isn't ideal - I can probably update the code to only send the more recent messages (which I'm assuming is how ChatGPT works) but I don't have time to look into this right now.

commented

This doesn't seem to be a viable or effective method to give GPT a long-term memory. But I appreciate the work you've done in putting this together! It's very cool how it writes its memories to a file.