# Memory

***

Memory allow you to chat with AI as if AI has the memory of previous conversations.

*<mark style="color:blue;">Human: hi i am bob</mark>*

*<mark style="color:orange;">AI: Hello Bob! It's nice to meet you. How can I assist you today?</mark>*

*<mark style="color:blue;">Human: what's my name?</mark>*

*<mark style="color:orange;">AI: Your name is Bob, as you mentioned earlier.</mark>*

Under the hood, these conversations are stored in arrays or databases, and provided as context to LLM. For example:

```
You are an assistant to a human, powered by a large language model trained by OpenAI.

Whether the human needs help with a specific question or just wants to have a conversation about a particular topic, you are here to assist.

Current conversation:
{history}
```

### Memory Nodes:

* [Buffer Memory](https://tailwindsdocs.innovativesol.com/readme/chatflows/langchain/memory/buffer-memory)
* [Buffer Window Memory](https://tailwindsdocs.innovativesol.com/readme/chatflows/langchain/memory/buffer-window-memory)
* [Conversation Summary Memory](https://tailwindsdocs.innovativesol.com/readme/chatflows/langchain/memory/conversation-summary-memory)
* [Conversation Summary Buffer Memory](https://tailwindsdocs.innovativesol.com/readme/chatflows/langchain/memory/conversation-summary-buffer-memory)
* [DynamoDB Chat Memory](https://tailwindsdocs.innovativesol.com/readme/chatflows/langchain/memory/dynamodb-chat-memory)
* [MongoDB Atlas Chat Memory](https://tailwindsdocs.innovativesol.com/readme/chatflows/langchain/memory/mongodb-atlas-chat-memory)
* [Redis-Backed Chat Memory](https://tailwindsdocs.innovativesol.com/readme/chatflows/langchain/memory/redis-backed-chat-memory)
* [Upstash Redis-Backed Chat Memory](https://tailwindsdocs.innovativesol.com/readme/chatflows/langchain/memory/upstash-redis-backed-chat-memory)
* [Zep Memory](https://github.com/innovativeSol/tailwinds-docs/blob/main/integrations/langchain/memory/broken-reference/README.md)

## Separate conversations for multiple users

### UI & Embedded Chat

By default, UI and Embedded Chat will automatically separate different users conversations. This is done by generating a unique **`chatId`** for each new interaction.

### Prediction API

You can separate the conversations for multiple users by specifying a unique **`sessionId`**

1. For every memory node, you should be able to see a input parameter **`Session ID`**

<figure><img src="https://662370747-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3VoWwSsyrEg0DEvIIjv9%2Fuploads%2Fgit-blob-822b64c6e4d94f61c92afb0ae6b99c0687f4e723%2Fimage%20(76).png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

<figure><img src="https://662370747-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3VoWwSsyrEg0DEvIIjv9%2Fuploads%2Fgit-blob-c62be673735c66e09ea8e185b45cbacb0cc2712f%2FUntitled%20(1)%20(1)%20(1)%20(1)%20(1)%20(1).png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

2. In the `/api/v1/prediction/{your-chatflowid}` POST body request, specify the **`sessionId`** in **`overrideConfig`**

```json
{
    "question": "hello!",
    "overrideConfig": {
        "sessionId": "user1"
    }
}
```

### Message API

* GET `/api/v1/chatmessage/{your-chatflowid}`
* DELETE `/api/v1/chatmessage/{your-chatflowid}`

<table><thead><tr><th>Query Param</th><th width="192">Type</th><th>Value</th></tr></thead><tbody><tr><td>sessionId</td><td>string</td><td></td></tr><tr><td>sort</td><td>enum</td><td>ASC or DESC</td></tr><tr><td>startDate</td><td>string</td><td></td></tr><tr><td>endDate</td><td>string</td><td></td></tr></tbody></table>

All conversations can be visualized and managed from UI as well:

<figure><img src="https://662370747-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3VoWwSsyrEg0DEvIIjv9%2Fuploads%2Fgit-blob-b94f78c19d83219f64112548e93ec2a4dfeafca5%2Fimage%20(78).png?alt=media" alt=""><figcaption></figcaption></figure>

For OpenAI Assistant, [Threads](https://tailwindsdocs.innovativesol.com/readme/chatflows/langchain/agents/openai-assistant/threads) will be used to store conversations.
