#ChatGPT API Remember Context

20 messages · Page 1 of 1 (latest)

native condor
#

I have created the ChatGPT Bot for my chat platform (Webex) using ChatGPT API, but it does not remember the previous messages. ChatGPT only answers the question itself, it does not remember the context. Are there any ways to make ChatGPT API remember previous messages?

twilit osprey
#

there’s no direct way to do this

#

You should add both the bot’s reply and the message you’ve sent to the prompt

ancient plover
#

@twilit osprey I am running into the same issue as @native condor . Essentially if there is enough messages between the AI and the User. I think its sheer word count IMO. The AI fails to remember anything prior to the most recent requests.

e.g. If i were to copy and paste three articles in succession for the AI (separated due to character limit), it gives a summary each time an article is posted.

By the time after the third article is summarized. If i were to ask the AI what the three Titles of the articles were... it would forget and generate 3 titles based on the third article and come up with meaningless jargon.

#

Simply put, I believe, the AI is capped in its ability to use the user's responses as a resource. Although it seemingly can process much more. Is this a development issue? or is this an engineering/hardware issue?

twilit osprey
#

For example

#

This is the original prompt:

The following is a conversation between Human and AI.\n
Human: Hello\n
AI:
#

You send it to the api server it's responses is "Hi there, how are you?"

#

Then, if you want to the conversation to going on, you should modify your prompt to this

#
The following is a conversation between Human and AI.\n
Human: Hello\n
AI: Hi there, how are you?\n                    ←First add the reply here
Human: Fine thanks, where are you from?\n          ←Then add the next message you want to send
AI:                                               ←Finally add a new AI:
#

You can then get the response like this: "I'm an AI developed by Open AI." (just an example)

#

So acutally the api doesn't simply reply to you, it just fill in the blank after The "AI:" to let the whole conversation make sense.

#

Of course if the prompt still have a max limit of 4000 tokens. If you want to let it have a permanent memory, that requires text embedding and semantic search to automatically store key information of the chat and then add to the prompt according to your message, which is what I'm learning now 🧐 .

#

@ancient plover @native condor I hope what I said can help you. If you have any questions, feel free to ask me for help.

rugged hill
#

Hi folks! I'm hitting the same wall - building a mobile app and want to emulate part of the functionality of ChatGPT, as in, having multiple threads where one can send prompts to the api (I'm using the /chat/completions end-point). But the api doesn't remember context and if I send a follow-up prompt, it answers that "Unfortunately, you have not provided any information about the specific.."

#

sending a couple of the previous prompts might work, for a limited number of prompts, but if the discussion gets longer ...ouch

#

I would at least hope that sending previous prompts with the "system" role wouldn't use tokens 🤞

rugged hill
#

Ok, so it seems, as @twilit osprey indicated above, the solution is to resend the conversation history each time - which does actually consume tokens.
Another option might be to use embeddings, but the documentation on how to use it in connection to other api end-points is ...light

lean brook