Data connections provide a centralized gateway to external data sources in Alibaba Cloud Model Studio. Data connectors enable Model Studio applications to securely access, query, and reference data from enterprise databases, document systems, and object storage in real time during conversations.
Connector types
Data connectors fall into two main types based on their data storage and access methods: platform-hosted and stream processing.
|
Format |
Type |
Storage |
Scenarios |
|
Platform-hosted |
File |
Alibaba Cloud Model Studio or your own OSS |
Upload and manage unstructured documents, such as PDF, Word, and Markdown. |
|
Table |
Alibaba Cloud Model Studio or your own OSS |
Import and query structured tabular data, such as CSV and Excel. |
|
|
Stream processing |
MySQL |
Data remains in the source database for real-time access. |
Connect to a MySQL database. Execute SQL queries (supported only for data sources imported with DMS). |
|
PostgreSQL |
Data remains in the source database for real-time access. |
Connect to a PostgreSQL database. Execute SQL queries (supported only for data sources imported with DMS). |
|
|
PolarDB-X 2.0 |
Data remains in the source database for real-time access. |
Connect to an Alibaba Cloud PolarDB-X 2.0 distributed database. Execute SQL queries (supported only for data sources imported with DMS). |
|
|
Yuque |
Data remains in Yuque for real-time access. |
Access Yuque documents and knowledge bases. |
|
|
OSS |
Data remains in OSS for real-time access. |
Access files in object storage. |
Prerequisites
Before you create a data connector, ensure you meet the following prerequisites:
-
Account permissions: You must use a root user or a RAM user with permissions to manage data connectors. A root user must authorize a RAM user before they can use data connectors. For details, see Permission Management.
-
Data source preparation:
-
File/Table connector: You must have documents or spreadsheets ready for upload, or have an existing OSS Bucket.
-
MySQL connector: You must have a MySQL database instance (Alibaba Cloud RDS or self-managed). Ensure the instance is accessible via a public or private network.
-
PostgreSQL connector: You must have a PostgreSQL database instance with its
wal_levelparameter set tological. -
PolarDB-X 2.0 connector: You must have an Alibaba Cloud PolarDB-X 2.0 instance in a region that supports private network access. If you plan to import the data source using DMS, you must first register the PolarDB-X instance in DMS.
-
Yuque connector: You must have a Yuque Knowledge Base and a Personal Access Token. Only the public version of Yuque is supported.
-
OSS connector: You must have an OSS Bucket and have activated Alibaba Cloud Vector Search.
-
Create a connector
-
Go to the data connection page and click Create Connector in the upper-right corner.
-
Select a connector type, and then enter the basic information and storage location.
File connector
A file connector is used to manage unstructured documents, such as PDF and Word files.
-
On the Create Connector page, select File for the connector type.
-
Enter basic information:
-
Connector Name: Enter an easily identifiable name.
-
Description: Enter a description that specifies the data's content and purpose. This helps applications call the connector correctly.
-
-
Select a storage location:
-
Use Platform Storage: Data is stored in the storage space provided by Alibaba Cloud Model Studio. This option offers a limited-time free quota of up to 100,000 files and 1 TB of storage.
-
Use Your Own OSS Storage: Data is stored in your own OSS bucket. This option is suitable for large-scale data storage.
Note-
If you are using this option for the first time, follow the on-screen instructions to complete the authorization.
-
The target bucket must have the
bailian-connector-accesstag with the valueReadAndWriteto allow access from Alibaba Cloud Model Studio. Add tag
-
-
Table connector
A table connector is used to manage structured data, such as CSV and Excel files.
-
On the Create Connector page, select Table for the connector type.
-
Enter basic information:
-
Connector Name: Enter an easily identifiable name.
-
Description: Enter a description that specifies the data's content and purpose. This helps agents call the connector correctly.
-
-
Select storage location:
-
Use Platform Storage: Data is stored in the storage space provided by Alibaba Cloud Model Studio. This option provides a 1 TB free quota. After the quota is used up, billing automatically switches to pay-as-you-go. This option is suitable for small-scale data storage.
-
Use Your Own OSS Storage: Data is stored in your own OSS bucket. This option is suitable for large-scale data storage.
Note-
If you are using this option for the first time, follow the on-screen instructions to complete the authorization.
-
The target bucket must have the
bailian-connector-accesstag with the valueReadAndWriteto allow access from Alibaba Cloud Model Studio. Add tag
-
-
MySQL connector
The MySQL connector is a streaming processing connector. It connects to MySQL databases, allowing applications to execute SQL queries and retrieve real-time data.
NoteOnly MySQL connectors created using the import from DMS data source method support SQL query execution; those created with the create custom data source method do not.
-
On the Create Connector page, select MySQL for the connector type.
-
Enter a Connector Name and Description.
-
Configure Data Source Information:
-
Create custom data source: Manually configure the connection to an Alibaba Cloud RDS for MySQL instance or a self-managed MySQL database. You can connect over a public or private network.
-
Alibaba Cloud RDS for MySQL: Authorize access by using a Service-Linked Role (SLR) to associate the connector with a MySQL database in Alibaba Cloud RDS. After you select this option, the database address and port are automatically populated based on the instance ID.
-
Self-managed MySQL: Manually configure the connection details for a remote self-managed MySQL database. You must enter the database address and port.
-
-
Import from DMS data source: Quickly import a data source that is already configured in Data Management Service (DMS). The first time you use this option, you must complete the SLR authorization for the EventBridge, RDS, and DMS service management roles.
-
-
Select network type:
-
Public network (Default): Connect to the database over the public network. When you select this option, you must add the specified IP address range to the allowlist of your database instance.
-
Private network: Connect to the database over an internal network. You must also select the region. This option is recommended for production environments because it provides a more stable and secure connection.
-
Enter database connection information:
Parameter
Description
Database instance
Displayed only for Alibaba Cloud RDS for MySQL. Enter the RDS instance ID, for example,
rm-******adq7.Database address
For Alibaba Cloud RDS for MySQL, this parameter is automatically populated and the input is disabled. For self-managed MySQL, you must enter it manually.
Database port
For Alibaba Cloud RDS for MySQL, this parameter is automatically populated with 3306 and the input is disabled. For self-managed MySQL, you must enter it manually.
Database username
Required. Enter the username for the database connection.
Database password
Required. Enter the database password. The corresponding user must have read permissions on the database.
-
(Optional) Click Start Test to verify the database connectivity.
The system uses EventBridge to test connectivity, and the test is free of charge. After the test is successful, you can select the target database from the Select DB drop-down list.
-
PostgreSQL connector
The PostgreSQL connector supports connections to Alibaba Cloud RDS for PostgreSQL instances and self-managed PostgreSQL databases.
NoteOnly PostgreSQL connectors created using the import from DMS data source method support SQL query execution; those created with the create custom data source method do not.
Prerequisites
-
The database account must have high-level permissions (Superuser or REPLICATION permissions).
-
The instance system parameter
wal_levelmust be set tological(the default is 'replica'). -
(For self-managed instances only) You have configured the
listen_addressesparameter to allow access from the 100.64.0.0/16 CIDR block. To do this:-
Edit the configuration file:
sudo vim /etc/postgresql/[version]/main/pg_hba.conf -
Add the following rule to the top of the file:
host [database_name] [username] 100.64.0.0/16 md5 -
Reload the configuration:
sudo systemctl reload postgresql
-
-
On the Create Connector page, select PostgreSQL for the connector type.
-
Enter basic information: Enter a Connector Name and a description that specifies the data's content and purpose.
-
Configure database connection:
-
Host Address: The connection address (public or private) of the database instance.
-
Port: The default is 5432.
-
Database Name (dbName): Required. Specify the database to connect to.
-
Username: A database account with high-level permissions.
-
Password: The database password.
-
-
Click Test Connectivity to ensure the configuration is correct. The PostgreSQL connector uses Data Transmission Service (DTS) to test connectivity.
Comparison between MySQL and PostgreSQL connectors:
Difference
MySQL
PostgreSQL
Default port
3306
5432
Additional required fields
None
Requires dbName (database name)
Connectivity test service
EventBridge
Data Transmission Service (DTS)
Special configuration requirements
None
Requires setting the instance system parameter
wal_leveltologicalPolarDB-X 2.0 connector
The PolarDB-X 2.0 connector is a streaming processing connector. It connects to an Alibaba Cloud PolarDB-X 2.0 distributed database, allowing applications to execute SQL queries and retrieve real-time data.
NoteOnly PolarDB-X 2.0 connectors created using the import from DMS data source method support SQL query execution; those created with the create custom data source method do not.
-
On the Create Connector page, select PolarDB-X 2.0 for the connector type.
-
Enter a Connector Name and Description.
-
Configure Data Source Information:
-
Create custom data source: Authorize access using a Service-Linked Role (SLR) to associate the connector with an Alibaba Cloud PolarDB-X 2.0 database. The database address and port are automatically populated based on the selected instance and cannot be manually entered.
The first time you use this option, you must authorize two Service-Linked Roles in the pop-up window: the DTS service management role (
AliyunServiceRoleForSFMConnectorAccessDTS) and the PolarDB-X service management role (AliyunServiceRoleForSFMAccessPolarDBX). -
Import from DMS data source: Quickly import a PolarDB-X data source that is already configured in Data Management Service (DMS). The first time you use this option, you must complete the SLR authorizations for the DMS, DTS, and PolarDB-X service management roles.
-
-
Select network type: Only private network is supported. You must select a region to connect to the PolarDB-X instance over an internal network. This option is suitable for production environments.
-
Enter database connection information:
Parameter
Description
Database instance
Displayed only for the create custom data source method. From the drop-down list, select a PolarDB-X 2.0 instance under the current account in the selected region.
Select Data Source
Displayed only for the import from DMS data source method. From the list of DMS data sources, select one PolarDB-X data source. DMS ensures the connectivity of the data source.
Database address
This field is automatically populated based on the selected instance and input is disabled when using the create custom data source method. When using the import from DMS data source method, you must manually enter or confirm the address.
Database port
This field is automatically populated based on the selected instance and input is disabled when using the create custom data source method. When using the import from DMS data source method, you must manually enter or confirm the port.
Database username
Required. Enter the username for the database connection.
Database password
Required. Enter the database password. The corresponding user must have read permissions on the database.
-
(Optional) Click Start Test to verify the database connectivity. After the test is successful, you can select the target database from the Select DB drop-down list.
Key differences from the MySQL connector:
-
Network type: Only private network connections are supported.
-
Data source: Supports only Alibaba Cloud PolarDB-X 2.0 instances, not self-managed databases.
-
SLR Authorization: The first time you use this connector, you must explicitly authorize the DTS and PolarDB-X service management roles (and the DMS role if using the DMS method) in the pop-up window.
Yuque connector
Use the Yuque connector to access Yuque documents and knowledge bases, allowing agents to retrieve and cite enterprise knowledge stored in Yuque.
Only the public version of Yuque is supported.
-
On the Create Connector page, select Yuque for the connector type.
-
Enter a Connector Name and Description.
-
Go to the Yuque Open API to obtain a Tenant access token and enter it in the connection information section.
-
Click Test Connection to validate the token. This button is enabled after you enter a token.
OSS connector
Use the OSS connector to access files in Object Storage Service (OSS), allowing applications to read and process various types of files stored in OSS.
-
On the Create Connector page, select OSS for the connector type.
-
Enter a Connector Name and Description.
-
From the Storage Bucket Selection drop-down list, select the OSS bucket to connect to.
Note-
If you are using this option for the first time, follow the on-screen instructions to complete the authorization.
-
The target bucket must have the
bailian-datahub-accesstag with the valuereadto allow access from Alibaba Cloud Model Studio. Add tag -
If no buckets are displayed in the drop-down list, ensure that you have created an OSS bucket and that the current account has access to it.
-
To use the OSS connector, you must activate the vector retrieval service. If the service is not activated, the tool returns an error.
Buckets that use the Archive, Cold Archive, or Deep Cold Archive storage classes are not supported.
Encrypted buckets and private buckets are supported.
If you need to use a bucket with Referer hotlink protection enabled, you must add the domain
*.console.aliyun.comto the Referer allowlist. For more information, see Hotlink Protection. -
-
Click Confirm to create the connector.
Import data
Import files
Click Details on the file connector card to open the file management page.
-
In the Category pane on the left, select an existing category or click the
icon to create a new one.Alibaba Cloud Model Studio manages imported files by category.
NoteEach workspace supports a maximum of 500 categories. To request a higher category limit, submit a ticket.
-
Click Import Data to open the Import Data page. For the import method, select Upload Local File.
The platform does not support importing JSON, CSV, or YAML files directly. Convert them to XLSX or XLS format before importing.
-
For Parsing Method, select Default Settings or Custom Settings. (Custom Settings lets you configure parsing rules for different formats to improve parsing results).
-
(Optional) Configure Tags for the file.
When you call an application by using an API, you can specify tags in the
tagsrequest parameter. When searching the knowledge base, the application first filters relevant files based on the tags to improve retrieval efficiency. For an agent application, you can set tags in the console when you debug the knowledge base. -
Click Confirm. The system starts parsing and importing the file. You can track the task progress on the page.
The file will be converted into a format that Alibaba Cloud Model Studio can process. Processing may take several hours during peak times. Please be patient.
-
After the import is complete, click Details next to the file to view it.
Once imported into Alibaba Cloud Model Studio, files are stored as independent copies, unlinked from the original data, in the free storage space provided by the platform. This space currently has no capacity limit.
You can only view files imported within the last 90 days. Files older than this period cannot be viewed, but they will not be deleted.
Imported files can be used only by users in the current workspace. Alibaba Cloud Bailian will not use the files for any commercial purposes or disclose them publicly.
Import tables
Click Details on the table connector card to open the data management page.
Under data table management on the left, select an existing data table or click the
icon to create a new one.
Alibaba Cloud Model Studio uses data tables to manage imported data.
New data table
-
Enter a Table Name. Then, configure the data table by selecting either Upload excel directly or Custom Header.
-
Upload excel directly: Alibaba Cloud Model Studio automatically detects the table header in your uploaded file to create the data table structure. Alibaba Cloud Model Studio then imports the remaining content as data records.
-
Custom table header: The Column Name and Type parameters are required, while the Description parameter is optional.
Important-
The structure of a data table, including its column names, description, and type, cannot be modified after creation.
-
The structure of the uploaded file must exactly match the structure of the target data table, including the number of columns and column names, or the import will fail. For example, if the target data table has two columns, you must configure two fields with matching column names. You can add or remove fields by clicking Add field or Delete in the Actions column.
-
To help the model understand the meaning of each field (for example, that
ageindicates age), provide a clear natural language description in the Description field. -
If a field type is set to
image_url, ensure the link is a publicly accessible image URL. The knowledge base uses this link to fetch the image and generate a vector index for it, to support scenarios such as image search.Example
image_urlformat: https://example.com/downloads/pic.jpgWhen you create a knowledge base, fields of the
image_urltype are used to generate an image index. Alibaba Cloud Model Studio accesses the target image, extracts its features, and then converts them into a vector using image embedding and stores it. When a user searches the knowledge base, this vector is compared with the vector of their uploaded image to determine similarity.
-
-
-
Click the
icon to select and upload a file in XLSX or XLS format.The file must contain a table header, or the import will fail.
The platform does not currently support the direct import of JSON, CSV, or YAML files. Please use an appropriate tool to convert them to XLSX or XLS format before importing.
-
Click OK to begin the import. After the import is complete, the new data table appears in the Table navigation tree on the left.
Existing data table
-
In the Table list on the left, select the target data table, and then click Import Data.
-
For the import type, select either Upload and Overwrite or Incremental Upload.
Click Download Template to obtain a blank file that contains only the table header. You can add new data directly to this file and then use it for an overwrite or incremental upload.
-
Click the
icon to select and upload a file in XLSX or XLS format.The file must contain a table header, and its structure must match that of the current data table, or the import will fail.
The platform does not support importing JSON, CSV, or YAML files directly. Please convert them to XLSX or XLS format using a suitable tool before importing.
Import files from OSS
-
OSS connector: Click Details on the connector card to open the Tools tab. Use this tab to search for and retrieve download links for specific files in OSS. To use these tools, you must activate the vector retrieval service.
-
file connector or table connector: Click Details on the card to open the file or table management page.
-
In the Category pane on the left, select an existing category or click the
icon to create a new one.Model Studio (Bailian) uses categories to manage imported files.
NoteEach workspace supports a maximum of 500 categories. To request a higher category limit, submit a ticket.
-
Click Import Data to open the Import Data page. For Import Method, select OSS.
When you import data from OSS into Model Studio (Bailian) for the first time, you must follow the on-screen instructions to grant the required permissions. Also, add the
bailian-datahub-accesstag to the target bucket to grant access to Model Studio (Bailian).Buckets that use the Archive, Cold Archive, or Deep Cold Archive storage classes are not supported.
Model Studio (Bailian) cannot access files in the root directory of a bucket. Select an existing subdirectory or create a new one for Model Studio (Bailian) to access.
Encrypted and private buckets are supported.
If you use a bucket with Referer-based hotlink protection enabled, you must add the
*.console.aliyun.comdomain to the Referer allowlist. For more information, see Hotlink Protection. -
For Parsing Method, select Default Settings or Custom Settings. With Custom Settings, you can configure parsing rules for different formats to improve parsing performance.
-
(Optional) Configure Tags for the file.
When you call an application by using the API, you can specify tags in the
tagsrequest parameter. The application then filters files by these tags during knowledge base searches, improving retrieval efficiency. For an agent application, you can set tags when you edit the application in the console (by enabling ). -
Click Confirm. The system begins to parse and import the files. You can monitor the progress on the page.
The files are converted into a format that Model Studio (Bailian) can process. This process might take several hours during peak times, so please be patient.
-
After the import is complete, click Details next to a file to view its contents.
After a file is imported, Model Studio (Bailian) stores it as a standalone copy unlinked from the original data. The platform saves this copy in free storage space, which currently has no capacity limit.
Imported files are accessible only to users within the current workspace. Model Studio (Bailian) does not use your data for any commercial purposes or make it publicly available.
-
Import RDS MySQL data
-
Before you create a data source, you must enable the EventBridge service.
-
Model Studio (Bailian) and the RDS instance must belong to the same Alibaba Cloud account. Otherwise, follow the steps in Import data from a self-managed MySQL database.
-
When importing a large table (over 1,000,000 rows), the process may take longer than the database's log retention period. This can lead to duplicate data imports. Learn how to resolve this.
RDS instance limitations: Only the MySQL engine is supported, with no version restrictions. Other engines, such as PostgreSQL, are not supported. The instance can be in any region. Only basic edition and high-availability edition instances are supported. When you create an RDS instance, set the network type to VPC and select Yes for the whitelist option to add the VPC network segment to the instance's whitelist.
Database and table limitations: A knowledge base can be associated with only a single table in a database; multi-table joins are not supported. The associated table can contain a maximum of 10,000,000 rows, and each row cannot exceed 100 KB. Data in rows exceeding this size limit will be truncated.
For Network Type, select Public Network or Private Network.
Private network data sources are supported only for RDS instances in specific regions. For other regions, select a public network data source. Private network data sources offer better security and performance.
Public network
-
To allow your knowledge base to receive data from the RDS instance, add the EventBridge public IP addresses to the instance's whitelist.
If the whitelist is not configured correctly, a
Communications link failureerror is displayed when you create the data source. -
Configure the following parameters for the data source:
Parameter
Description
Data Source Name
The data source name must be unique within a workspace. This name cannot be reused, even if the data source creation fails.
Database Instance
Enter the ID of the RDS instance. To find the ID, go to the RDS console and click Instance List in the navigation pane on the left.
Database Endpoint
Enter the public endpoint of the RDS instance. You can obtain this information from the Database Connection page of the RDS instance: Go to the RDS console, click Instances in the left navigation bar, and then click the RDS instance that contains the data table. Then, click Database Connection in the left navigation bar to view the public endpoint for the instance.
If a public endpoint is not enabled for the RDS instance, follow the on-screen instructions to enable it.
For high-availability edition RDS instances, do not use the proxy endpoint or internal endpoint from the database proxy connection section.
Database Port
Enter the public port for the RDS instance. This information is also available on the Database Connection page.
Database Username
The database account must be a privileged account. For information on account requirements and creation instructions, see Create an account.
If you use a standard account, a
There is no permission:RELOADerror occurs during creation. -
Click Create Data Source. The system will then automatically configure the RDS data source. During this time, the workspace is locked, and you cannot create other data sources simultaneously.
When you submit the task for the first time, you may be prompted to authorize the EventBridge service-linked role. A root account must perform this action. If you need to use a RAM user, the root account must first grant the necessary permissions to the RAM user.
Creating a data source may take several minutes during peak hours.
Status
Description
Creation Successful
The data source was created successfully. Select the data source and proceed to the next step.
Creation Failed
The data source creation failed. Verify your parameters, correct them if necessary, and then click Retry. You can also click Delete to remove the failed data source.
Private network
-
Configure the following parameters for the data source:
Parameter
Description
Data Source Name
The data source name must be unique within a workspace. This name cannot be reused, even if the data source creation fails.
Region
Select the region where the RDS instance is located. To find this, go to the RDS console and click Instance List in the navigation pane on the left.
Database Instance
Enter the ID of the RDS instance. To find the ID, go to the RDS console and click Instance List in the navigation pane on the left.
Database Endpoint
Enter the internal endpoint of the RDS instance. You can obtain this information from the Database Connection page of the RDS instance: Go to the RDS console, click Instance List in the left navigation bar, and then click the RDS instance that contains the data table. Next, click Database Connection in the left navigation pane to view the internal endpoint for the instance.
For high-availability edition RDS instances, do not use the proxy endpoint or internal endpoint from the database proxy connection section.
Database Port
Enter the internal port for the RDS instance. This information is also available on the Database Connection page.
Database Username
The database account must be a privileged account. For information on account requirements and creation instructions, see Create an account.
If you use a standard account, a
There is no permission:RELOADerror occurs during creation. -
Run a connectivity test: Click Start Test to verify the connection between Model Studio (Bailian) and your data source.
When you run the test for the first time, you may be prompted to authorize the EventBridge service-linked role. A root account must perform this action. If you need to use a RAM user, the root account must first grant the necessary permissions to the RAM user.
VPC ID
Enter the VPC ID of the RDS instance. You can find this on the Database Connection page of the instance.
The VPC ID is displayed in the Network Type section of that page.
VSwitch ID
Hover over the VPC ID on the Database Connection page to view the VSwitch ID.
RDS for MySQL high-availability edition instances may have multiple VSwitch IDs. Ensure that you enter all VSwitch IDs associated with the instance.
In the RDS console, select Database Connection from the navigation pane on the left. In the Network Type information area, hover over the VPC ID to view the associated VSwitch ID.
Security Group ID
You can select the Use Managed Security Group option. If you use a custom security group, it must be one you created. Do not use a security group created by another service. You can create a security group in the ECS console on the Security Group page. The security group must meet the following requirements:
-
Its region must match the Region selected above.
-
When creating the security group, select the VPC where the RDS instance is located from the Network dropdown list.
-
Both basic and enterprise security groups are supported.
-
The security group must have no inbound rules.
-
Correct configuration:
On the security group details page, the Security Group ID starts with
sg(some information is redacted). The Intra-group Communication Policy is set to Allow, and the Security Group Type is Basic. In the Access Rules section, the Inbound tab shows no rules (0 entries). -
Incorrect configuration: The security group's inbound rules are configured with five allow rules (all with priority 1): All ICMP (IPv4) (port range -1/-1), custom TCP port RDP (3389), custom TCP port SSH (22), custom TCP port HTTPS (443), and custom TCP port HTTP (80), all with a source of
0.0.0.0/0. While this configuration allows inbound traffic from any IP address, it only opens specific ports.
-
-
-
After the connectivity test passes, click Confirm. The system will then automatically configure the RDS data source. During this time, the workspace is locked, and you cannot create other data sources simultaneously.
Creating a data source may take several minutes during peak hours.
Status
Description
Created
The data source was created successfully. Select the data source and proceed to the next step.
Creation Failed
The data source creation failed. Verify your parameters, correct them if necessary, and then click Retry. You can also click Delete to remove the failed data source.
Import self-hosted MySQL data
-
Before you create a data source, you must activate the EventBridge service.
-
When you import a large table with over 1,000,000 rows, the import process might take longer than the log retention period of your database. This can cause duplicate data imports. Learn how to resolve this.
Self-hosted MySQL limitations: The database must be deployed on an Alibaba Cloud ECS instance in any region. Only MySQL versions 5.6, 5.7, and 8.0 are supported. MySQL Proxy is not supported.
Database and table limitations: A knowledge base can only be associated with a single table in a single database; multi-table joins are not supported. The associated table can contain a maximum of 10,000,000 rows, and each row must be smaller than 100 KB. Data exceeding this size limit will be truncated. If this row limit does not meet your business requirements, you can submit a ticket to request an adjustment.
For Network Type, select Public Network or Private Network.
Private network data sources are only supported for ECS instances in specific regions. For other regions, select a public network data source. Private network data sources provide better security and performance.
Public network
-
To ensure that the knowledge base can receive data, configure an EventBridge allowlist for your self-hosted MySQL database.
If the allowlist is not configured correctly, you will receive a
Communications link failureerror when you create a data source. -
Fill in the data source configuration details:
Parameter
Description
Data source name
The data source name must be unique within a workspace. This name cannot be reused, even if the data source creation fails.
Database host
Enter the public endpoint of your self-hosted MySQL database.
Database Port
Enter the port of your self-hosted MySQL database.
Database Username
Enter the database username that you granted privileges to in the previous step.
-
Click Create Data Source to submit the creation task. The system automatically configures the self-hosted MySQL data source. During this process, the current workspace is locked, and you cannot create other data sources simultaneously.
When you submit the task for the first time, follow the on-screen instructions to authorize the EventBridge service-linked role. Only a primary account can perform this action. To use a RAM user, the primary account must first grant the necessary permissions to that user.
Creating a data source can take several minutes during peak hours. Please wait for the process to complete.
Status
Description
Created
The data source was created successfully. Select the data source and proceed to the next step.
Failed
The data source creation failed. Verify that all parameters are correct, make the necessary changes, and click Retry. You can also click Delete to remove the failed data source.
Private network
-
To ensure that the knowledge base can receive data, configure the required user permissions and settings on your self-hosted MySQL database.
If the allowlist is not configured correctly, you will receive a
Communications link failureerror when you create a data source. -
Fill in the data source configuration details:
Parameter
Description
Data source name
The data source name must be unique within a workspace. This name cannot be reused, even if the data source creation fails.
Region
Select the region where the ECS instance for your self-hosted MySQL database is deployed. You can find this information on the ECS console.
Database Endpoint
Enter the Private Address of your self-hosted MySQL database. You can find this on the Instances page on the ECS console. To view this page, go to the ECS console and choose Instances from the left-side navigation pane. The Private Address is listed for each instance.
Database Port
Enter the port of your self-hosted MySQL database.
Database Username
Enter the database username that you granted privileges to in the previous step.
-
Connectivity test: Click Start Test to check the network connectivity between Model Studio and your data source.
When you submit the task for the first time, follow the on-screen instructions to authorize the EventBridge service-linked role. Only a primary account can perform this action. To use a RAM user, the primary account must first grant the necessary permissions to that user.
VPC ID
Enter the Instance ID (for example, vpc-xxxxxx) of the VPC where your self-hosted MySQL ECS instance is deployed. You can find this information on the ECS console.
In the left-side navigation pane, choose Instances & Images > Instances. Find the target instance in the list. The corresponding VPC ID and VSwitch ID are shown in the VPC column.
VSwitch ID
The VSwitch ID (for example, vsw-xxxxxx) is displayed below the instance's VPC ID.
Security Group ID
You can use a managed security group. If you use a custom security group, it must be created directly by you, not indirectly by a third-party product or service. You can create a security group on the Security Group page of the ECS console. The security group must meet the following requirements:
-
The region of the security group must match the Region selected above.
-
The security group must be in the same VPC as the ECS instance.
-
Both basic and enterprise security groups are supported.
-
The inbound rules must not have any access restrictions.
-
-
After the connectivity test passes, click Create Data Source to submit the creation task. The system automatically configures the MySQL data source. During this process, the current workspace is locked, and you cannot create other data sources simultaneously.
Creating a data source can take several minutes during peak hours. Please wait for the process to complete.
Status
Description
Created
The data source was created successfully. Select the data source and proceed to the next step.
Failed
The data source creation failed. Verify that all parameters are correct, make the necessary changes, and click Retry. You can also click Delete to remove the failed data source.
Import data from self-hosted PostgreSQL
Before you create a data source, you must activate Data Transmission Service (DTS).
Self-hosted PostgreSQL limitations:
Your database must be deployed on an Alibaba Cloud ECS instance in any region.
Database and table limitations:
A knowledge base connects to only one table in a single database. Joins across multiple tables are not supported. The associated table can contain up to 10,000,000 rows, with each row smaller than 100 KB. Data exceeding this limit is truncated. If this row limit is insufficient for your business needs, you can submit a ticket to request an adjustment.
For the network type, select Private Network.
Only ECS instances in select regions are supported. A private network data source offers better security and performance.
Connector details
On the connector list page, click the Details button for a connector to view its details page. The details page contains the following tabs:
-
Overview: Shows basic information about the connector, such as its name, description, type, creation time, and storage quota, and lists its auto-generated tools.
-
Files/Tables (platform-hosted type only): Manage the files or table data within the connector.
-
Tools: View the details of the connector's auto-generated tools, including parameter descriptions and online testing.
On the connector details page, you can expand a tool, fill in the parameters, and click the Run button to test the tool's response online.
Data synchronization rules
On the Files tab of a file-type data connector, click Sync Data Rules > Create Sync Rule in the upper-right corner to open the rule creation page.
-
Select a Category for the data synchronization.
-
Select a Sync Source:
OSS
Model Studio uses a service-linked role (SLR) to automatically synchronize data from OSS by accessing your buckets.
Important-
OSS synchronization uses a service-linked role (SLR) to access user buckets, eliminating the need to configure an AccessKey. Before first use, you must initialize the service-linked role and complete the authorization as prompted.
-
The object path must include the bucket name, for example,
my-bucket/docs/ormy-bucket/docs/foo.md. -
The current account must have read permissions for the target bucket. To grant access to Model Studio, you must also add the
bailian-datahub-accesstag with the valuereadto the target bucket. For more information, see Manage bucket tags.
Fill in the following OSS object information:
Parameter
Required
Description
OSS region
Yes
Select the region where the OSS bucket is located. For a list of supported regions, see OSS Regions Overview.
OSS object path
Yes
Enter the path of the OSS object to synchronize. The path must include the bucket name. For example,
my-bucket/docs/synchronizes all files in the directory, whilemy-bucket/docs/foo.mdsynchronizes a single file.Synchronization period
Yes
Select the frequency for automatic data synchronization, for example, every minute.
Connection test
Yes
Click Connection Test to verify that the configured OSS path is accessible. You can submit the rule only after the test passes.
Data tags
No
Configure tags for the synchronized data to help categorize it. Each tag can be up to 32 characters long and can contain Chinese characters, uppercase and lowercase letters, numbers, underscores (_), and hyphens (-). Press Enter after typing to add a tag.
Lark
Access Lark knowledge bases and documents through Lark application credentials to synchronize content to the Bailian platform. For instructions on creating a Lark custom app, see Lark custom app development process.
Important-
Before synchronizing Lark documents, you must create a custom app on the Lark Open Platform and obtain the App ID and App Secret.
-
You must enable read-only permissions for knowledge base, cloud document, and spreadsheet features, as well as the contact user ID read permission for the app.
-
You must fill in one of the following: Lark Knowledge Base ID, Lark Folder ID, or Lark Document ID.
-
Synchronization is supported for documents (doc), spreadsheets (xls), bitable, PPT, and other nodes in Lark knowledge bases. It is not supported for locally uploaded files.
Fill in the following Lark document information:
Parameter
Required
Description
Lark App ID
Yes
The App ID of your Lark custom app. View instructions.
Lark App Secret
Yes
The App Secret of your Lark custom app. Obtain it from the Credentials and Basic Information page on the Lark Open Platform.
Lark Knowledge Base ID
One of three
You must fill in one of the following: Lark Knowledge Base ID, Lark Folder ID, or Lark Document ID. Obtain it from the Lark knowledge base URL.
Lark Folder ID
One of three
You must fill in one of the following: Lark Knowledge Base ID, Lark Folder ID, or Lark Document ID. Obtain it from the Lark folder URL.
Lark Document ID
One of three
You must fill in one of the following: Lark Knowledge Base ID, Lark Folder ID, or Lark Document ID. Obtain it from the Lark document URL.
Exclude Document IDs
No
A list of Lark document IDs that you do not want to synchronize.
Lark Document Domain
No
If your document domain is xxx.feishu.cn/wiki/..., enter xxx. This is used to populate the document source URL during upload.
Sync Period
Yes
Select the frequency for automatic data synchronization. Options: 1 minute, 1 hour (default), and 1 day.
Connection Test
Yes
Click Connection Test to verify that the Lark application credentials and knowledge base access are working properly. You can submit the rule only after the test passes.
Data Tags
No
Configure tags for the synchronized data for easier categorization. Each tag can be up to 32 characters and supports Chinese, English letters (upper and lower case), numbers, underscores (_), and hyphens (-). Press Enter to confirm after typing.
After filling in the form, click Connection Test to verify connectivity. Once the test passes, configure data tags.
Important-
You must set export permissions for Lark.
-
Lark does not support exporting MindNote documents.
DingTalk
To create a DingTalk document synchronization rule, obtain the necessary credentials by following these steps.
After completing the preceding steps, fill in the DingTalk Document Information:
Parameter
Required
Description
DingTalk user ID
Yes
Obtain this from Contacts > Member Management in the DingTalk Admin Console.
DingTalk application ID
Yes
Obtain this from the app management page on the DingTalk Open Platform.
DingTalk application secret
Yes
Obtain this from the app management page on the DingTalk Open Platform.
DingTalk knowledge base ID
One of three
You must enter one of the following: DingTalk Knowledge Base ID, DingTalk Folder ID, or DingTalk Document ID.
DingTalk folder ID
One of three
You must enter one of the following: DingTalk Knowledge Base ID, DingTalk Folder ID, or DingTalk Document ID.
DingTalk document ID
One of three
You must enter one of the following: DingTalk Knowledge Base ID, DingTalk Folder ID, or DingTalk Document ID.
DingTalk Docs MCP link
Conditionally required
This value is required if you need to synchronize DingTalk documents.
DingTalk Sheets MCP link
Conditionally required
This value is required if you need to synchronize DingTalk spreadsheets.
Synchronization period
Yes
Select the frequency for automatic data synchronization.
After filling in the information, click Connection Test to verify connectivity. After the test passes, configure the data tags.
Important-
DingTalk document synchronization consumes DingTalk development resources. View DingTalk development resource consumption and expansion options.
-
Synchronization is supported for DingTalk documents, spreadsheets, and AI sheets created in a DingTalk knowledge base. It is not supported for documents and spreadsheets uploaded from local files.
DingTalk API call consumption
Each synchronization consumes the API quota of the DingTalk Open Platform. We recommend that you assess your API quota in advance to ensure it is sufficient. Consumption occurs in two phases: pre-synchronization check and synchronization execution.
Pre-synchronization check (checks connectivity, permissions, and resource existence when a task starts):
-
Account authentication: 1 call.
-
Batch document check: 1 call for every 30 documents (rounded up), plus 1 additional call.
-
AI sheet existence check: 1 call per AI sheet.
-
Knowledge base existence check: 1 call per knowledge base.
Synchronization execution (pulls content into Model Studio):
-
Account authentication: 1 call.
-
Knowledge base content retrieval: 1 call per knowledge base.
-
AI sheet content retrieval: (Number of sheets + Number of unidirectional/bidirectional linked fields) calls per AI sheet.
Example
To synchronize 1 knowledge base (containing 50 documents) and 2 AI sheets (each with 3 sheets and 2 linked fields), the total API calls are calculated as follows:
-
Pre-synchronization check: 1 + (ceiling(50/30) + 1) + 2 + 1 = 7 calls.
-
Synchronization execution: 1 + 1 + 2 * (3 + 2) = 12 calls.
-
Total: approximately 19 calls.
NoteThis is a typical estimate. The actual consumption may fluctuate slightly due to factors such as API retries and error rollbacks.
Yuque Sync
Access Yuque documents and knowledge bases through a Yuque Token to synchronize content to the Bailian platform.
Fill in the following Yuque document information:
Parameter
Required
Description
Yuque Document/Knowledge Base URL
Yes
A list of complete Yuque document or knowledge base URLs. Separate multiple URLs with commas (
,). Example:https://www.yuque.com/xionghuyi/xr0xqi,https://www.yuque.com/xionghuyi/xr0aax.Yuque Token
Yes
A Yuque access token. Both personal tokens and team tokens are supported. See the instructions above for how to obtain a token.
Document Permission Level
No
The permission levels of Yuque documents to synchronize. Multiple values are supported.
0: Private,1: Public,2: Public within the organization. Example: to sync private and organization-public documents, enter0,2. Default:0,1,2(this setting does not apply when the URL list specifies a specific document).Sync Period
Yes
Select the frequency for automatic data synchronization. Options: 1 minute, 1 hour (default), and 1 day.
Connection Test
Yes
Click Connection Test to verify that the Yuque Token and URLs are accessible. You can submit the rule only after the test passes.
Data Tags
No
Configure tags for the synchronized data for easier categorization. Each tag can be up to 32 characters and supports Chinese, English letters (upper and lower case), numbers, underscores (_), and hyphens (-). Press Enter to confirm after typing.
After filling in the form, click Connection Test to verify connectivity. Once the test passes, configure data tags.
-
-
Configure the data tags, and then click Confirm to complete the creation.
After creation, the rule is displayed on the synchronization rule list page, where you can Enable or Disable it in the Actions column.
File connector tools
Creating a file connector automatically generates the following two tools:
|
Tool name |
Description |
Parameters |
|
|
Searches for files by title keywords and returns their download links. |
|
|
|
Retrieves a file by using its ID and returns its download link. |
|
Manage connectors
-
Edit: Click a connector's card to open its details page. Click the Edit button in the upper-right corner to modify the connector's name and description. You cannot change the connector type or storage method after creation.
-
Copy: On the connector list page or its details page, click the Copy button to create a new connector with the same configuration.
-
Delete: On the connector list page, click the More icon (
···) on the target connector card and select Delete, or click the Delete button on the connector details page.ImportantDeletion requires confirmation. You cannot undo this action.
Once a knowledge base is created, you cannot change its associated data connector. The Data source field on the knowledge base edit page is read-only. To use a different data connector, you must re-create the knowledge base.
Use a data connector in an agent
After you create a connector, add its tools to your agent. The agent can then automatically call these tools in conversations to query external data.
-
On the agent configuration page, click Skills in the left pane and find the Data Connector section.
-
Click the + button in the Data Connector section. In the Select Data Connector dialog box:
-
Browse or search for the target connector. You can filter by connector type.
-
Click Add next to the target connector.
-
-
Once added, the connector's tools automatically appear in the configuration list. You can click the settings button next to a tool to adjust its parameters.
-
Publish the agent so it can automatically call these tools in conversations.
Use a data connector in a workflow
After you create a connector, you can add a data connector node to your workflow. This allows the workflow to call connector tools to query external data and pass the results to downstream nodes.
-
On the workflow canvas configuration page, expand the node library on the left. Under the tools category, find the data connector node and drag it onto the canvas.
-
In the Select data connector dialog box:
-
Browse or search for the target connector. You can filter by connector type, such as File, Table, MySQL, PostgreSQL, Yuque, or OSS.
-
Expand the connector, select the tool you want to use (such as searchFile or getFile), and then click OK.
-
-
Configure node input: In the Input section of the node configuration panel, configure the tool's input parameters. Map outputs from upstream nodes or built-in variables to the required parameters, such as fileId.
-
Connect nodes: Connect the data connector node to upstream and downstream nodes to ensure the correct data flow.
-
The node's output is a result object with two fields: content (Array<Object>, the returned content) and isError (Boolean, indicates whether an error occurred). Downstream nodes can reference this output.
Each data connector node in a workflow can use only one tool. If you need to use multiple tools from the same connector, add multiple data connector nodes.
References
To create a knowledge base and import content from a data source for retrieval, see Create and use a knowledge base.
For guidance on configuring and using applications, see Introduction to application types.