Astra DB Chat Memory
Astra DB Chat Memory stores the message history of a conversation in an Astra DB collection, DataStax’s cloud database, and retrieves it when needed. This way, components that answer questions take into account what was said before, and the history stays in your Astra DB 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 Astra DB and wants its assistants’ history stored there.
- You want the history in the cloud without managing a database server.
- You also use Astra DB as a knowledge base and prefer to keep everything in the same account.
Configuration
Before you start you need a database in Astra DB and a credential of the Astra DB API service with its application token and address (API Endpoint). See Credentials.
| Field | What it does |
|---|---|
| Credential (required) | The credential of the Astra DB API service. Pick one with Choose an option or create one with Add new credential. |
| Collection Name (required) | The name of the Astra DB collection where messages are stored. |
Advanced options
| Field | What it does |
|---|---|
| Namespace | Optional. The Astra DB namespace that holds the collection. If you leave it empty, your database’s default one is used. |
| Session ID | The 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 make an agent remember the conversation, turn on Use memory in the agent.
Example
Clínicas Dental Avellano has an assistant that answers questions about treatments using the information in its brochures:
- Create an Astra DB API credential with the token and address of its database.
- Add Astra DB Chat Memory, choose that credential and type
historial_pacientesin Collection Name. - Connect the patient’s identifier to Session ID.
- Connect Memory to the External Memory input of Retrieval QA History.
When a patient asks about invisible braces and then writes “how long does it take?”, the assistant understands they mean the same treatment.
Good practices
- Use a collection only for the history, separate from the ones you use as a knowledge base.
- Use a different Session ID for each customer or case so histories don’t mix.