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 Item | Knowledge Base | Database |
---|---|---|
Data Type | docx/pdf/ppt/markdown | Table/json |
Data Update Frequency | Low Frequency | High Frequency |
Data Maintainer | Developers | Developers + End Users |
Typical Applications | Intelligent Customer Service, Q&A Systems, Expert Decision-Making | User Behavior Analysis, Data Query |
How to Configure a Data Model
In the Cloud Development Platform cloud database module, you can create new data models.
- Create a new data model, select cloud database (document-based)
- 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.
How AI Agent Binds Data Models
In the Cloud Development Platform's AI+ module, locate the Agent where you can bind data models.
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.
Conversation Effect
Query All Books
This will trigger a query on the book information table.
Query Borrowed Books
This will trigger a query on the book information table and the borrowing record table.
Query Freshmen's Favorite Books
This will trigger a query on the user information table, borrowing record table, and book information table.