Create memory management

Updated at:

To equip an AI application with long-term memory capabilities, you must first create a memory management application. Before you create the application, you must prepare an eligiblePolarDB for PostgreSQL cluster and database. Then, activate the service on the unified buy page and select the memOS or mem0 memory engine based on your business scenario.

Prepare the cluster environment

Before you create a memory project, you must prepare aScope of application-compliant PolarDB for PostgreSQL, and create a dedicated database for the cluster.

  1. Prepare a cluster: You can use an existing cluster orpurchase a new cluster based on your business requirements.

  2. Create a privileged account: Prepare aprivileged account for subsequent memory management creation. If you already have a privileged account, skip this step.

  3. Create a database: Create alogical database to store the data of the memory project.

  4. Configure an IP whitelist: Set whitelists for a cluster to ensure that your application can securely connect to the database.

Create a memory management application in the console

The overall procedure is as follows: go to the PolarDB Mem0 page in the console, configure the application parameters on the buy page, complete the purchase, and then check the application status.

  1. Log on to the PolarDB console. In the left-side navigation pane, click PolarDB Mem0.

  2. On the PolarDB Mem0 page, click Create Memory. The system automatically opens a new tab that displays the buy page.

  3. At the top of the buy page, click the PostgreSQL tab to switch to the configuration items of the PostgreSQL engine.

  4. Configure the parameters in the following groups. Fixed and auto-filled items do not need to be modified.

    • Billing method: The billing method determines the parameters that need to be configured subsequently.

      • Subscription: A prepaid billing method. You must pay for the service in advance. Longer subscription periods offer larger discounts. This method is suitable for long-term and stable business requirements. If you select this method, you must also configure Quantity, Subscription duration, and Auto-renewal.

      • Pay-as-you-go: A postpaid billing method. You are billed based on the actual usage duration. This method is suitable for flexible business requirements.

    • Cluster and application settings: Specify the region, source cluster, and AI application information.

      Parameter

      Description

      Database Engine

      Fixed to PolarDB.

      Region

      Select the region.

      Note
      • The region cannot be changed after the application is purchased.

      • The application must be deployed in the same region as thePolarDB for PostgreSQL cluster. Select the region where thePolarDB for PostgreSQL cluster is deployed.

      • We recommend that you deploy the application in the same region as the Elastic Compute Service (ECS) instance that needs to connect to it. Otherwise, they cannot communicate over the internal network (private network) and can only communicate over the Internet (public network), which cannot deliver optimal performance.

      Source PolarDB Cluster

      Select thePolarDB for PostgreSQL cluster on which you want to create the memory management application. To create a new cluster, click theCreate> link to go to the cluster creation page.

      Version

      Automatically filled with the database version of the sourcePolarDB for PostgreSQL cluster. You do not need to manually enter it.

      AI Application

      Fixed to memory management.

      Authorize SLR

      Automatically selected by the system to grant the AliyunServiceRoleForPolarDB service-linked role. You can click View Details to view the role permissions.

      Memory Engine

      • memOS:An open memory operating system based on OpenMem. It provides multi-modal memory, memory governance, a visual operation interface, and more. For more information about its capabilities, see memOS documentation.

      • mem0:A managed memory service based on the open source mem0 framework. It provides capabilities such as memory extraction, retrieval, and custom policies.

      Component set

      An AI application can contain multiple resource components. We recommend that you select at least two components to ensure high availability.

      AI Application Name

      A custom application name. The name cannot start with http:// or https://, and must be 2 to 256 characters in length.

    • Network and Zone: Specify how the application connects to a VPC.

      Parameter

      Description

      VPC

      For the VPC, we recommend that you select the VPC where thePolarDB for PostgreSQL cluster is deployed to achieve optimal network performance.

      If none of the existing VPCs meets the requirements, you can create a VPC

      Zone and vSwitch

      For the vSwitch of the VPC, we recommend that you select a vSwitch in the primary zone of thePolarDB for PostgreSQL cluster to achieve optimal network performance.

      If none of the existing vSwitches meets the requirements, you can create a vSwitch.

    • Project settings and account security: Specify the project and account information.

      Parameter

      Description

      Project name

      An independent memory management unit that corresponds to one AI application. At the database level, each project corresponds to a separate schema, which ensures data isolation.

      Database name

      Enter the name of the database corresponding to the project.

      LLM

      Select a large language model (LLM). It cannot be changed after selection.

      Graph LLM

      Select a graph large language model. It cannot be changed after selection.

      Note

      This parameter is required only when the Memory engine is mem0.

      Embedding Model

      Select a text-to-vector embedding model. It cannot be changed after selection.

      ReRank Model

      Select the model used in the memory reranking process. It cannot be changed after selection.

      Note

      This parameter is required only when the Memory engine is mem0.

      Number of Memory Shards

      Select the number of memory shards. Default value: 1.

      Note

      This parameter is required only when the Memory engine is mem0.

      Vector Dimensions

      Select the vector dimension. Default value: 1024.

      Note

      This parameter is required only when the Memory engine is mem0.

      Database Account

      Enter the privileged account of the cluster that you prepared.

      Password

      Enter the password of the privileged account.

      Security group

      Configure the security group of the application.

    • Duration and renewal settings: Configure the following parameters only when the Billing method is Subscription.

      Parameter

      Description

      Quantity

      Select the number of applications that you want to purchase.

      Note

      EachPolarDB for PostgreSQL cluster supports only one AI application of the same type.

      Duration

      Select the subscription duration of the application.

      Auto-renewal

      Specify whether to enable auto-renewal. We recommend that you enable auto-renewal to avoid service interruptions caused by forgetting to renew.

  5. After you confirm the settings, complete the purchase and return to thePolarDB Mem0 list page to view the newly created application.

    Note

    The system takes 3 to 5 minutes to create the application. Please wait. When the Status column displays Running, the memory management application is created.