RunTranslateGeneration
Translates text for content creation using AMB.
Debug
You can run this API directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After a successful run, OpenAPI Explorer can automatically generate SDK code examples.
Authorization information
The following table describes the authorization information of the API. You can use it in the Action element of a RAM permission policy statement to grant a RAM user or RAM role the permission to call this API. Details are as follows:
-
Operation: the specific permission point.
-
Access level: the access level of each operation. Valid values: Write, Read, or List.
-
Resource type: the resource types that support authorization for the operation. Details are as follows:
- Required resource types are marked with a leading asterisk (*).
- For operations that do not support resource-level authorization,
All Resourcesis used.
-
Condition key: the condition keys defined by the cloud service itself.
-
Dependent operation: other permissions required to successfully perform the operation. The caller must also have the permissions of the dependent operations for the operation to succeed.
| Operation | Access level | Resource type | Condition key | Dependent operation |
|---|---|---|---|---|
| aimiaobi:RunTranslateGeneration | create | *All Resources * |
| None |
Request syntax
POST /quanmiao/aimiaobi/runTranslateGeneration HTTP/1.1
Request parameters
| Name | Type | Required | Description | Example | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| WorkspaceId | string | Yes | The unique ID of the Alibaba Cloud Model Studio workspace. For more information, see Workspace ID | llm-xxx | ||||||||||||||||||||
| ReferenceData | object | Yes | The data required for generation | |||||||||||||||||||||
| Contents | array | Yes | The list of content | |||||||||||||||||||||
| string | Yes | The content | xxx | |||||||||||||||||||||
| TaskId | string | No | Optional. The unique ID of the associated creative article Note You do not need to specify TaskId. The system generates one automatically. If the TaskId of subsequent tasks is the same, these tasks belong to the same conversation group. | xxx | ||||||||||||||||||||
| Prompt | string | Yes | The supported target languages for translation (the source language is automatically detected by the system)
| English |
Response parameters
| Name | Type | Description | Example |
|---|---|---|---|
| object | Schema of Response | ||
| Header | object | Response header | |
| ErrorCode | string | The error code | AccessForbid |
| ErrorMessage | string | The error message. | xx |
| Event | string | The SSE event. | task-failed |
| SessionId | string | The session ID | 91C2B2B8-7D12-4A8D-A724-1E576D30C096 |
| TaskId | string | The task ID | 3f7045e099474ba28ceca1b4eb6d6e21 |
| TraceId | string | The trace ID | 0abb781d17146157564845243e20b5 |
| Payload | object | Response body | |
| Output | object | Output | |
| Text | string | The text generation result | xx |
| Usage | object | Token usage | |
| InputTokens | long | The number of tokens used for the input | 1 |
| OutputTokens | long | The number of tokens used for the output | 1 |
| TotalTokens | long | The total number of tokens used in this call | 2 |
| RequestId | string | The unique request ID | DA021073-17CE-5CCF-9FEB-93226C766887 |
Examples
Success response example
JSON format
{
"Header": {
"ErrorCode": "AccessForbid",
"ErrorMessage": "xx",
"Event": "task-failed",
"SessionId": "91C2B2B8-7D12-4A8D-A724-1E576D30C096",
"TaskId": "3f7045e099474ba28ceca1b4eb6d6e21",
"TraceId": "0abb781d17146157564845243e20b5"
},
"Payload": {
"Output": {
"Text": "xx"
},
"Usage": {
"InputTokens": 1,
"OutputTokens": 1,
"TotalTokens": 2
}
},
"RequestId": "DA021073-17CE-5CCF-9FEB-93226C766887"
}
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 |
Visit the Error Center to view more error codes.