# Long Term Memory

Long Term Memory in LangFlux refers to memory nodes that are capable of persisting past conversations, that can be later retrieved to resume the conversation. This allows the conversations for different users to be isolated.

There are 5 short term memory nodes in LangFlux:

* DynamoDB Chat Memory
* Motorhead Memory
* [Redis Chat Memory](https://github.com/hemati/FlowiseDocs/blob/langchain.space/integrations/memory/long-term-memory/broken-reference/README.md)
* Upstash Chat Memory
* [Zep Memory](https://docs.langflux.space/integrations/memory/long-term-memory/zep-memory)

<figure><img src="https://382019612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlkpR8fJFVMBw34EAzhwb%2Fuploads%2Fgit-blob-8f70ff8a8d8f10f446cdefe7a271850da63906ba%2Fscreely-1699894602544.png?alt=media" alt=""><figcaption></figcaption></figure>

## 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. That logic is handled under the hood by LangFlux.

### Prediction API

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

1. Use one of the long term memory nodes on LangFlux. Make sure the node has the input parameter **`Session ID`**

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

<figure><img src="https://382019612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlkpR8fJFVMBw34EAzhwb%2Fuploads%2Fgit-blob-c62be673735c66e09ea8e185b45cbacb0cc2712f%2FUntitled%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://382019612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlkpR8fJFVMBw34EAzhwb%2Fuploads%2Fgit-blob-b94f78c19d83219f64112548e93ec2a4dfeafca5%2Fimage%20(78).png?alt=media" alt=""><figcaption></figcaption></figure>
