Create knowledge base

Create the knowledge base of the resource center to support compatibility with old source configuration through tables and files parameters. Data sources and semantic entries can be added individually after creation.

HTTP
POST $CLOUDSIGMA_API_BASE/semantic-models

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

Shell
curl -X POST "$CLOUDSIGMA_API_BASE/semantic-models" \
  -H "X-API-Key: $CLOUDSIGMA_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "<KNOWLEDGE_BASE_NAME>",
    "description": "<DESCRIPTION>",
    "tables": []
  }'

Field

Type

Required

Description

name

string

Yes

The knowledge base name must be non-empty and contain at most 255 Unicode characters. It cannot contain leading or trailing spaces. See below for character rules.

description

string

No

Coverage and instructions for use.

tables

array of object

No

Compatible legacy table source definitions. For new access sources, please use the add data source interface.

files

object

No

Compatible legacy file source configuration. For new access sources, please use the add data source interface.

tables[].db_name

string

Conditional

The name of the database where the table comes from.

tables[].table_names

array of string

Conditional

The name of the table in the database to be included in the knowledge base.

files.file_ids

array of string

No

File ID. The server does not retain this field when creating the knowledge base. You should use the add data source interface instead.

files.parents

array of string

No

The parent path of the file source.

files.volume_ids

array of string

No

The volume ID from which the file originated.

files.volumes

array of object

No

File source volume and path.

files.vector_table

string

No

Vector table name. The server can complete the default value.

files.embedding_model

string

No

Embedding model identifier. The server can complete the default value.

files.tags

array of string

No

File source tag.

files.volumes[].volume_id

string

Conditional

Volume ID.

files.volumes[].parents

array of string

No

The parent path of the volume source.

files.volumes[].path

array of string

No

File path within the volume.

The name follows Catalog naming rules. The first character supports lowercase letters, numbers, underscores or Chinese characters. Subsequent characters also support hyphen (-) and dot (.). For example product_docs, 产品资料. Capital letters, spaces, or slashes cannot be used (/). The name cannot be modified after it is created.

Successful response

JSON
{
  "code": "OK",
  "msg": "OK",
  "data": {
    "id": 401,
    "name": "product_docs",
    "description": "产品文档",
    "tables": [],
    "source_counts": {
      "files": 0,
      "tables": 0,
      "total": 0
    },
    "created_at": 1735632000,
    "updated_at": 1735632000
  }
}

Field

Type

Description

code

string

OK on success.

msg

string

OK on success.

data

object

response data.

data.id

integer

New knowledge base ID.

data.name

string

The name of the created knowledge base.

data.description

string

Saved description. May be omitted if not set.

data.tables

array of object

Compatible legacy table source definitions.

data.files

object

Compatible legacy file source definitions.

data.source_counts

object

Create source count in snapshot. The empty knowledge base items are 0.

data.created_at

integer

Unix timestamp.

data.updated_at

integer

Unix timestamp.

data.tables[].db_name

string

The name of the database where the table comes from.

data.tables[].table_names

array of string

The name of the table included in the knowledge base in this database.

data.files.file_ids

array of string

File ID.

data.files.parents

array of string

The parent path of the file source.

data.files.volume_ids

array of string

The volume ID from which the file originated.

data.files.volumes

array of object

File source volume and path.

data.files.vector_table

string

Vector table name.

data.files.embedding_model

string

Embedding model identifier.

data.files.tags

array of string

File source tag.

data.files.volumes[].volume_id

string

Volume ID.

data.files.volumes[].parents

array of string

The parent path of the volume source.

data.files.volumes[].path

array of string

File path within the volume.

data.source_counts.files

integer

Number of file sources.

data.source_counts.tables

integer

Table source number.

data.source_counts.total

integer

Total number of sources.

Error response

JSON
{
  "code": "ErrParamInvalid",
  "msg": "name is required",
  "data": null
}

Field

Type

Description

code

string

error code.

msg

string

Error description.

data

null

null on error.

Last updated on