Create a knowledge base and add data sources¶
Create a knowledge base and create processing tasks for the initial data source. The content cannot be retrieved until processing is complete.
POST $CLOUDSIGMA_API_BASE/semantic-models/create-with-sources
Before you call¶
Configure the CloudSigma regional endpoint and authentication before calling. The endpoint, credentials, workspace, and resource IDs must belong to the same region. Confirm the source first: Catalog tables, Catalog files, and batch selections can only reference data already in the Catalog. For local files, first obtain the file ID through Upload local file. Prepare a personal access token and target workspace ID that has access rights to the target workspace and permission to create knowledge base.
Request body¶
Replace $CLOUDSIGMA_API_KEY, $WORKSPACE_ID in the example with actual values.
curl -X POST "$CLOUDSIGMA_API_BASE/semantic-models/create-with-sources" \
-H "X-API-Key: $CLOUDSIGMA_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H 'Content-Type: application/json' \
-d '{
"name": "<KNOWLEDGE_BASE_NAME>",
"sources": [
{
"source_type": "catalog_table",
"table_id": 123
}
]
}'
When adding sources directly, fields are provided by source type:
Source type |
Required fields |
|---|---|
|
|
|
|
|
Upload the returned |
source_selections can only be selected within the Database or Volume range of the Catalog, and data sources outside the Catalog cannot be passed in.
Field |
Type |
Required |
Description |
|---|---|---|---|
|
array of object |
Yes |
The list of directly added data source objects contains at least 1 items. |
|
string |
No |
Source type. Values: |
|
string |
No |
File name. |
|
string |
No |
Upload method. |
|
string |
No |
Create table configuration JSON text. |
|
string |
No |
File ID. |
|
integer |
No |
Table ID. |
|
string |
No |
Base64 encoded content of the local file. |
|
string |
No |
Selection range: |
|
integer |
No |
Database ID. |
|
integer |
No |
Volume ID. The associated volume ID. |
|
boolean |
No |
Whether to select all. |
|
integer (array of integers) or null |
No |
Selected table ID. |
|
integer (array of integers) or null |
No |
Excluded table ID. |
|
array of string or null |
No |
Selected file ID. |
|
array of string or null |
No |
Excluded file IDs. |
|
object |
No |
Filter criteria. |
|
string |
No |
Table name. |
|
string |
No |
File name. |
|
array of string or null |
No |
File extension. |
|
string |
No |
Table name. |
|
array of string or null |
No |
File extension. |
|
array of string or null |
No |
parent relationship. |
|
array of string or null |
No |
path. |
|
string |
No |
logo. |
|
string |
No |
Image vector table. |
|
string |
No |
Image vector model. |
|
string |
No |
Image vector backend ID. |
|
integer |
No |
Image vector dimensions. |
|
string |
No |
Image preprocessing version. |
|
string |
No |
Image distance metric. |
|
string |
No |
Image range. |
|
string |
No |
status. |
Successful response¶
{
"code": "OK",
"msg": "OK",
"data": {
"model": {
"id": 401,
"name": "product_docs",
"tables": null,
"created_at": 1735632000,
"updated_at": 1735632000,
"source_counts": {
"files": 0,
"tables": 0,
"total": 0
}
},
"data_domain": {
"model_id": 401,
"catalog_id": 10,
"database_id": 20,
"raw_volume_id": 30,
"processed_volume_id": 31,
"ensure_status": "ready",
"last_checked_at": 1735632000
},
"sources": [
{
"row_id": "src_01",
"source_type": "table",
"model_id": 401,
"resource_id": "123",
"display_name": null,
"path": [],
"db_name": null,
"table_name": null,
"size_bytes": null,
"row_count": null,
"ingest_status": "pending",
"enabled": null,
"expires_at": null,
"expired": false,
"effective_enabled": true,
"force_enabled_after_expiry": false,
"updated_at": null,
"error": null
}
],
"jobs": [
{
"job_id": "job_01",
"source_id": "src_01",
"model_id": 401,
"job_type": "load",
"job_status": "pending",
"idempotency_key": "idem_01",
"retry_count": 0
}
]
}
}
Field |
Type |
Description |
|---|---|---|
|
object |
Create a snapshot of the new knowledge base. |
|
integer |
logo. |
|
string |
Name. |
|
string |
Description. |
|
array of object |
List of data table objects associated with knowledge base. |
|
array of object |
List of file objects associated with the knowledge base. |
|
integer |
Creation time. |
|
integer |
Update time. |
|
object |
Source quantity statistics. |
|
integer |
The number of file sources must not be less than 0. |
|
integer |
The number of data table sources shall not be less than 0. |
|
integer |
The sum of the number of file and table sources. Not less than 0. |
|
object |
Catalog, database and file volume IDs associated with this knowledge base, as well as storage readiness status. |
|
integer |
knowledge base ID. |
|
integer |
CatalogID。 |
|
integer |
Database ID. |
|
integer |
Original file volume ID. |
|
integer |
Handles file volume IDs. |
|
string |
Storage readiness status. Values: |
|
string |
Recent preparation errors. Omitted if there is no error. |
|
integer |
Last checked time. |
|
array of object |
Source record created. |
|
string |
Record ID. |
|
string |
Source ID. |
|
string |
Source type. Value: |
|
integer |
Model ID. |
|
string |
Resource ID. |
|
string |
Source resource ID. |
|
string |
knowledge base resource ID. |
|
string |
Source file ID. |
|
string |
knowledge base file ID. |
|
integer |
Source table ID. |
|
integer |
knowledge base table ID. |
|
string or null |
Display name. |
|
array of string |
path. |
|
string |
Source path. |
|
string or null |
Database name. |
|
string or null |
Table name. |
|
integer or null |
size in bytes. |
|
integer or null |
Number of rows. |
|
string or null |
Import status. Values: |
|
boolean or null |
Whether to enable. |
|
integer or null |
Expiration time. |
|
boolean |
Has it expired? |
|
boolean |
actual enabled status. |
|
boolean |
Whether to force activation after expiration. |
|
array of string |
tag list. |
|
string |
Creator. |
|
string |
Last updated by. |
|
integer or null |
Update time. |
|
string or null |
error message. |
|
string |
Management status. Value: |
|
string |
Old source information. Value: |
|
array of object |
Processing tasks created for the source. |
|
string |
Process task ID. |
|
string |
Source ID. |
|
integer |
Model ID. |
|
string |
Processing task type. Values: |
|
string |
Handle task status. Values: |
|
string |
Idempotent request key. |
|
string |
Operation ID. |
|
string |
workflow execution ID. |
|
string |
Source file ID. |
|
string |
knowledge base file ID. |
|
integer |
Source table ID. |
|
integer |
knowledge base table ID. |
|
integer |
Number of retries. |
|
integer |
Next retry time. |
|
string |
error message. |
|
integer |
Creation time. |
|
integer |
Update time. |
|
boolean |
Whether the processing status needs to be repaired. |
Error response¶
{
"code": "ErrParamInvalid",
"msg": "Bad Request"
}
Field |
Type |
Description |
|---|---|---|
|
string |
error code. |
|
string |
Error description. |