Streaming polishing skill draft¶
Submit the skill draft and receive the polish event sent by the server; the result event contains the skill content that can be saved.
POST https://moi.matrixorigin.cn/newmoi/workspaces/{workspace_id}/skills/polish/stream
Before you call¶
Prepare personal access tokens, workspace IDs, and draft skills to be polished. The response type is text/event-stream.
The example below uses:
$AI_STUDIO_API_KEY: Actual personal access token.$WORKSPACE_ID: Target workspace ID.
Request example¶
curl -N -X POST "https://moi.matrixorigin.cn/newmoi/workspaces/$WORKSPACE_ID/skills/polish/stream" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H 'Content-Type: application/json' \
-d '{
"name": "摘要",
"description": "生成内容摘要",
"instruction": "总结输入内容"
}'
Request body¶
Parameters |
Type |
Is it required |
Description |
|---|---|---|---|
|
string |
Yes |
Skill name. |
|
string |
Yes |
Skill command to be polished. |
|
string |
Yes |
Skill description. |
|
object |
No |
Structured skill command. |
|
string |
No |
Command text. |
|
object |
No |
JSON Schema of the directive variable. |
|
string |
No |
Input requirement. |
|
string |
No |
Output format. |
|
string |
No |
Skill classification. |
|
string[] |
No |
Skill tag. |
|
string |
No |
Skill stage. |
|
string[] |
No |
Pipeline step. |
|
string |
No |
Pipeline reference. |
|
string |
No |
Skill source type. |
|
string |
No |
Skill source reference. |
|
object |
No |
Route summary. |
|
object |
No |
Skill dependency requirement. |
|
object |
No |
JSON Schema of the input parameter. |
|
object |
No |
Output contract. |
|
object |
No |
String label. |
|
object |
No |
String annotation. |
|
object |
No |
Extended metadata. |
[] after a type denotes an array. [] in a field path denotes each item in an array.
Successful response¶
Returns the event stream on success. Each event consists of a event: line, a single line of JSON for the data: line, and a blank line. The result event contains the verified skill draft, and done indicates the end of the flow.
event: started
data: {"request_id":"req_01","prompt_version":"skill_polish_v1"}
event: delta
data: {"request_id":"req_01","content":"请总结输入内容"}
event: ping
data: {"request_id":"req_01","timestamp":"2026-08-21T07:00:00Z"}
event: result
data: {"request_id":"req_01","result":{"name":"摘要","description":"摘要技能","instruction":"请总结输入内容","tags":[]}}
event: error
data: {"request_id":"req_01","error":{"code":"INVALID_DRAFT","message":"The skill draft is invalid.","retryable":false}}
event: done
data: {"request_id":"req_01"}
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
SSE event name |
string |
The event type in the |
|
string |
ID of this polishing request. |
|
string |
|
|
string |
The incremental text in the |
|
string |
RFC 3339 time in the |
|
object |
The verified skill draft in the |
|
string |
Skill name. |
|
string |
Skill description. |
|
string |
Polished skill command. |
|
object |
Structured skill command; does not return if not set. |
|
string |
Input requirement; does not return if not set. |
|
string |
Output format; does not return if not set. |
|
string |
Skill classification; does not return if not set. |
|
string[] |
Skill tag. |
|
string |
Skill stage; does not return if not set. |
|
string[] |
Pipeline step; does not return if not set. |
|
string |
Pipeline reference; does not return if not set. |
|
string |
Skill source type; does not return if not set. |
|
string |
Skill source reference; does not return if not set. |
|
object |
Route summary; not returned if not set. |
|
object |
Skill dependency requirements; not returned if not set. |
|
object |
JSON Schema of the input parameter; does not return if not set. |
|
object |
Output contract; does not return if not set. |
|
object |
String label; does not return if not set. |
|
object |
String annotation; does not return if not set. |
|
object |
Extended metadata; not returned if not set. |
|
string[] |
Things that still need to be confirmed; do not return if not. |
|
string[] |
Polishing warning; does not return if there is none. |
|
object |
Public error message in the |
|
string |
Error code within the stream. |
|
string |
In-stream error description. |
|
boolean |
Whether it is possible to retry. |
[] after a type denotes an array. [] in a field path denotes each item in an array.
Error response¶
After the stream has started, a processing error is returned via the SSE error event, followed by done:
event: error
data: {"request_id":"req_01","error":{"code":"INVALID_DRAFT","message":"The skill draft is invalid.","retryable":false}}
event: done
data: {"request_id":"req_01"}
Request errors before the stream is established with a plain JSON response:
{
"code": 2,
"message": "invalid argument"
}
Common HTTP errors¶
HTTP status code |
error code |
Common causes |
Recommended actions |
|---|---|---|---|
|
|
The JSON is invalid, or the skill draft fails the validation before creating the event stream. |
Check the request body and required fields. |
|
|
Skill polish service is not configured. |
Try again later. |
After the event stream is established, errors such as NO_AVAILABLE_MODEL and MODEL_REQUEST_FAILED are located in the SSE error event and no longer change the HTTP status code.