Skip to main content

Database

When to Use a Database

Developers already have mini-programs/web applications where users generate data via mini-programs/web. You want the ai to understand this data and become a personalized intelligent agent, so that for the same question, each user can receive an answer relevant to their own data.

Comparison between Database and Knowledge Base

Comparison ItemKnowledge BaseDatabase
Data Typedocx/pdf/ppt/markdownTable/json
Data Update FrequencyLow FrequencyHigh Frequency
Data MaintainerDevelopersDevelopers + End Users
Typical ApplicationsIntelligent Customer Service, Q&A Systems, Expert Decision-MakingUser Behavior Analysis, Data Query

How to Configure a Data Model

In the Cloud Development Platform cloud database module, you can create new data models.

  1. Create a new data model, select cloud database (document-based) Create Data Model
  2. Both model names and field names should be described in Chinese to facilitate the large language model's understanding of the relationship between user questions and the data model. Configuring the Data Model

How AI Agent Binds Data Models

In the Cloud Development Platform's AI+ module, locate the Agent where you can bind data models. agent Binding Data Model

How to Talk to an agent

Simply use natural language to converse with the agent. If the question contains database-related information, it will trigger a database query.

Library agent Example

Suppose we want to create a library AI assistant that can help students quickly query whether the library has specific books, rapidly search which books they have borrowed, and analyze their favorite book genres.

Data Model

There should be 3 data models: user information table, book information table, borrowing record table.

  • The permissions for the User Information Table are readable by everyone, but only the creator and administrators have read-write access. It must include at least the following fields: ID, User Name, User Grade.
  • The permissions for the Book Information Table are readable by everyone, but only administrators have write access. It must include at least the following fields: ID, Book Title, Book Author.
  • The permissions for the Borrowing Record Table are readable and writable only by the creator and administrators. It must include at least the following fields: Book ID, Borrower ID, Borrowing Time.

Book Information Table User Table Borrowing Record Table

Conversation Effect

Query All Books

This will trigger a query on the book information table.

Matching a Table

Query Borrowed Books

This will trigger a query on the book information table and the borrowing record table.

Matching Two Tables

Query Freshmen's Favorite Books

This will trigger a query on the user information table, borrowing record table, and book information table.

Matching Three Tables