Verify semantic entries¶
Verify whether the current knowledge base and its semantic entries comply with the server contract.
POST https://moi.matrixorigin.cn/newmoi/semantic-models/{model_id}/validate
Preparation before calling¶
First query the knowledge base list to obtain the knowledge base ID. 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: Knowledge base ID to be verified.
Request example¶
curl -X POST "https://moi.matrixorigin.cn/newmoi/semantic-models/$MODEL_ID/validate" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID"
Path parameters¶
Parameters |
Type |
Description |
|---|---|---|
|
integer |
The ID of the knowledge base to be verified. |
Successful response¶
Returns 200 on success. HTTP is successful but data.valid is false, indicating that the model has not passed business verification; press errors to correct the entry or source and call again.
{
"code": "OK",
"msg": "OK",
"data": {
"valid": false,
"errors": ["entry total_rows is invalid"]
}
}
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
|
string |
|
|
string |
|
|
boolean |
Whether the current knowledge base passes the server-side verification. |
|
string[] |
Error list when verification fails; may be omitted or empty when verification passes. |
[] after a type means an array. For example, string[] is an array of strings.
Error response¶
{
"code": "ErrNotFound",
"msg": "resource not found",
"data": null
}
Common HTTP errors¶
HTTP status code |
error code |
Common causes |
Recommended actions |
|---|---|---|---|
|
|
|
Use the knowledge base ID from the response. |
|
|
The API Key is invalid or has expired. |
Check API Key. |
|
|
The caller does not have permission to use the knowledge base. |
Check workspace and object authorization. |
|
|
The knowledge base does not exist or is not visible. |
Reconfirm |
|
|
The service failed to perform verification. |
Keep the desensitized response information and try again. |
Follow-up operations¶
After pressing errors to correct it, Query semantic entries confirms the entry definition, and then calls this interface again.