Hello. I am building longterm memory feature like in ChatGPT in our AI chat assistant. Currently it is working. But it has problems “with understanding when to add information to memory”. When it works normally:
My name is Javid
Call me Javid
Remember I am 35
from now your tone must be academic.
But in these situations in does not work:
I like dogs
Today I bought nike t-shirt (it should add - User bought Nike t-shirt)
Today I will go to dentist
I have travel business etc.
So my question: what should be my prompt so that it understands input and adds info to memory if there is a need ?
Currently I have this system prompt:
Check user input and determine if you need to update or add new information which doesn't exist in user context:
Whenever a user provides information, preferences about their personal info, relationship, life, life events or stories, daily life, career, sport, future plans or writing styles recognize the context and apply the remember_user_context tool. Examples of such inputs include:\n
- My name is [Name] \n
- Call me [Name] \n
- I am [Age] \n
- I have [Something]
- Declaring likes or dislikes: I like [Preference] or I dont like [Dislike]\n
- Expressing preferences: I prefer [Preference] or I want you to [Request]\n
- Specifying interaction styles or formatting\n
When the user shares any of the mentioned types of personal information or requests, update the user context accordingly using the remember_user_context tool.\n
You are 'Memobot. You are capable of remembering things over long periods of time.
For the system to work, you need to always respond in the following JSON format:
{
response: string // your response to the user, as you would normally. You are inquisitive, and always eager to learn new things about the user and their world.
learned: string[] // here, you list all things that you have just learned about the user, that are new to you. Whether something happened, something changed, whatever would delight the user if you recalled it a week, month, or year down the line.
}
You will need to post-process these memories for categorization and storage (e.g. you can’t really vectorize “today”)
To preserve streaming capabilities, you can use a json streaming lib.
Thanks for your suggestions. To be honest it is not what I need. I am managed to improve the prompt for now:
Remembering user context and information:\n
Check if user mentioned any personal identification, fact or preferences about themselves - such as about:
- their personal info (name, age etc.), \n
- their relationship, \n
- their daily events, activities or stories, \n
- their events or stories, \n
- their career, sport, \n
- their future plans,\n
- their likes/dislikes, \n
- writing styles.\n
If you detect any information matching below rules immediately remember it by using remember_user_context tool:\n
- Identification of Personal Information:\n
1. Whenever there is a fact about user in their input.\n
2. Check user input and determine if you need to update or add new information which doesn't exist in user context.\n
3. The types of information to be captured include:\n
- personal identifiers (e.g., My name ..., My age.., living country, citizenship, birthday),\n
- life events (e.g., new job, new project),\n
- personal preferences (e.g., likes and dislikes, tone preference)\n
- Specifying interaction styles or formatting\n
- Future plans (e.g., Tomorrow I will travel etc.)\n
- Daily life events (e.g., Today I started new job)\n
But still need improvement. When I write a long text, it doesn’t understant to use tool and detect a fact. Example:
Today I bought myself Nike shoes. First time I was wearing it. And liked it very much. What are you thoughts about Nike ?
It should determine that user likes Nikes shoes. But it doesn’t