Find answers from the community

Updated 2 months ago

I have a RAG chatbot with memory and I

I have a RAG chatbot with memory and I want to store chat logs so I created chat store like this -
Plain Text
chat_store = SimpleChatStore()
and created memory like this -
Plain Text
memory = ChatMemoryBuffer.from_defaults(
            chat_store=chat_store,
            chat_store_key="user1",
        )

but how can I add new logs every time? I tried to find some insert function but coudn't find it. Also I have to persist chat_store only once and then add data to it right?
W
S
L
12 comments
If you are conversing, it will get inserted on its own if you are using chat_engine.
inserted where? I know they will be saved in chat_store. I want to save this chat logs locally
You can get all the chat conversations using: chats = memory.get()
You can save it into a json file from there
then I dont have to use
Plain Text
SimpleChatStore()
?
chat store manages the chat history across several users, not just a single memory
The chat store will be updated automatically as the memory is used by that chat engine/agent
ok how to save it in a file though?
i know there is a .persist but then once file is created how can I add another chat logs to this existing file?
You can save and load it as needed

SimpleChatStore.from_persist_path("./path/to/file")
I have a chatbot in which users can message and get response I want to record save each query and its response from chatbot in a file how can i do that?
In that case, just use python and write to the file yourself?
yes I have been thinking about doing that
Add a reply
Sign up and join the conversation on Discord