docs: AstraDB as Chat Memory (#4815)
* chat memory update in Astra as chat memory * updated image * docs: update chat memory documentation for external database integration and clarify session ID usage * capitalization * Apply suggestions from code review Co-authored-by: KimberlyFields <46325568+KimberlyFields@users.noreply.github.com> --------- Co-authored-by: Mendon Kissling <59585235+mendonk@users.noreply.github.com> Co-authored-by: KimberlyFields <46325568+KimberlyFields@users.noreply.github.com>
This commit is contained in:
parent
7c4b9b6cce
commit
11286778dc
3 changed files with 41 additions and 1 deletions
|
|
@ -51,3 +51,43 @@ You can also display all messages stored across every flow and session by going
|
|||
|
||||

|
||||
|
||||
|
||||
|
||||
## Store chat memory in an external database
|
||||
|
||||
Chat memory is retrieved from an external database or vector store using the [**Chat Memory**](/components-helpers#chat-memory) component.
|
||||
|
||||
Chat memory is stored to an external database or vector store using the [Store Message](/components-helpers#store-message) component.
|
||||
|
||||
The [**Chat Memories**](/Components/components-memories) components provide access to their respective external databases **as memory**. This allows AIs to access external memory for persistence and context retention. For example, connect the **Chat Memory** component to an **AstraDBChatMemory*** component to store the message history in an external Astra DB database.
|
||||
|
||||
This example stores and retrieves chat history from an [AstraDBChatMemory](/Components/components-memories#astradbchatmemory-component) component with **Store Message** and **Chat Memory** components.
|
||||
|
||||
### Prerequisites
|
||||
|
||||
* [An OpenAI API key](https://platform.openai.com/)
|
||||
* [An Astra DB vector database](https://docs.datastax.com/en/astra-db-serverless/get-started/quickstart.html) with:
|
||||
* Application Token
|
||||
* API Endpoint
|
||||
|
||||
### Connect the chat memory component to an external database
|
||||
|
||||
1. Load the [Memory Chatbot](/starter-projects-memory-chatbot) starter project.
|
||||
This starter project extends the basic prompting flow to include a chat memory component.
|
||||
2. Add the [Store Message](/components-helpers#store-message) component to the flow.
|
||||
The **Store message** component stores messages in the external database.
|
||||
3. Add the [AstraDBChatMemory Component](/Components/components-memories#astradbchatmemory-component) to the flow.
|
||||
The **Astra DB Chat Memory** component stores and retrieves messages from **Astra DB**.
|
||||
4. Configure the **AstraDBChatMemory** component with your AstraDB instance details.
|
||||
1. In the **Astra DB Application Token** field, add your Astra token. (`AstraCS:...`)
|
||||
2. In the **API Endpoint** field, add your Astra database's endpoint. (for example, `https://12adb-bc-5378c845f05a6-e0a12-bd889b4-us-east-2.apps.astra.datastax.com`)
|
||||
5. Connect the **AstraDBChatMemory** component output to the external memory inputs of the [Chat Memory](/components-helpers#chat-memory) and [Store Message](/components-helpers#store-message) components.
|
||||
6. Link the [Chat Output](/components-io#chat-output) component to the input of the [Store Message](/components-helpers#store-message) component.
|
||||
|
||||
Your completed flow should look like this:
|
||||
|
||||

|
||||
|
||||
7. In Langflow, create message traffic by running a flow.
|
||||
8. Inspect your Astra database's tables and activity.
|
||||
You will see new tables and traffic created.
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ Check and adjust advanced parameters by opening the Advanced Settings of the **
|
|||
|
||||
|
||||
|
||||
## Use Session ID in with the memory chatbot flow {#4e68c3c0750942f98c45c1c45d7ffbbe}
|
||||
## Use Session ID with the memory chatbot flow {#4e68c3c0750942f98c45c1c45d7ffbbe}
|
||||
|
||||
|
||||
---
|
||||
|
|
|
|||
BIN
docs/static/img/astra_db_chat_memory_rounded.png
vendored
Normal file
BIN
docs/static/img/astra_db_chat_memory_rounded.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 465 KiB |
Loading…
Add table
Add a link
Reference in a new issue