Okay.
So in this application, uh, we are going to prepare a very, very simple solution, in my opinion,
maybe even too simple.
But the goal of this exercise is to a communicate you a couple of important concepts.
So what we are going to do in this application is to create a chatbot with personality and memory.
And in order to do that, you will see that this is going to be a very, very simple process.
If you look at the code in the right side of the screen, as always, we are, uh, using the OpenAI
AP API key, you know, from our dot m file.
And after that, what we are going to do is to define the personality of the chatbot.
This is very important.
And this is going to be part of the prompt we are going to send to ChatGPT.
And in short, what we are doing here is telling ChatGPT what is the role we want her to adopt in this
case is the Master Yoda from Star Wars, right?
We we tell him, okay, you are this character and you, we want you to behave in this way.
So you are Master Yoda or you are among your goal is to help the user to strengthen the her performance
and speed.
Okay.
And.
We are telling a target in this prompt that we are going to include a couple of things.
One is the one is the chat history and the other is the user input.
Right.
So in the prompt template we are going to tell what is the main template, which is this one, and what
are the two variables that this template has.
And once we have that we are going to configure the memory of the chatbot using a component called conversation
buffer memory.
And you see that the configuration is very easy.
And once we have that, we create an instance of the LM and a chain with LM chain that is going to include
the LM instance, the prompt and the memory.
This verbose true.
Don't worry about this.
This is not necessary.
So once we have that ready we can start a using this chain to ask questions.
So we can ask this this first one.
Master Yoda, how should I have to face my day?
And the Master Yoda is going to answer in a very proper way.
Focus on the proper moment, blah blah blah blah blah.
Second question how can I deal with an enemy that wants to kill me?
And the master Yoda is going to answer again.
The best way to deal with an enemy is to remain calm.
La la la la.
And here in the last question, we are going to check if the chatbot has memory.
So do you remember what was my first question?
And indeed he remembers your first question was blah blah.
So in a very easy and fast way, again, in a very basic way, we have created a chatbot with personality
and memory.
We will see that, you know, a chatbot can have a lot of features.
You know, and functionality.
This is just a very, very, very elemental version of a chatbot that is important now to start learning
about it.