Conversational 'memory' using completions endpoint

I am testing out the chat completion endpoint.

Its cool.

So I set the prompt to “My name is bob smith”
I send it to the API
the GPT response is “Hello Bob How Can Be Of Assitance”

My next prompt is “What is my name”
But the GPT response will be something like “I am a laguage model and cant help” or “I dont know”

So it has not kept a log of the conversation.

Does this mean that every prompt/question sent to the completions endpoint is just processed and not stored anywhere? (this is good for privacy)

But I was expecting it to be like chatgpt where you could have an ongoing conversation where it has access to your previous messages/prompts.

Would be good if say you had to init the completions endpoint with ‘system’ messages, which returned a conversation id. You then used that id to send prompts, that way all prompts and replies were stored under that id.

To end the chat you could then send a request to close (and thus delete) that conversation… I guess that might not be ideal in that openai would then have to store those messages…

Is the only way to do this at present to use few shot prompting method where you use ‘user’ and ‘assistant’ roles and input the previous messages into the message array

1 Like

Yeah, you need to send back all the context you want as user/assistant pairs.

You can look at Assistants which is (sometimes) a bit easier, but you have a lot less control over handling it yourself.

But yeah, they can’t “store” then offer it for free. Well, they could, but they probably won’t?

If you search the forums, you’ll find a lot of related threads.

The quickstart guide and API cookbook are two good resources too as you delve down the LLM rabbit hole.

Hope you stick around. We’ve got a great dev community growing here.

1 Like

I just found the Threads and messages endpoints, and realised they work in the way I talked about in my op. Seems good

So the completion endpoints seems better for one off responses or short brief conversations where you can pass in a few previous messages to keep the new gpt responses in the same context.

The Threads are better for creating chatbots like chatgpt or for more advanced converstation use.

Yep, i wish API could restore memories, therefore, we could just give GPT a complex context and then we start to send tasks to the GPT, which not only saves a lot tokes but also capable of more complex job. However, it seems impossible for API to have a memory, it’s costy for the openai and very “unsafe” bc you can train it whatever you want.