Query knowledge base details¶
Query model definitions and source quantities by knowledge base ID. You should use this interface to confirm the current status before updating or deleting.
GET https://moi.matrixorigin.cn/newmoi/semantic-models/{model_id}
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: ID of the knowledge base to be queried.
Request example¶
curl "https://moi.matrixorigin.cn/newmoi/semantic-models/$MODEL_ID" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID"
Path parameters¶
Parameters |
Type |
Description |
|---|---|---|
|
integer |
Knowledge base ID. |
Successful response¶
Returns 200 on success. data is the knowledge base definition and source number.
{
"code": "OK",
"msg": "OK",
"data": {
"id": 401,
"name": "product_docs",
"description": "产品文档",
"tables": [],
"files": [],
"source_counts": {
"files": 2,
"tables": 1,
"total": 3
},
"created_at": 1735632000,
"updated_at": 1735718400
}
}
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
|
string |
|
|
string |
|
|
integer |
Knowledge base ID. |
|
string |
Knowledge base name. |
|
string |
Knowledge base description; may be omitted if not set. |
|
JSON |
Compatible legacy table source definition. |
|
JSON |
Compatible legacy file source definition; may be omitted if not set. |
|
object |
The current number of sources. |
|
integer |
Number of file sources. |
|
integer |
Number of table sources. |
|
integer |
Total number of sources. |
|
integer |
Unix timestamp. |
|
integer |
Unix timestamp. |
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 |
|
|
The API Key is invalid or has expired. |
Check API Key. |
|
|
The caller does not have permission to read 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 read the knowledge base. |
Keep the desensitized response information and try again. |
Follow-up operations¶
When you need to modify attributes, Update knowledge base; when accessing data, Add data source.