[Python] Need coding help. NPC conversation history can't pass 800 tokens

Wow, I didn’t realize the difference was that high, 50% is quite huge when I am hitting 300+ token messages constantly.

That is actually genius. I never would have thought of that. I haven’t used “truncate” property before so I will have to check that out first. But to make the AI summarize what happened so it doesn’t get overwhelmed by small details is really smart. Although I can see AI starting to miss the point eventually for non stop summarizing. Will have to test like you see.

Yeah, I updated my script multiple times after we talked, pop(2) is what I am using too, pop(0) and (1) actually remove important information, not the chat history I want. I didn’t know how pop() worked that well before, but now I do. I also have a “history text file” I record so NPCs remember events between save’s. Button to remove and reroll last prompt/response.

Can’t wait to see what else I can do with chatGPT API, it is very cool. Messing around with imagine generation and text to speech atm. I follow the official documentation as a guide and ask chatGPT itself how to code these. And now, here on the forum, I am starting to ask and read.

Thanks again

1 Like