bulky-dusk-45106
06/06/2023, 9:06 AMacceptable-kangaroo-64719
06/06/2023, 10:33 AMevent.state.session.history
is a windowed memory that only saves the last 6 messages sent. This could mean 3 user messages and 3 bot messages, or 5 bot messages and 1 user message, depending on your flow. Your code snippet should first see if the message is already saved in workflow.transcript
and, if not, append it rather than overriding it.
2. There's a new agent, summary agent, that will use GPT to summarize the conversation and save it to a variable. This is a summarized memory that can be more condensed by less detailed, if that's what you're looking for.
3. Your code as it is now needs to be run inside a flow after each conversational turn- that's a pain! You can make it run automatically by putting it inside of an after_incoming_middleware
hook.
If you're looking for a deeper dive into chatbot memory, this post from Pinecone is really thorough. It's about Langchain, not Botpress, but the concepts for different memory types transfer well. https://www.pinecone.io/learn/langchain-conversational-memory/bulky-dusk-45106
06/06/2023, 12:08 PM