Skip to content

Upstash Redis Chat Memory

Upstash Redis Chat Memory stores the message history of a conversation in an Upstash Redis database, a cloud Redis service, and retrieves it when needed. This way, components that answer questions take into account what was said before, and the history stays in your Upstash account.

Each history is identified by a Session ID: messages with the same identifier form one conversation.

When to use it

  • Your company already works with Upstash and wants its assistants’ history stored there.
  • You want conversation history kept in a database in your own account, without running a server.
  • You want to share a conversation’s history with other applications that read from that database.

Configuration

Before you start you need a Redis database in Upstash and a credential of the Upstash API service with its Index URL (the database address) and its Index Token (the access token). See Credentials.

FieldWhat it does
Credential (required)The credential of the Upstash API service. Pick one with Choose an option or create one with Add new credential.

Advanced options

FieldWhat it does
Session IDThe identifier of the history. Type it or connect it, for example to the customer number. Conversations with the same Session ID share their history.

Output

Memory is the conversation history. Connect it to the External Memory input of Retrieval QA History, which reads the history before answering and saves each question and answer to it, or of Chat Memory, which reads the stored messages to use them elsewhere in the flow. If you connect it to Chat Memory, the Session ID of Chat Memory is used.

It does not connect to the Memory input of agents. To give an agent memory, use for example Redis Memory.

Example

The language school Lingua has an assistant that answers questions about courses and enrolment from its internal documentation:

  1. Create an Upstash API credential with the Index URL and Index Token of the school’s database.
  2. Add Upstash Redis Chat Memory, choose that credential and connect the student number to Session ID.
  3. Connect Memory to the External Memory input of Retrieval QA History.

When a student asks about the B2 English course and then writes “and how much is it?”, the assistant understands they are still talking about that course.

Good practices

  • Use a different Session ID for each customer or case so histories don’t mix.