Preview the data source when created

Before creating the knowledge base, preview the number of files and data tables that will be selected based on the Catalog selection range. This interface is read-only and does not create knowledge bases, data sources, or processing tasks.

POST https://moi.matrixorigin.cn/newmoi/semantic-models/source-selections/preview

Preparation before calling

The selection range only supports Catalog data: database_tables is used for data tables in a Database, and volume_files is used for files in a Volume. Prepare $AI_STUDIO_API_KEY and $WORKSPACE_ID.

When all_selected: false, the corresponding selected_table_ids or selected_file_ids must be passed; when all_selected: true, the corresponding exclusion ID can be passed.

Request example

curl -X POST "https://moi.matrixorigin.cn/newmoi/semantic-models/source-selections/preview" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H 'Content-Type: application/json' \
  -d '{
    "source_selections": [
      {
        "kind": "database_tables",
        "database_id": 101,
        "all_selected": false,
        "selected_table_ids": [201]
      }
    ]
  }'

Successful response

Returns 200 on success.

{
  "code": "OK",
  "msg": "OK",
  "data": {
    "file_count": 0,
    "table_count": 1,
    "total_count": 1
  }
}

Field

Type

Description

data.file_count

integer

The number of files in the preview range.

data.table_count

integer

The number of data tables in the preview range.

data.total_count

integer

The total quantity after deduplication.

Common mistakes

HTTP Status Codes

Error Codes

Common Causes

Recommended Actions

400

ErrParamInvalid

The selection range is empty, or kind, ID, and selection rules are invalid.

Press Create knowledge base and add data source to correct the selection range.

401

ErrUnauthorized

The API Key is invalid or has expired.

Check API Key.

403

ErrForbidden

Does not have create permission or read permission for the selected range.

Check workspace and catalog object authorization.

Follow-up operations

Once the quantities are as expected, create the knowledge base and add the data source](create-knowledge-base-with-sources.md) using the same source_selections call.

Last updated on