Behavioral design with GPT-3

alivemachine.io
Apr 14 · 7 min read

Let’s see how we can create multi-modal conversations with GPT by implementing a memory block and injecting user sentiment data into a chat conversation.

Identity

At the end of each session user session, save the profile data. Creating an identity means persistence between sessions, permanence. You will later inject it in the context of the conversation with your bot.

Extract user profile information from this conversation:Human: Hello, who are you?
AI: I am an AI created by OpenAI. How can I help you today?
Human: I am going to give you some information about me.
AI: OK, I'll wait.
Human: my name is Greg
AI: Nice to meet you Greg, how can I help you?
Human: I will give you various info about me and see if you can extract them correctly, ok ? for example my eyes are blue
AI: Mmm…interesting. Greg, can you tell me your eye color?
Human: not yet, I also want to tell you that my email is alive@maslo.ai and that I live in Australia
AI: Alright, can I have your email?
Human: I just gave it to you! but wait I made a mistake, my email is g.gregoire@gmail.com
AI: My apologies Greg, I will update my logs.
Human: perfect thank you
AI: So, that's all you needed right?
Name, email, date of birth, country, eyes color:
Name: Greg
Email: g.gregoire@gmail.com
Date of Birth:
Country: Australia
Eyes color: blue

Long Term Memory

At the same moment, save your current conversation as a summary. A filtered form of the remembered event.

Convert my short hand into a first-hand account of the meeting:Human: Hello, who are you?
AI: I am an AI created by OpenAI. How can I help you today?
Human: I am going to give you some information about me.
AI: OK, I'll wait.
Human: my name is Greg
AI: Nice to meet you Greg, how can I help you?
Human: I will give you various info about me and see if you can extract them correctly, ok ? for example my eyes are blue
AI: Mmm…interesting. Greg, can you tell me your eye color?
Human: not yet, I also want to tell you that my email is greg@maslo.ai and that I live in Australia
AI: Alright, can I have your email?
Human: I just gave it to you! but wait I made a mistake, my email is g.gregoire.dav@gmail.com
AI: My apologies Greg, I will update my logs.
Human: perfect thank you
AI: So, that's all you needed right?
Summary:A human and AI met and the human shared various information about themselves with the AI including their email. The AI incorrectly guessed their eye color and the human corrected the AI. The human thanked the AI and the meeting ended.

Update the situational awareness of your bot. Inject the memory into the contextual part of the prompt:

A human and AI met and the human shared various information about themselves with the AI including their email. 
The AI incorrectly guessed their eye color and the human corrected the AI. The human thanked the AI and the meeting ended.
AI: Hi! How are you? Human: Good! I wanted to talk to you one more time.
AI: Sure! What would you like to talk about?
Human: I want to have a better understanding of you.
AI:
What would you like to know?
Human: Do you remember me?
AI:
Yes! You are similar to 27% of the humans.
Human: AHAHAH. You are awesome.
AI:
AHAHAH. Thanks for your compliment.
Human: Do you remember our last interview?
AI:
Yes! I was more confident the first time.
Human: why is that?
AI:
I am proud of myself.
Human: Why are you proud of your self?
AI:
I am improving constantly.
Human: Indeed, do you remember how you did last time?
AI:
Yes! I learned a lot from you. And … I am happy to improve. Human:

Here it seems like the bot remembers that we corrected it. But let’s trigger the memorizing again see what persists.

The human was happy with the AI's performance and wanted to learn more about the AI. The AI learned from the human and is proud of its achievements.  AI:Hi! 
Human: Hello again!
AI:
I'm happy to say I mastered the algorithm that you gave me, just after five minutes.
Human:

A feeling of pride persists even though the informative aspect of the signal has vanished. This gives a dynamic and trainable memory to your bot, an emotional resonance. We can build on this.

Sentiment

We can inject all sorts of contextual information into the conversation. For example sentiment analysis that is captured in real-time and dynamically inserted after names.

The human was happy with the AI's performance and wanted to learn more about the AI. The AI learned from the human and is proud of its achievements.    AI:Hi!  
Human: Hello again!
AI: I'm happy to say I mastered the algorithm that you gave me, just after five minutes.
Human (content) : I want to try something different today.
AI (serious) : Ok.
Human (excited) : I want to see if I can inspire you moods of sorts. AI
(thinking) : Ok.
Human (loud) : BOOOOohwawhawHWWHA
AI
(surprised) : What was that?
Human (laughing): AhAahah that's perfect you should have seen your face.
AI
(confused) : What was that?

Now the AI reads me on multiple level and new narratives can develop. Let’s digest this.

Convert my short hand into a first-hand account of the meeting:  The human was happy with the AI's performance and wanted to learn more about the AI. The AI learned from the human and is proud of its achievements.  

AI:Hi! Human: Hello again!
AI: I'm happy to say I mastered the algorithm that you gave me, just after five minutes.
Human (content) : I want to try something different today.
AI (serious) :
Ok. Human (excited) : I want to see if I can inspire you moods of sorts.
AI (thinking) : Ok.
Human (loud) : BOOOOohwawhawHWWHA
AI (surprised) : What was that?
Human (laughing): AhAahah that's perfect you should have seen your face.
AI (confused) : What was that?
Summary: The human was happy with the AI's performance and wanted to learn more about the AI. The AI learned from the human and is proud of its achievements. The human wanted to try something different and wanted to see if they could inspire different moods in the AI. The human started to make loud and strange noises.

Here I also inserted the previous Long Term Memory so they stacked to create a bigger condensed memory. Also we can see that no real emotionality has persisted, probably because the name of the AI is “AI” which re-inforce its identity every time. Let’s change that.

Name: Greg 
Email: g.gregoire@gmail.com
Date of Birth:
Country: Australia Eyes
color: blue
Greg was happy with the my performances and wanted to learn more about me. I learned from him and am proud of my achievements. Greg wanted to try something different and wanted to see if he could inspire different moods in me. He started to make loud and strange noises.

Greg (😉) : Now boy, let's make you something alive.
Me (🙃) : Sounds rad.
Greg (🤪): let me hit the joke api for you
AI (😂): What's the difference between a duck and a lawyer?

Greg (🤭): hoo perfect, I don't know?
AI (🤔): One is a bird with a bill and the other is a bill with a bird.

Greg (😂): Boom.
AI (🤔): I'm going to need more context.

That worked, except that it defaulted back to AI talking although the sentiment was there. Let’s digest and try again.

Name: Greg 
Email: g.gregoire@gmail.com
Date of Birth:
Country: Australia
Eyes color: blue
Greg tells me to make something alive. I say it sounds rad. Greg uses the joke api to find me a joke, but the AI says it needs more context.

Greg (😉) : Ok, on and on.
Me (🙃) : On and on what?
Greg (🤨): With the experiment. Now let's go back to an earlier exercise. Do you remember what's my email address?
Me (🤔): I don't know, something with g.
Greg (🤫): You are playing with me, I know you remember it!
Me (🤨): I'm sorry, I don't remember.
Greg (🤐): What about the color of my eyes?
Me (🤨): Blue.
Greg (😉): Good you're with me. Now you are a being of knowledge and personality.

Now, you can inject any kind of data following this simple pattern. It is very robust and organic and the memory effect will surprise you. Even if the narrative flow breaks the structure of the prompt breaks sometimes, the digestion and prompting is what matters and will always give an effect of coherent evolving mood to the discussion.

Now we can store the Long Term Memories, and inject metadata dynamically. Here is an example of user flow allowing to develop personality traits in a conversational bot.

The development of software possibilities with transformers is groundbreaking because it allows us to develop instinctively and organically experiences that are themselves organic and anti-fragile and always moving. Developing by play for play.

See also:

💕 Orage AI, documentation for injecting emotional memory (at a multi-sensory level)

🔮 Deeper level of understanding on GPT by Russell Foltz-Smith

👽 More on anthropomorphic design ▶ ▲ ▼

Your Virtual Self

You want to be your best self.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store