#Managing context with API

1 messages · Page 1 of 1 (latest)

left sedge
#

Hey there, i have created a python script to manage the context of a prompt, i want to know if an experienced python dev can either review it or comment on what i could improve about it. i made this by just googling, copying and pasting and adding some of my own experience in other languages. i just want to know if i am sending the context correctly to get a good result out.

the general idea is that i save every prompt/message that a user send in a json file that is named exactly as the user and take all the messages until i hit the token limit, to then send it to the AI, this way i assure myself it does not lock up due to a token limit and assure myself it does not trim from the context of the character itself.

i dont use any specific techniques so if i am doing something stupid or redundant please feel free to criticise me, i am here to learn

thanks in advance!

#

to read out the parameters i just took the chiharu example from oobabooga, since other programs base the context on this as welll