background

CLAIRe: Conversational Learning AI with Recall

Suvansh Sanjeev2023-07-26

Experience a new paradigm of AI conversation. CLAIRe responds, remembers, and reaches out.

CLAIRe is open source. Find the code and setup instructions here!

In an era defined by advanced technology and AI, the significance of creating an engaging and seamless conversational experience cannot be overstated. Meet CLAIRe: Conversational Learning AI with Recall, a next-generation chat-based AI developed to take us a step closer to a human-like conversational experience.

Overview

CLAIRe’s principal function lies not merely in providing real-time responses to user queries, but in modeling human conversational styles. While traditional chatbots limit themselves to the current conversational context, CLAIRe’s multi-tiered context retrieval taps into near-term, medium-term, and long-term information reservoirs to generate responses. Unlike most AI chatbots that operate in a reactive call-response fashion, CLAIRe can reach out on its own with contextually-relevant follow-up messages.

Unleashing The Power of Contextual Conversations

Imagine telling a friend about introducing your partner to your parents. Your friend instinctively retrieves information from various contexts – your current relationship, your dating history, your parents' preferences – all of which factors into the response. Now, imagine your AI doing the same. CLAIRe uses a combination of current conversational context, semantically relevant past messages, and saved entity-specific information from prior conversations to generate cohesive and natural responses, closely mirroring human conversational dynamics.

Active Messaging: Breaking the Conventional Paradigm

While traditional chatbots adhere to a reactive conversational style, CLAIRe introduces active messaging, challenging the conventional call-response paradigm. Suppose you mentioned being nervous about a work presentation the next day. Much like a considerate friend, CLAIRe will not only respond to your immediate anxiety but remember to follow up, wishing you luck or asking how it went.

Features

CLAIRe's cutting-edge features include:

  • Entity Recall: CLAIRe remembers details about people and places it learns from its conversations, weaving this knowledge seamlessly into responses. So when you ask it what to get your mom for her birthday, it can draw on past information you’ve given about her to make an informed recommendation. Inspired by and adapted from LangChain’s EntityMemory, but modified to persist information to Chroma.
  • Comprehensive Memory: CLAIRe's memory combines the above components with the current conversational context to seamlessly synthesize various temporal resolutions, resulting in human-like conversations.
  • Active Messaging: Based on your conversations, CLAIRe can decide to send follow-up messages, checking in on you or even reminding you of appointments you mention (though it isn’t reliable enough to replace your alarms). This feature works best in GPT-4 mode.
  • Message History & Search: CLAIRe stores your past conversations. Though you can clear the current conversation context to keep things clean and reset a bit, CLAIRe also automatically loads past messages as you scroll, ensuring the context is never truly lost. The search feature allows both exact and semantic search through Chroma, letting you find past messages with ease, even without knowing the exact phrasing. The auto-loading and search UI are modeled after Meta’s Messenger.
  • Profiles: CLAIRe supports separate profiles backed by separate Chroma collections, preventing information cross-over and preserving individualized personas and contexts (e.g. for personal vs work).

CLAIRe's active messaging in action

Semantic search syntax – note that the word "appointment" is not an exact match

CLAIRe's unique combined memory allows it to seamlessly answer questions as a friend might rather than giving generic ideas or repeatedly requiring the same context.

Architecture

The below diagram illustrates the relationship between some of the main components of CLAIRe's backend.

Limitations and Improvements

CLAIRe is open source and contributions addressing the below issues (or others) are welcomed.

Scheduler Implementation

CLAIRe use a bare-bones scheduler that serves as an exciting proof of concept while leaving room for improvement. It schedules future messages as you talk to CLAIRe by saving them to disk in a profile-specific file that gets polled for messages periodically (every 30 seconds by default). This means CLAIRe can’t unschedule messages. For example, if CLAIRe makes plans to follow up on how a doctor’s appointment went, and you discuss it prior to the scheduled message arriving, it will still send the follow-up message as scheduled.

A possible extension of this message scheduling system could feed in relevant messages that are already scheduled and give CLAIRe the option of unscheduling messages. This would also reduce the likelihood of redundant scheduled messages on the same topic. An improved scheduling system might also address redundant messages by waiting for a lull in the conversation before issuing scheduled messages.

A consequence of the disk-based scheduling mechanism is that if you have multiple CLAIRe tabs open, only one of them will win the race to poll for the scheduled message. A possible modification of the scheduling system would see the `scheduledMessages` API endpoint delay the deletion of the scheduled message from disk by a couple seconds, allowing all tabs to poll and receive the message. Equivalently, the scheduled messages could remain in place until a scheduled daily process removed old messages that had already been sent out.

Warm Starting

Starting off with CLAIRe is like making a new friend in both good and bad ways. CLAIRe doesn’t know you yet when you begin, and though it will learn more about you and the folks in your life, it would be nice to be able to warm-start it by embedding Tweets, Facebook posts, blog posts, or autobiographies through integrations with social media profiles or document uploads.

User Interface

Though the UI is quite responsive, the load-on-scroll behavior sometimes interferes with navigating search results. This can be avoided if you don’t load history while navigating search results, but poses an irksome limitation on CLAIRe’s UI that would be nice to rectify. The relevant scrolling and searching behavior is contained in the Chat React component.

Getting Started

Setting up CLAIRe is simple. All you need is Docker on your computer and your OpenAI API key handy. You can find detailed setup instructions in the CLAIRe GitHub repository README.

Acknowledgments

A huge thanks to Chroma for supporting the development of this project through the Hacker-in-Residence program. The program was a wonderful experience, from the team to the snacks and the vibes in between.

Anton’s support through weekly check-ins and proactive support (not unlike CLAIRe ;) were pivotal in getting thoughtful feedback, hearing his unique perspectives, and thinking about the most interesting directions to take my project ideas.

Conversations and support from Jeff, Peter (another hacker-in-residence), and Hammad were also incredibly useful in thinking about modeling human conversational dynamics.

CLAIRe is also built with LangChain and draws inspiration from several of its abstractions in creating a new experience for AI chat.


See More Posts

background

CLAIRe: Conversational Learning AI with Recall

background

CeLLM = Cell + LLM: Automate your spreadsheet workflows

background

Open Data Interpreter: Talk to your data

Show more


brilliantly Blog

Stay connected and hear about what we're up to!