Data Connection

更新时间:
复制 MD 格式

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_level parameter set to logical.

    • 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

  1. Go to the data connection page and click Create Connector in the upper-right corner.

  2. 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.

    1. On the Create Connector page, select File for the connector type.

    2. Enter basic information:

      1. Connector Name: Enter an easily identifiable name.

      2. Description: Enter a description that specifies the data's content and purpose. This helps applications call the connector correctly.

    3. 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-access tag with the value ReadAndWrite to 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.

    1. On the Create Connector page, select Table for the connector type.

    2. Enter basic information:

      1. Connector Name: Enter an easily identifiable name.

      2. Description: Enter a description that specifies the data's content and purpose. This helps agents call the connector correctly.

    3. 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-access tag with the value ReadAndWrite to 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.

    Note

    Only 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.

    1. On the Create Connector page, select MySQL for the connector type.

    2. Enter a Connector Name and Description.

    3. 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.

    4. 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.

    Note

    Only 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_level must be set to logical (the default is 'replica').

    • (For self-managed instances only) You have configured the listen_addresses parameter to allow access from the 100.64.0.0/16 CIDR block. To do this:

      1. Edit the configuration file: sudo vim /etc/postgresql/[version]/main/pg_hba.conf

      2. Add the following rule to the top of the file: host [database_name] [username] 100.64.0.0/16 md5

      3. Reload the configuration: sudo systemctl reload postgresql

    1. On the Create Connector page, select PostgreSQL for the connector type.

    2. Enter basic information: Enter a Connector Name and a description that specifies the data's content and purpose.

    3. 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.

    4. 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_level to logical

    PolarDB-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.

    Note

    Only 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.

    1. On the Create Connector page, select PolarDB-X 2.0 for the connector type.

    2. Enter a Connector Name and Description.

    3. 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.

    4. 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.

    5. 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.

    6. (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.
    1. On the Create Connector page, select Yuque for the connector type.

    2. Enter a Connector Name and Description.

    3. Go to the Yuque Open API to obtain a Tenant access token and enter it in the connection information section.

    4. 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.

    1. On the Create Connector page, select OSS for the connector type.

    2. Enter a Connector Name and Description.

    3. 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-access tag with the value read to 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.com to the Referer allowlist. For more information, see Hotlink Protection.
  3. Click Confirm to create the connector.

Import data

Import files

Click Details on the file connector card to open the file management page.

  1. In the Category pane on the left, select an existing category or click the image icon to create a new one.

    Alibaba Cloud Model Studio manages imported files by category.
    Note

    Each workspace supports a maximum of 500 categories. To request a higher category limit, submit a ticket.

  2. 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.
  3. For Parsing Method, select Default Settings or Custom Settings. (Custom Settings lets you configure parsing rules for different formats to improve parsing results).

    Parsing method details

    Configure the parsing strategy based on your needs. If you are unsure, use the default settings. For details on Intelligent Document Parsing, LLM Parsing, and Digital Parsing, see document understanding.

    The available parsing methods depend on the selected file type (document, image, audio, and video).
    • Digital Parsing: Cannot parse illustrations and charts in files.

    • Intelligent document parsing: The parser identifies and extracts text from illustrations and then generates text summaries. These summaries, along with other non-image content, are chunked, converted into vectors, and used for knowledge base retrieval.

    • Large model document parsing: Enables agents that use a model from Select Model to answer questions about illustrations and charts in a file. Select LLM Parsing to recognize and understand this type of content.

    • Qwen-VL parsing: Supports only image formats. You can select a Qwen-VL model and use a prompt to specify the layout, elements, and content for recognition. Its other features are the same as those of large model document parsing.

    • Audio/video parsing: Performs speech recognition, video frame extraction (for videos only), and plot analysis (for videos only) on the file, then structurally aligns all audio and visual information on a timeline.

      • Speech recognition: The subtitle content parser uses Speech File Transcription to convert human speech into text. It cannot recognize music or environmental sounds, such as horns, bells, or thunder.

      • Video frame extraction: Extracts representative visual frames from the original video and generates corresponding text descriptions.

      • Plot analysis (must be enabled manually): Analyzes video content to identify specific events, marks them with timestamps, and generates corresponding text descriptions.

  4. (Optional) Configure Tags for the file.

    When you call an application by using an API, you can specify tags in the tags request 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.
  5. 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.
  6. 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 image icon to create a new one.

Alibaba Cloud Model Studio uses data tables to manage imported data.

New data table

  1. 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 age indicates 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_url format: https://example.com/downloads/pic.jpg
        When you create a knowledge base, fields of the image_url type 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.
  2. Click the image 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.
  3. 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

  1. In the Table list on the left, select the target data table, and then click Import Data.

  2. 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.
  3. Click the image 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.

    1. In the Category pane on the left, select an existing category or click the image icon to create a new one.

      Model Studio (Bailian) uses categories to manage imported files.
      Note

      Each workspace supports a maximum of 500 categories. To request a higher category limit, submit a ticket.

    2. 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-access tag 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.com domain to the Referer allowlist. For more information, see Hotlink Protection.
    3. For Parsing Method, select Default Settings or Custom Settings. With Custom Settings, you can configure parsing rules for different formats to improve parsing performance.

      Parsing methods

      Configure the parsing strategy based on your needs. If you are unsure, we recommend using the default settings. For detailed information about Intelligent Document Parsing, LLM Parsing, and Digital Parsing, see document understanding.

      • Digital Parsing: This method does not parse illustrations or charts in files.

      • Intelligent Document Parsing: The parser identifies and extracts text from illustrations in a file and then generates text summaries. These summaries, along with other non-image content, are chunked and converted into vectors for knowledge base retrieval.

      • Large model document parsing: Applications that use the model specified in Select Model allow users to ask questions about the content of illustrations and charts in files. To recognize and understand illustrations and charts in files, select LLM Parsing.

      • Qwen-VL Parsing: Supports only image formats. You can select a Qwen-VL model and use a prompt to specify the layout, elements, and content for the model to recognize. In other respects, it is the same as large model-based document parsing.

      • Audio and Video Parsing: Performs speech recognition, video frame extraction (for videos only), and scene analysis (for videos only) on the file, and then aligns all audio and visual information structurally on a timeline.

        • Speech Recognition: The parser uses Speech File Transcription to convert human speech into text. It does not currently support the recognition of music or environmental sounds, such as horns, bells, or thunder.

        • Video Frame Extraction: Extracts representative visual frames from the original video and generates corresponding text descriptions.

        • Scene Analysis (must be enabled manually): Analyzes the video content to identify specific events, marks them with timestamps, and generates corresponding text descriptions.

    4. (Optional) Configure Tags for the file.

      When you call an application by using the API, you can specify tags in the tags request 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 Knowledge Base > > > Advanced Configuration > Filter by Tag).
    5. 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.
    6. 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

Important
  • 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

  1. 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 failure error is displayed when you create the data source.

    How to configure the EventBridge whitelist

    1. Go to the RDS console. In the navigation pane on the left, click Instance List, and then click the target RDS instance. In the navigation pane on the left, click Database Connection, and then click Configure Whitelist next to the public endpoint.

    2. Click Add Whitelist Group and add all of the following EventBridge public IP addresses to the group.

      • 39.105.55.188,39.105.110.43,47.95.35.213,47.95.33.100,39.106.255.198,47.93.177.159,47.95.32.154,39.107.99.72

    3. Click OK.

  2. 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:RELOAD error occurs during creation.
  3. 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

  1. 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:RELOAD error occurs during creation.
  2. 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.

  3. 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

Important
  • 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

  1. 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 failure error when you create a data source.

    How to configure the EventBridge allowlist

    1. Go to the ECS console. In the left-side navigation pane, choose Security Group. Find the security group associated with your self-hosted MySQL instance, and then click Manage Rules in the Actions column.

    2. On the security group details page, click Add Rule. Add all of the following EventBridge public IP addresses to the security group and configure the rule to allow all traffic on all ports.

      Do not use a security group that was created indirectly by a third-party product or service.
      • 39.105.55.188,39.105.110.43,47.95.35.213,47.95.33.100,39.106.255.198,47.93.177.159,47.95.32.154,39.107.99.72

    3. Click OK to save the rule.

    4. In your MySQL database, create an account that allows traffic from all sources (or use an existing account), and then run the following GRANT commands.

      Replace user1 in the following commands with your actual database username.
      -- Create a user. Replace user1 with your actual database username.
      CREATE USER 'user1'@'%' IDENTIFIED BY 'your_password_for_user1';
      -- Grant privileges. Replace user1 with your actual database username.
      GRANT ALL PRIVILEGES ON *.* TO 'user1'@'%' WITH GRANT OPTION;
      -- Flush privileges (this only needs to be done once).
      FLUSH PRIVILEGES;
    5. Enable binary logging (binlog) and Global Transaction Identifiers (GTID) by modifying the MySQL configuration file. On Linux systems, this file is typically located at /etc/my.cnf or /etc/mysql/my.cnf.

      [mysqld]
      log-bin=mysql-bin
      server-id=1
      binlog_format=ROW
      gtid_mode=ON
      enforce_gtid_consistency=ON
    6. Restart the MySQL server for the changes to take effect.

  2. 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.

  3. 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

  1. 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 failure error when you create a data source.

    How to configure the database

    1. In your MySQL database, create an account that allows traffic from all sources (or use an existing account), and then run the following GRANT commands.

      Replace user1 in the following commands with your actual database username.
      -- Create a user. Replace user1 with your actual database username.
      CREATE USER 'user1'@'%' IDENTIFIED BY 'your_password_for_user1';
      -- Grant privileges. Replace user1 with your actual database username.
      GRANT ALL PRIVILEGES ON *.* TO 'user1'@'%' WITH GRANT OPTION;
      -- Flush privileges (this only needs to be done once).
      FLUSH PRIVILEGES;
    2. Enable binary logging (binlog) and Global Transaction Identifiers (GTID) by modifying the MySQL configuration file. On Linux systems, this file is typically located at /etc/my.cnf or /etc/mysql/my.cnf.

      [mysqld]
      log-bin=mysql-bin
      server-id=1
      binlog_format=ROW
      gtid_mode=ON
      enforce_gtid_consistency=ON
    3. Restart the MySQL server for the changes to take effect.

  2. 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.

  3. 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.

  4. 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

Important

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.

Create a private network data source

1. Configure the data source:

Parameter

Description

Region

Select the region of the ECS instance hosting your self-hosted PostgreSQL database. You can find this information in the ECS console.

Database address

Enter the private IP address of your self-hosted PostgreSQL database. To find this, go to the ECS console, click Instances in the left-hand navigation pane, and view the private IP address for the target instance.

Database port

Enter the port of your self-hosted PostgreSQL database. The default is 5432.

Database username

Enter the database account that you authorized in the previous configuration steps.

Database password

Enter the database password.

Database name

Required. Specify the name of the database to connect to (dbName).

ecsId

The ID of the ECS instance that hosts your self-hosted PostgreSQL instance.

2. Test connectivity: Click Test Connection to verify the connection between Alibaba Cloud Model Studio and your data source.

When you submit this task for the first time, follow the on-screen instructions to authorize the DTS service-linked role. This action requires an Alibaba Cloud account. If you are a RAM user, an administrator for the Alibaba Cloud account must grant you the required permissions.

Parameter

Description

VPC ID

Enter the ID (vpc-xxxxxx) of the VPC that contains the ECS instance for your self-hosted PostgreSQL database. You can also find this information in the ECS console.

VSwitch ID

The VSwitch ID (vsw-xxxxxx) is displayed below the instance's VPC ID.

Security group

You can use a managed security group. If you use a custom security group, ensure it was created manually and not automatically by another Alibaba Cloud service. You can create a security group on the Security Groups page of the ECS console. The security group must meet the following requirements:

- The security group must be in the same region that you selected above.

- The security group must be associated with the same VPC as the ECS instance.

- Both basic and enterprise security groups are supported.

- Ensure the security group's inbound rules allow access from Alibaba Cloud Model Studio to your database port.

3. After the connectivity test passes, click Confirm to submit the task. The system automatically configures the PostgreSQL data source. During this process, the workspace is locked, and you cannot create other data sources.

During peak hours, data source creation might take several minutes.

Status

Description

Creation Succeeded

The data source was created successfully. Select the data source and then select a data table.

Creation Failed

The data source creation failed. Verify your parameters, make the necessary corrections, and then click Re-create Data Source. You can also click Delete to remove the failed data source.

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.

  1. Select a Category for the data synchronization.

  2. 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/ or my-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-access tag with the value read to 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, while my-bucket/docs/foo.md synchronizes 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.

    1. Create a Lark application and obtain credentials

    1. Log in to the Lark Open Platform and click Developer Console in the upper-right corner. In the console, click Create Custom App, fill in the App Name, App Description, and App Icon, and then click Create.

    2. On the app management page, find the Bot feature and click Add.

    3. In the left-side navigation pane, click Permission Management. On the tab that opens, click Bulk Import/Export Permissions. Copy the following JSON-formatted permission description code into the Import tab, click Next, Confirm New Permissions, and then click Request to Enable.

      {
        "scopes": {
          "tenant": [
            "aily:file:read",
            "aily:file:write",
            "application:application.app_message_stats.overview:readonly",
            "application:application:self_manage",
            "application:bot.menu:write",
            "cardkit:card:write",
            "contact:contact.base:readonly",
            "contact:user.employee_id:readonly",
            "corehr:file:download",
            "docs:document.content:read",
            "event:ip_list",
            "im:chat",
            "im:chat.access_event.bot_p2p_chat:read",
            "im:chat.members:bot_access",
            "im:message",
            "im:message.group_at_msg:readonly",
            "im:message.group_msg",
            "im:message.p2p_msg:readonly",
            "im:message:readonly",
            "im:message:send_as_bot",
            "im:resource",
            "sheets:spreadsheet",
            "wiki:wiki:readonly"
          ],
          "user": [
            "aily:file:read",
            "aily:file:write",
            "im:chat.access_event.bot_p2p_chat:read"
          ]
        }
      }
    4. Go to the Credentials and Basic Information page and copy the App ID and App Secret for later use.

    2. Configure knowledge base access permissions for the Lark application

    • In the Lark client, create a group chat and add the application to it.

    • As a knowledge base administrator, navigate to Knowledge Base Settings > Member Settings > Add Admin.

    • Search for the group chat containing the bot and add the group as an administrator.

    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.

    1. Create a DingTalk application

    1. Log in to the DingTalk Open Platform. Select an organization for which you have developer permissions, or select an organization and then obtain developer permissions.

    2. In the top menu bar, select App Development.

    3. On the right side of the page, click Create App, fill in the application name and description, and then click Save. You are automatically taken to the application details page.

    2. Add permissions to the DingTalk application

    Before synchronizing data, on the application details page, navigate to Development Configuration > Permission Management, then search for and enable the following permissions:

    • Contact.User.Read

    • Wiki.Workspace.Read

    • Wiki.Node.Read

    • Document.Workbook.Read

    • Notable.Base.Read_All

    • qyapi_get_member

    3. Publish the application

    1. In the left-side navigation pane of the application details page, click Version Management & Release.

    2. On the right side of the page, click Create New Version and enter a version number (for example, 1.0.0) and a version description.

    3. Set the visibility range, for example, to All Employees.

    4. Click Save, and then confirm the publication.

    4. Obtain the application Client ID and Client Secret

    1. In the left-side navigation pane, click Credentials and Basic Information.

    2. Obtain the Client ID and Client Secret.

    5. Obtain the DingTalk User ID

    1. Go to the DingTalk Admin Console and log in as an organization administrator.

    2. In the left-side navigation pane, click Contacts > Member Management.

    3. In the member list, find the Employee UserID column and copy the UserID of the target user.

    Note

    You must have administrative permissions for the organization to view employee UserIDs.

    6. Enable DingTalk MCP

    Before creating a DingTalk synchronization rule, you must enable the following MCP services in the DingTalk MCP Marketplace:

    • DingTalk Docs MCP: Required to synchronize DingTalk documents.

    • DingTalk Sheets MCP: Required to synchronize DingTalk spreadsheets.

    Steps to obtain an MCP Endpoint:

    1. Go to the DingTalk MCP Marketplace, find DingTalk Docs and DingTalk Sheets, and click to open their details pages.

    2. On the details page, click to get the MCP server configuration and copy the corresponding MCP Endpoint link.

    3. Paste the copied links into the DingTalk Docs MCP Link and DingTalk Sheets MCP Link fields in the form.

    7. Obtain the DingTalk Knowledge Base ID, Folder ID, or Document ID

    You must fill in one of the following three IDs in the form to specify which content to synchronize: DingTalk Knowledge Base ID, DingTalk Folder ID, or DingTalk Document ID. You can obtain them directly from the URL:

    • DingTalk Knowledge Base ID: Go to the DingTalk knowledge base homepage, click the knowledge base you want to synchronize, and find the ID at the end of the URL in your browser's address bar.

    • DingTalk Folder ID: In the knowledge base, click the corresponding folder. The ID is at the end of the URL.

    • DingTalk Document ID: In the knowledge base, click the corresponding document. The ID is at the end of the URL.

    Note

    These three IDs determine the synchronization scope. Providing the knowledge base ID synchronizes the entire knowledge base. Providing the folder ID synchronizes that folder and its sub-documents. Providing the document ID synchronizes only that single document.

    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.

    Note

    This is a typical estimate. The actual consumption may fluctuate slightly due to factors such as API retries and error rollbacks.

    SharePoint

    Access SharePoint documents and folders through Azure AD application registration credentials to synchronize content to the Bailian platform.

    Important

    SharePoint synchronization is currently available only to whitelisted users. To request access, contact the Alibaba Cloud Bailian team.

    Prerequisites: Register an Azure AD app and obtain credentials

    1. Log in to the Azure portal, search for Microsoft Entra ID (formerly Azure Active Directory) in the top search bar, or click Manage Microsoft Entra ID on the home page.

    2. Under Manage in the left navigation pane, click App registrations, then click New registration. Fill in the application name and select the supported account type to create the app. For detailed instructions, see Microsoft documentation: Register an application.

    3. On the app Overview page, in the Essentials section, copy the Directory (tenant) ID. This is the Tenant ID in the form.

    4. In the same Essentials section, copy the Application (client) ID. This is the Client ID in the form.

    5. Under Manage in the left navigation pane, click Certificates & secrets, switch to the Client secrets tab, and click New client secret. Fill in the description and set the expiration. Copy the Value immediately after creation (it is only displayed once and cannot be viewed after leaving the page). This is the Application Secret in the form.

    6. Under Manage in the left navigation pane, click API permissions, click Add a permission, select Microsoft Graph -> Application permissions, and add the following permissions:

      • Sites.Read.All: Read files in all site collections.

      • Files.Read.All: Read file content.

    7. After adding permissions, click the Grant admin consent for [tenant name] button at the top of the page to complete authorization. The permission status will change to "Granted for [tenant name]".

    Fill in the following SharePoint document information:

    Parameter

    Required

    Description

    Tenant ID

    Yes

    The Directory (tenant) ID of your Azure AD app. Obtain it from the Essentials section on the app registration Overview page in the Azure portal.

    Client ID

    Yes

    The Application (client) ID of your Azure AD app. Obtain it from the Essentials section on the app registration Overview page in the Azure portal.

    Application Secret

    Yes

    The client secret value of your Azure AD app. Create it on the Certificates & secrets page in the Azure portal, under the Client secrets tab. Note: The secret value is only displayed once at creation time and cannot be viewed after leaving the page. Save it promptly.

    Cloud Type

    No

    Select the cloud environment of your SharePoint account. Options: Global Public Cloud (default) and China 21Vianet. If your SharePoint account is deployed on the China 21Vianet cloud, select the corresponding option.

    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 SharePoint credentials and share links 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.

    Yuque Sync

    Access Yuque documents and knowledge bases through a Yuque Token to synchronize content to the Bailian platform.

    Obtain a Yuque Token

    • Personal Token: Log in to the Yuque settings page, create a new token, and copy it.

    • Team Token: Navigate to Team Space -> Team Settings -> Developer -> Tokens, create a new token, and copy it.

    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, enter 0,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.

  3. 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

searchFile

Searches for files by title keywords and returns their download links.

  • keyWord (string, required): Keywords from the file title.

  • maxCount (int, optional): The number of files to return. Default: 5. Maximum: 10.

getFile

Retrieves a file by using its ID and returns its download link.

  • fileId (string, required): The file ID.

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.

    Important

    Deletion requires confirmation. You cannot undo this action.

Note

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.

  1. On the agent configuration page, click Skills in the left pane and find the Data Connector section.

  2. Click the + button in the Data Connector section. In the Select Data Connector dialog box:

    1. Browse or search for the target connector. You can filter by connector type.

    2. 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.

  1. 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.

  2. 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.

  3. 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.

  4. Connect nodes: Connect the data connector node to upstream and downstream nodes to ensure the correct data flow.

  5. 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.

Note

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.

FAQ

Permissions and security

  • What should I do if I receive a "permission for this module is missing" error when importing data?

    The root account must grant the Administrator permission to the RAM user. For more information, see Page permissions.

  • Is it safe to upload confidential files through public network data connectors when creating a knowledge base?

    Data connectors transmit data through public network links, but the entire transmission uses HTTPS/TLS encrypted channels. Data is in ciphertext during transmission and cannot be interpreted even if the link is intercepted. After data reaches the platform, it is written directly to Alibaba Cloud internal network secure storage, which cannot be accessed from the public network. The public network only serves as a transport medium—data is not persisted on the public network.

    After import, files are stored as independent copies (unlinked from original data) in the platform's secure storage. Imported files are accessible only to users in the current workspace. Alibaba Cloud Model Studio does not use the data for any commercial purposes or make it publicly available.

    If you still have concerns about public network transmission, you can choose the following options for enhanced security:

    • Direct file upload: Upload local files through the file connector. Data does not pass through public network links and is written directly to Alibaba Cloud internal network secure storage.

    • Private network data source: For Alibaba Cloud RDS for MySQL or self-managed MySQL databases, you can select private network (VPC) connection. Data is transmitted through the internal network, offering better security and performance. See the Private network data source section above.

    Model Studio Standard and Enterprise editions have identical data security mechanisms: both provide user-level isolation, workspace member-only access, and HTTPS/TLS encrypted transmission. The difference between the two editions is only in storage capacity and feature limits, not security.

Import files from OSS

  • How do I configure permissions to import files from OSS?

    The first time you import files from OSS, you must authorize Alibaba Cloud Bailian to access your OSS resources. The authorization process differs for a root account and a RAM user.

    Authorize a root account

    1. On the Import data page, click Authorize Now.

    2. In the dialog box that appears, click Confirm Authorization. The system automatically creates an OSS service-linked role to allow Alibaba Cloud Bailian to access your OSS resources.

      This change usually takes effect within seconds but can be delayed during peak hours.
    3. Add the tag bailian-datahub-access with the value read to the target OSS bucket.

      This tag identifies the buckets that Alibaba Cloud Bailian can access. Alibaba Cloud Bailian cannot access buckets without this tag.
      1. Go to the OSS console. In the left-side navigation pane, click Bucket list and find the target bucket.

      2. Hover over the image icon next to the bucket name and click Modify (if no tags have been set) or Go to edit.

      3. On the bucket tags page, click Create tag (if no tags have been set) or Settings.

      4. Click Tag, add a tag with the key bailian-datahub-access and the value read, and then click Save.

    4. Return to the Import Data page, reselect the target bucket, and try the import again.

      Note: Alibaba Cloud Bailian does not support accessing files in the root directory of a bucket. You must select an existing subdirectory or create a new one for Alibaba Cloud Bailian to access.

    Authorize a RAM user

    1. On the Import data page, click Authorize Now.

    2. In the dialog box that appears, click Confirm Authorization. If the UI displays an Authorization failed error with the message The current user does not have permission to create a service-linked role, you must first grant this permission to the RAM user.

      1. Sign in to the RAM console as the root account. In the left-side navigation pane, choose Permissions > Policies, and then click Create policy.

      2. Click the Script editor tab. Copy and paste the following policy into the editor, and then click OK.

        {
            "Action": [
                "ram:CreateServiceLinkedRole"
            ],
            "Resource": "*",
            "Effect": "Allow",
            "Condition": {
                "StringEquals": {
                    "ram:ServiceName": "datahub.sfm.aliyuncs.com"
                }
            }
        }
      3. Enter a policy name, such as CreateServiceLinkedRole, and click OK.

      4. In the left-side navigation pane, choose Identities > Users. Find the target RAM user in the list and click Add permissions in the Actions column.

      5. Select the custom policy you created, and then click OK. This grants the RAM user permission to create the service-linked role.

    3. Authorize the RAM user to access OSS through Alibaba Cloud Bailian.

      1. Return to the Import Data page and click Authorize Now.

      2. In the dialog box that appears, click Confirm Authorization. The system automatically creates an OSS service-linked role, which is required.

        This change usually takes effect within seconds but can be delayed during peak hours.
    4. Add the tag bailian-datahub-access with the value read to the target OSS bucket.

      This tag identifies the buckets that Alibaba Cloud Bailian can access. Alibaba Cloud Bailian cannot access buckets without this tag.
      1. Go to the OSS console. In the left-side navigation pane, click Bucket list and find the target bucket.

      2. Hover over the image icon next to the bucket name and click Modify (if no tags have been set) or Go to edit.

      3. On the bucket tags page, click Create tag (if no tags have been set) or Settings.

      4. Click Tag, add a tag with the key bailian-datahub-access and the value read, and then click Save.

    5. Return to the Import Data page, reselect the target bucket, and try the import again.

      Note: Alibaba Cloud Bailian does not support accessing files in the root directory of a bucket. You must select an existing subdirectory or create a new one for Alibaba Cloud Bailian to access.
  • What should I do if I get error "10041495" when importing files from OSS?

    This error usually occurs because the root account has not activated OSS. To resolve this issue:

    1. Sign in to the OSS console as the root account and activate OSS when prompted.

    2. Return to the Alibaba Cloud Bailian page and authorize again.

Import MySQL data

  • Which regions are supported for RDS and ECS instances used as private network data sources?

    • China (Hangzhou)

    • China (Shanghai)

    • China (Shenzhen)

    • China (Heyuan)

    • China (Guangzhou)

    • China (Qingdao)

    • China (Beijing)

    • China (Zhangjiakou)

    • China (Hohhot)

    • China (Ulanqab)

    • China (Chengdu)

  • How do I grant a RAM user the permissions to create the EventBridge service-linked role?

    1. As the root account, attach the following three system policies to the RAM user: AliyunBailianFullAccess, AliyunEventBridgeFullAccess, and AliyunRDSReadOnlyAccess. For detailed instructions, see Manage permissions for a RAM user.

    2. Using the root account, grant the RAM user the permission to create service-linked roles.

      1. Sign in to the RAM console as the root account. In the left-side navigation pane, choose Permissions > Policies, and then click Create policy.

      2. In the Script Editor, enter the corresponding content from the following script into the Effect, Action, Resource, and Condition fields, and then click OK.

        {
            "Version": "1",
            "Statement": [
                {
                    "Action": "ram:CreateServiceLinkedRole",
                    "Resource": "*",
                    "Effect": "Allow"
                }
            ]
        }
      3. Enter the policy name CreateServiceLinkedRole and click OK.

      4. In the left-side navigation pane, choose Identities > Users. Find the target RAM user in the list and click Add permissions in the Actions column.

      5. From the Policies list, select the CreateServiceLinkedRole policy that you just created, and then click OK. This grants the RAM user permission to create service-linked roles.

    3. After completing these steps, return to the Create Data Source page as the RAM user and create the EventBridge service-linked role again.

  • What should I do if I get a "Database configuration check failed. The selected table contains a large amount of data" error?

    ApsaraDB RDS for MySQL

    The image is for illustration only. Recommended values vary based on your table's data volume. If an item is not mentioned, no change is required.

    Perform these steps as your root account.

    • Configure the local log retention period

      1. Go to the RDS console. In the left-side navigation pane, click Instances, and then click the ID of the relevant RDS instance. In the left-side navigation pane, click Backup and recovery. On the Backup strategy tab, find the Retention period setting.

      2. Set the Retention period to the value recommended in the prompt.

    • Configure wait_timeout

      1. Go to the RDS console. In the left-side navigation pane, click Instances, and then click the ID of the relevant RDS instance. In the left-side navigation pane, click Parameter settings. On the Editable parameters tab, find the wait_timeout parameter.

      2. Set the parameter to the value recommended in the prompt.

    Self-managed MySQL

    The image is for illustration only. Recommended values vary based on your table's data volume. If an item is not mentioned, no change is required.
    • Set the local log retention period

      • Method 1 (temporary): Modify expire_logs_days (for MySQL 5.7 or earlier) or binlog_expire_logs_seconds (for MySQL 8.0 or later) by running the SET GLOBAL command. This change is lost after the next MySQL restart.

        MySQL 5.7 and earlier

        1. Run the statement:

          Replace the value 15 with the recommended value from the prompt.
          SET GLOBAL expire_logs_days = 15; 
        2. To verify the change, run the following statement:

          SHOW VARIABLES LIKE 'expire_logs_days';

        MySQL 8.0 and later

        1. Run the statement:

          Replace the value 1296000 with the recommended value from the prompt.
          SET GLOBAL binlog_expire_logs_seconds = 1296000; 
        2. To verify the change, run the following statement:

          SHOW VARIABLES LIKE 'binlog_expire_logs_seconds';
      • Method 2 (Permanent): Set expire_logs_days (for MySQL 5.7 and earlier versions) or binlog_expire_logs_seconds (for MySQL 8.0 and later versions) in the MySQL configuration file, but this method requires a restart of the MySQL service.

        MySQL 5.7 and earlier

        1. For example, on a Linux system, the MySQL configuration file is typically located at /etc/my.cnf or /etc/mysql/my.cnf. If the file already contains expire_logs_days, you can modify it directly. If it does not exist, add it manually.

          Replace the value 15 with the recommended value from the prompt.
          [mysqld]
          expire_logs_days = 15
        2. Save the configuration file, and then restart the MySQL service.

        3. To verify the change, run the following statement:

          SHOW VARIABLES LIKE 'expire_logs_days';

        MySQL 8.0 and later

        1. For example, on a Linux system, the MySQL configuration file is typically located at /etc/my.cnf or /etc/mysql/my.cnf. If the file already contains binlog_expire_logs_seconds, you can modify it directly. If it does not exist, add it manually.

          Replace the value 1296000 with the recommended value from the prompt.
          [mysqld]
          binlog_expire_logs_seconds = 1296000
        2. Save the configuration file, and then restart the MySQL service.

        3. To verify the change, run the following statement:

          SHOW VARIABLES LIKE 'binlog_expire_logs_seconds';
    • Set wait_timeout

      • Method 1 (temporary): Execute the SET GLOBAL command to modify the wait_timeout parameter (in seconds). This change will be reset after the next MySQL restart.

        1. Run the statement:

          Replace the value 1159200 with the recommended value from the prompt.
          This statement affects all new connections. Existing connections are not affected.
          SET GLOBAL wait_timeout = 1159200; 
        2. To verify the change, run the following statement:

          SHOW VARIABLES LIKE 'wait_timeout'; 
      • Method 2 (Permanent): Set the wait_timeout parameter (in seconds) in the MySQL configuration file, but this method requires a restart of the MySQL service.

        1. For example, on a Linux system, the MySQL configuration file is typically located at /etc/my.cnf or /etc/mysql/my.cnf. If the file already contains wait_timeout, you can modify it directly. If it does not exist, add it manually.

          Replace the value 1159200 with the recommended wait_timeout value from the prompt.
          [mysqld]
          wait_timeout = 1159200
        2. Save the configuration file, and then restart the MySQL service.

        3. To verify the change, run the following statement:

          SHOW VARIABLES LIKE 'wait_timeout';