Memory

The Assistant's memory allows it to recall past conversations and respond to your current message while maintaining context. Different memory techniques enable the Assistant to remember and utilize information from previous interactions.

We currently have two types of memories.

Simple Chat Memory

Simple Chat Memory stores conversations in a list. When you send a new message to the Assistant, it retrieves the most recent n conversations from memory and combines them with your message. The Assistant then generates a response based on this combined information, which is added to the memory for future reference.

Example

Current Memory

User: Hey

Assistant: Hello! How can I assist you today?

User: What can you tell me about Anthony Hopkins?

Assistant : Sir Anthony Hopkins is a highly acclaimed Welsh actor who has had a remarkable career in film, television, and theater. He was born in Port Talbot, Wales on December 31, 1937. Hopkins is widely regarded as one of the greatest actors of his generation and has received numerous accolades for his work, including an Academy Award, three BAFTA Awards, two Emmys, and a Golden Globe.

Hopkins' breakthrough role came in 1991 when he portrayed Dr. Hannibal Lecter in "The Silence of the Lambs." His chilling and mesmerizing performance earned him the Academy Award for Best Actor and solidified his status as a leading actor in Hollywood. The character of Hannibal Lecter became one of his most iconic roles.

New Message

what did he do before he was hannibal?

After the assistant generates the response, the new memory becomes.

User: Hey

Assistant: Hello! How can I assist you today?

User: What can you tell me about Anthony Hopkins?

Assistant : Sir Anthony Hopkins is a highly acclaimed Welsh actor who has had a remarkable career in film, television, and theater. He was born in Port Talbot, Wales on December 31, 1937. Hopkins is widely regarded as one of the greatest actors of his generation and has received numerous accolades for his work, including an Academy Award, three BAFTA Awards, two Emmys, and a Golden Globe.

Hopkins' breakthrough role came in 1991 when he portrayed Dr. Hannibal Lecter in "The Silence of the Lambs." His chilling and mesmerizing performance earned him the Academy Award for Best Actor and solidified his status as a leading actor in Hollywood. The character of Hannibal Lecter became one of his most iconic roles.

User: what did he do before he was hannibal?

Assistant: Before his role as Hannibal Lecter, Anthony Hopkins had a successful career in theater, television, and film. He began in the theater, performing in various stage productions, including Shakespearean plays. Hopkins then transitioned to television and film, gaining recognition for his roles in movies such as "The Lion in Winter" (1968) and "Young Winston" (1972). He continued to work on both sides of the Atlantic, appearing in notable films like "Magic" (1978), "The Elephant Man" (1980), and "The Bounty" (1984). However, his portrayal of Hannibal Lecter in "The Silence of the Lambs" (1991) brought him worldwide fame and critical acclaim, earning him an Academy Award and solidifying his status as a renowned actor.

Contextual Chat Memory

In Contextual Chat Memory, conversations are stored in a vector store instead of a simple list. When a new message is received from the user, a vector search is performed to find only the relevant conversation items from the memory. This retrieval process helps identify the most relevant information for generating a response. The relevant conversation items are then combined with the new message to generate a response from the Assistant.

This approach allows the Assistant to consider and incorporate contextually relevant information from past conversations, leading to more accurate and context-aware responses.

Learn more about vector stores, embeddings and relevant data retrieval here.

Last updated