创建知识库前预览数据¶
在创建知识库前,根据 Catalog 选择范围预览将选中的文件和数据表数量。该接口只读,不会创建知识库、数据源或处理任务。
POST https://api.moi.matrixorigin.cn/v5/semantic-models/source-selections/preview
调用前准备¶
选择范围仅支持 Catalog 数据:database_tables 用于一个 Database 中的数据表,volume_files 用于一个 Volume 中的文件。all_selected: false 时必须传对应的 selected_table_ids 或 selected_file_ids;all_selected: true 时可传对应的排除 ID。
请求参数¶
curl -X POST "https://api.moi.matrixorigin.cn/v5/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]
}
]
}'
字段路径中的 [] 表示数组中的每一项。例如,source_selections[].kind 表示 source_selections 数组中每一项的 kind 字段。
字段 |
类型 |
必填 |
说明 |
|---|---|---|---|
|
array of object |
是 |
要预览的来源选择。 |
下面表格展开请求示例中 source_selections 数组的每一项;每一行是该数组项的一个字段。
字段 |
类型 |
必填 |
说明 |
|---|---|---|---|
|
string |
是 |
|
|
integer |
条件必填 |
|
|
integer |
条件必填 |
|
|
boolean |
是 |
|
|
array of integer |
条件必填 |
|
|
array of string |
条件必填 |
|
|
array of integer |
否 |
全选时要排除的 Catalog 表 ID。 |
|
array of string |
否 |
全选时要排除的 Catalog 文件 ID。 |
|
object |
否 |
按表名、文件名或扩展名进一步筛选。 |
下面表格展开请求示例中 source_selections[].filters 对象;每一行是该对象的一个字段。
字段 |
类型 |
必填 |
说明 |
|---|---|---|---|
|
string |
否 |
表名筛选条件。 |
|
string |
否 |
文件名筛选条件。 |
|
array of string |
否 |
文件扩展名筛选条件。 |
成功响应¶
成功时返回 200。
{
"code": "OK",
"msg": "OK",
"data": {
"file_count": 0,
"table_count": 1,
"total_count": 1
}
}
字段 |
类型 |
说明 |
|---|---|---|
|
string |
成功时为 |
|
string |
成功时为 |
|
object |
响应数据。 |
下面表格展开响应示例中 data 对象;每一行是该对象的一个字段。
字段 |
类型 |
说明 |
|---|---|---|
|
integer |
预览范围中的文件数量。 |
|
integer |
预览范围中的数据表数量。 |
|
integer |
去重后的总数量。 |
后续操作¶
数量符合预期后,使用相同的 source_selections 调用创建知识库并添加数据源。