RunCommentGeneration
Predicts user comments for a specified article.
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:RunCommentGeneration | get | *All Resource
| None | None |
Request syntax
POST /quanmiao/aimiaobi/runCommentGeneration HTTP/1.1
Request parameters
Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| WorkspaceId | string | Yes | Path parameter. The unique identifier of your Alibaba Cloud Model Studio workspace. To get this ID, see Get the workspace ID. | llm-3kcs1w3lltrtbfkr |
| SessionId | string | No | Session ID. | 3f7045e099474ba28ceca1b4eb6d6e21 |
| Length | string | No | Length of each comment in characters. | 20 |
| NumComments | string | Yes | Number of comments to generate. | 10 |
| Style | string | No | Tone of the comments. | 积极正面 |
| SourceMaterial | string | Yes | Article to comment on. | ps5是sony新一代的游戏机,他创新性的... |
| AllowEmoji | boolean | No | Set to true to allow emoji in comments. Default is false. | true |
| Type | object | Yes | Comment type. Valid keys:
| {"emotion":"50","opinion":"50"} |
| Sentiment | object | Yes | Sentiment distribution. Valid keys:
| {"positive":"50","negative":"50"} |
| LengthRange | object | Yes | Length distribution. Valid keys:
| {"short":"50","long":“50”} |
| ExtraInfo | string | No | Additional instructions. | 不要输出额外其他信息 |
| ModelId | string | No | ID of the model to use. | quanmiao-max、quanmiao-plus |
Response elements
Element | Type | Description | Example |
|---|---|---|---|
object | Response schema. | ||
| RequestId | string | Request ID. | 3f7045e099474ba28ceca1b4eb6d6e21 |
| End | boolean | Indicates whether the response is complete. | |
| Header | object | Response header. | |
| Event | string | Event name. | result-generated |
| EventInfo | string | Event description. | 可空 |
| RequestId | string | Request ID. | 1813ceee-7fe5-41b4-87e5-982a4d18cca5 |
| SessionId | string | Session ID. | 3f7045e099474ba28ceca1b4eb6d6e21 |
| TaskId | string | Task ID. | 3f7045e099474ba28ceca1b4eb6d6e21 |
| TraceId | string | Trace ID. | 0bd58ea2-dc38-45da-ac02-17f05cb9040b |
| Payload | object | Response body. | |
| Output | object | Output data. | |
| Text | string | Generated comment text. | 评论内容 |
| Usage | object | Token usage. | |
| InputTokens | integer | Number of input tokens used. | 1 |
| OutputTokens | integer | Number of output tokens used. | 2 |
| TotalTokens | integer | Total number of tokens used. | 3 |
Examples
Success response
JSON format
{
"RequestId": "3f7045e099474ba28ceca1b4eb6d6e21",
"End": false,
"Header": {
"Event": "result-generated\n",
"EventInfo": "可空\n",
"RequestId": "1813ceee-7fe5-41b4-87e5-982a4d18cca5",
"SessionId": "3f7045e099474ba28ceca1b4eb6d6e21",
"TaskId": "3f7045e099474ba28ceca1b4eb6d6e21",
"TraceId": "0bd58ea2-dc38-45da-ac02-17f05cb9040b"
},
"Payload": {
"Output": {
"Text": "评论内容"
},
"Usage": {
"InputTokens": 1,
"OutputTokens": 2,
"TotalTokens": 3
}
}
}
Error codes
HTTP status code | Error code | Error message | Description |
|---|---|---|---|
| 403 | NoPermission | You are not authorized to perform this action. | Please check the workspaceId assignment |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.