Guide: ChatGPT Style Memory in Botpress
# 📖tutorials
s
Link: https://www.loom.com/share/2b6b2440c1094f66bbc1a057e07fc464?sid=8e7df506-8da4-43dd-8fee-d0f4e28d91b3 It covers: Using Summary Agent in AI Task to achieve ChatGPT style memory Help support these tutorials buy supporting me 🙂 https://www.buymeacoffee.com/simplygreatgames
Want to test it yourself? Import the bot into a blank project under Import / Export when you click on the top left logo in the botpress studio
For a more sophisticated test see images.
r
you're awesome @straight-wolf-37371 !
c
You are legend @straight-wolf-37371 this works as good as chatgpt ❤️ It can remmeber covnersation. I think many in community will love this, this can solve the reptead questions that many face here includes me. 🔥
s
💡 I think it would be great to have a toggle on the AI Task that automatically does this for the user. It seems to be as common misunderstanding. Something like "Send Summary Transcript" or something would be a great easy fix! I'll put it in the feature request section
r
Yes that;s a good idea
c
That's amazing @straight-wolf-37371 - thank you so much for sharing this video with the Community! Do you think you could also share your bot in the #1120796649686573086 channel?
s
b
Hi, I appreciate your help, but look at your bot. Do you have the problem that one day everything is ok and the next it doesn't work? Add to Knowledge Agent: Provide Context to KBs: {{conversation.SummaryAgent.summary}} {{ conversation.SummaryAgent.transcript }} And remove Latest Response - {{event.preview}} Works ok, today. Of course, many thanks botpress for the development.
s
I think there have been some stability issues happening in the past couple days. This is just a starting point for memory, work with the AI Task prompts for your specific use case and add cases to control for different situations. If you were to put the messages you provided to the bot directly in to chat gpt it will do something similar and jsut provide the convo back to you. Based on your response to the bot, I'm not sure what you are expecting back from it.
b
I do not expect this
c
try to mention in your ai task "If a user mentions 'goodbye' or wishes to conclude the conversation, kindly wish them a good day. Whenever someone expresses gratitude with 'thank you' or similar, reply with 'you're welcome! "
i had similer issue
c
Thanks for sharing this guide! However, I'm not really sure what is the purpose of the execute code card when you have the transcript in the AI Task 🤔
s
The execute card is just printing the transcript out the console so that you can see what is being passed into AI Task. For the user, it doens't do anything. As a developer, its great to print things out to the console so you can easily debug/see what is going on. So you are right, for the user using the bot, the execute card is not doing anything
a
what about using {{event.state.session.fullHistory}} instead of {{event.preview}}?
is there any difference?
s
event.preview is the latest message from the user. I'm not really sure what the fullhistory one is that you have listed there. It may be more similar to the conversation.SummaryAgent.transcript
a
I'm using event state session fullHistory actually and it seems like it does the same thing
c
Ah makes sense
a
As remembering the convo
Maybe u can try swapping event preview with it and see how it goes
f
I have it too and it works like ChatGPT... I believe that was used before the introduction to agents
r
fullHistory comes from a custom hook (probably from a template – this is not an official BP feature/variable)
a
Yea it comes from a template but it basically works like chatgpt
w
@straight-wolf-37371 thanks for this! How could I work with this same memory similar to ChatGPT using the Stack AI API? Bringing Stack AI into Botpress with this same memory is proving to be my major challenge. That would be the perfect world for my business.
s
Sorry, I haven't worked with Stack API. What do you pass in? Anyway to provide the conversation.SummaryAgent.summary?
s
@straight-wolf-37371 Hello, it seems it doesn't work if the bot is answering from knowledge base? When looking at my logs I can see there is a prompt with the whole conversation, but the bot still is confused and gives answer that is not connected to a conversation history. I ask about product X with follow-up questions "how much" and it gives answer with price of a very different product, never mentioned in conversation. The only differnce from your bot is that it answers from KB.
s
Correct. This is just supplying memory to Chat GPT in AI Task cards. It doesn't supply memory to Knowledge Base. You can set up knowledge base to use summaries as well doing a similar approach. But you may not even need to do it yourself anymore. Recently, there was a "Provide Context to KBs" added to the Knowledge Agent. You can pass the summary in there
s
oh thanks! It worked for a sec, but unfortunately I encounter problems with providing Context to KBs which is: errorError generating answer for KB [AxiosError: Request failed with status code 500]. Happened to me before when providing other things in this field.
f
fix incoming very soon, issue was found for this.
q
Good tutorial, thank you but not working as expected, did you have a fix for that ?
s
Any fix available for this? @freezing-printer-49373 @straight-wolf-37371
t
hi @straight-wolf-37371 is there anyway to escape the conversation? when the context is getting mix up , anyway to start over? thankssss
s
Look into Intents, you coudl create an intent to where the user can say cancel, restart, etc to end the conversation
b
@brief-accountant-68119
t
what about if user dont know it should say "restart" , we just create option for them to choose to restart over ? but if it goes near the ending and it restart, it might be annoying to the user. @straight-wolf-37371 thanks a lot!!!
s
This is getting a little bit into design flow and architecture. How you need to set it up can be really different depending on what your bot is trying to achieve. You can explore creating different workflows and seeing how you like it. This is just a starting point to build on to.
t
thankss
f
How to train chatgpt plugin to give real time information of 2023
c
I would advise posting this in the general or the #1111009377525186570 channel.
n
As soon that I gain money, I will buy you some coffee 🙌
Thanks a lot for all your Tutorials
They are great
i
I have tried various ways to make the bot act like a chatbot, looping in the same node using the transcript history of the summarizer agent. I added Personality Agent. I put the history in the AI Task Input card of the AI Task and asked it to read the entire
{{ conversation.SummaryAgent.transcript }}
before. I changed and put everything in the AI Generate Text card. I also mixed all of this for testing purposes. None of these worked consistently. Most of the time, the bot repeats its last question indefinitely in the loop. Sometimes it writes the command I gave it instead of the result. Has it been working perfectly for you all? I don't know what I might be doing wrong.
b
this method works perfectly. you just need to learn how to prompt engineer. it's the harders part about building Ai
j
hey man
it deos not work for me
i think im doing it wrong
i did it exactly like you did in your file
guys c
can someone help me ?
s
Damn this is sick
b
Do exactly as he did
Basically, you need to pass the conversation history to your AI Task
f
Does anyone know how to integrate into fb and ig. I got it working with fb but not ig. And also how to restart the convos?
b
To reset the conversation type //state/reset
j
hi
can we do it without ai task ?
becuase im using KB
can someone help me please
it does not work for me
b
Do you want to reset the conversation within your workflow? The command I mentioned can be typed in chat
j
huih me ?
What am i doing wrong ?
11 Views