Update knowledge base

Update knowledge base description or compatible legacy source field. The knowledge base name cannot be modified after it is created; the current name must be returned when updating. Please use a separate data source interface for new access sources.

PUT https://moi.matrixorigin.cn/newmoi/semantic-models/{model_id}

Preparation before calling

First query the knowledge base details to confirm the current definition. Prepare a personal access token and target workspace ID that has access to the target workspace.

The example below uses:

  • $AI_STUDIO_API_KEY: The actual personal access token, passed through the X-API-Key Header.

  • $WORKSPACE_ID: Target workspace ID, passed through X-Workspace-ID Header.

  • $MODEL_ID: ID of the knowledge base to be updated.

Request example

curl -X PUT "https://moi.matrixorigin.cn/newmoi/semantic-models/$MODEL_ID" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "$CURRENT_KNOWLEDGE_BASE_NAME",
    "description": "$DESCRIPTION"
  }'

Path parameters

Parameters

Type

Description

model_id

integer

Knowledge base ID.

Request body

Submit the current complete name, and you can submit description and the interface-compatible tables, files source definitions at the same time.

Field

Type

Required

Description

name

string

Yes

The name of the current knowledge base. The value is immutable and must be consistent with the created name.

description

string

No

Updated knowledge base description.

tables

JSON

No

Compatible legacy table source definition.

files

JSON

No

Compatible legacy file source definition.

Successful response

Returns 200 on success. The interface returns a confirmation tag; if you need to read the updated complete object, please call the query knowledge base details interface again.

{
  "code": "OK",
  "msg": "OK",
  "data": {
    "updated": true
  }
}

The response fields are as follows.

Field

Type

Description

code

string

OK on success.

msg

string

OK on success.

data.updated

boolean

true indicates that the update request has been accepted and completed by the server.

Error response

{
  "code": "ErrNotFound",
  "msg": "resource not found",
  "data": null
}

Common HTTP errors

HTTP status code

error code

Common causes

Recommended actions

400

ErrParamInvalid

model_id, JSON request body or required name is invalid, or name is different from the current name.

Using a valid ID, return the current name and submit a complete and valid update definition.

401

ErrUnauthorized

The API Key is invalid or has expired.

Check API Key.

403

ErrForbidden

The caller does not have permission to update the knowledge base.

Check workspace and object authorization.

404

ErrNotFound

The knowledge base does not exist or is not visible to the current caller.

Relist the knowledge base and confirm the ID.

500

ErrServer

The service failed to complete the update.

Keep the desensitized response information and try again.

Follow-up operations

Query knowledge base details to confirm the update result.

Last updated on