getzep/zep-python

Any way do delete session messages instantly?

Closed this issue · 5 comments

Hello.

I'm using zep memory (and probably session in future) for chat history.
I currently use my internal user_id as session session_id=user_id.

The issue is that I want to be able to reset the history faster.
When having
purge_every: 1 in config.yaml and using zep_client.memory.delete_memory(user_id) or zep_client.memory.get_memory(user_id).messages.clear()
User then starts a new conversation before msg="completed purging memory store" log, and i get

API error: {'status_code': 400, 'message': 'storage error: session .... is deleted (original error: <nil>)\n'}

Unfortunately, I can not use any new session variable except same user_id.

Is there any way to renew session instantly - or at least remove all messages and session variables?

Thank you for this very helpful solution and advices.

We're considering approaches to allow deletion of messages separate from sessions. For now, the suggested approach is to not use user_ids as session_ids, but to use a one-to-many data structure between users and sessions. In this model, can be deleted and new ones created, while still associated with a single user.

Yeah, this is obvious approach but requires extra DB/storage for sessions except of ZEP itself. I want to avoid it somehow.
Do you think new approaches to be implemented any time soon?

I've just merged getzep/zep#160 on the Zep server project. If you pull from main and compile, you'll be able to test out this new behavior. Let me know your thoughts...

This change is now deployed in v0.10.0.

Works! Thank you very much!