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 theX-API-KeyHeader.$WORKSPACE_ID: Target workspace ID, passed throughX-Workspace-IDHeader.$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 |
|---|---|---|
|
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 |
|---|---|---|---|
|
string |
Yes |
The name of the current knowledge base. The value is immutable and must be consistent with the created name. |
|
string |
No |
Updated knowledge base description. |
|
JSON |
No |
Compatible legacy table source definition. |
|
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 |
|---|---|---|
|
string |
|
|
string |
|
|
boolean |
|
Error response¶
{
"code": "ErrNotFound",
"msg": "resource not found",
"data": null
}
Common HTTP errors¶
HTTP status code |
error code |
Common causes |
Recommended actions |
|---|---|---|---|
|
|
|
Using a valid ID, return the current name and submit a complete and valid update definition. |
|
|
The API Key is invalid or has expired. |
Check API Key. |
|
|
The caller does not have permission to update the knowledge base. |
Check workspace and object authorization. |
|
|
The knowledge base does not exist or is not visible to the current caller. |
Relist the knowledge base and confirm the ID. |
|
|
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.