RunAiHelperWriting
MiaoBi: AI-assisted writing
Operation description
QuanMiao products support iframe embedding. For more information, see QuanMiao Public Cloud iframe Customization for Customer Onboarding.
Try it now
Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.
RAM authorization
The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:
-
Action: The actions can be used in the
Actionelement of RAM permission policy statements to grant permissions to perform the operation. -
API: The API that you can call to perform the action.
-
Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.
-
Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.
- For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the
Resourceelement of the policy. - For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the
Resourceelement of the policy.
- For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the
-
Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.
-
Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.
Action | Access level | Resource type | Condition key | Dependent action |
|---|---|---|---|---|
aimiaobi:RunAiHelperWriting | create | *All Resource
| None | None |
Request syntax
POST /quanmiao/aimiaobi/runAiHelperWriting HTTP/1.1
Request parameters
Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| WorkspaceId | string | Yes | The workspace ID. | llm-xxxxx |
| WritingScene | string | Yes | The writing scenario. Valid values: government, media, market, office, and custom. | media |
| WritingStyle | string | Yes | The unique key for the writing style. Call the ListWritingStyles operation to get a list of styles for the specified scenario. | Notification |
| Prompt | string | Yes | The prompt, which specifies the subject for the AI to write about. | Please write an article about the development trends of artificial intelligence |
| PromptMode | string | No | The prompt pattern. For example, PE indicates the advanced pattern and Template indicates the template pattern. | Template |
| DistributeWriting | boolean | No | Specifies whether to generate the text step by step. | false |
| WritingParams | object | No | The writing parameters from the previous form, specified as key-value pairs. | {"wordCount": "1000", "tone": "formal"} |
string | No | The key and value of the writing parameter. | {"topic":"writing topic"} |
Sample data
{
"WorkspaceId": "llm-xxx",
"WritingScene": "office",
"WritingStyle": "speech",
"Prompt": "A speech on the topic of 'AI Ethics and Social Impact'"
}
Response elements
Element | Type | Description | Example |
|---|---|---|---|
object | Schema of Response | ||
| Header | object | The Server-Sent Events (SSE) response header. | |
| ErrorCode | string | The error code. | InvalidParameter |
| ErrorMessage | string | The error message. | Invalid parameter |
| Event | string | The event type. | result-generated |
| SessionId | string | The session ID. | session-xxxxx |
| StatusCode | integer | The status code. | 200 |
| TaskId | string | The task ID. | task-xxxxx |
| TraceId | string | Trace ID | 1813ceee-7fe5-41b4-87e5-982a4d18cca5 |
| Payload | object | The response payload. | |
| Output | object | The output content. | |
| Text | string | The generated text. | AI is profoundly changing our lives... |
| WritingParams | object | The writing parameters for the AI-assisted writing. | {"wordCount": "1000"} |
string | A key-value pair. | {"topic":"writing topic xxx"} | |
| Usage | object | The token usage. | |
| InputTokens | integer | The number of input tokens. | 256 |
| OutputTokens | integer | The number of output tokens. | 1024 |
| TotalTokens | integer | The total number of tokens. | 1280 |
| RequestId | string | The request ID. | 1813ceee-7fe5-41b4-87e5-982a4d18cca5 |
| HttpStatusCode | string | The HTTP status code. | 200 |
| Code | string | The business status code. | successful |
| Message | string | The returned message. | success |
| Success | boolean | Indicates whether the request was successful. | true |
Examples
Success response
JSON format
{
"Header": {
"ErrorCode": "InvalidParameter",
"ErrorMessage": "参数错误",
"Event": "result-generated",
"SessionId": "session-xxxxx",
"StatusCode": 200,
"TaskId": "task-xxxxx",
"TraceId": "1813ceee-7fe5-41b4-87e5-982a4d18cca5"
},
"Payload": {
"Output": {
"Text": "人工智能正在深刻改变我们的生活...",
"WritingParams": {
"key": "{\"topic\":\"写作主题xxx\"}"
}
},
"Usage": {
"InputTokens": 256,
"OutputTokens": 1024,
"TotalTokens": 1280
}
},
"RequestId": "1813ceee-7fe5-41b4-87e5-982a4d18cca5",
"HttpStatusCode": "200",
"Code": "successful",
"Message": "success",
"Success": true
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.