GenDocQaResult
Parses question and answer (Q&A) pairs from a document. You can use the UpdateQaLibrary API to update the Q&A pairs.
Operation description
Before you use this API, make sure you understand the billing methods and pricing of the Tongyi Dianjin product.
Prerequisites
You have activated Alibaba Cloud Model Studio and the Tongyi Dianjin service.
Obtain the workspaceId: Obtain the workspace identifier.
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 for this API. You can use it in the Action element of a RAM policy statement to grant RAM users or RAM roles the permission to call this API. Details are as follows:
-
Action: the specific permission point.
-
Access level: the access level of each action. Valid values: Write, Read, or List.
-
Resource type: the resource types that support authorization for the action. Details are as follows:
- For required resource types, an asterisk (*) is added as a prefix.
- For actions that do not support resource-level authorization,
All resourcesis used.
-
Condition key: the condition keys defined by the cloud service itself.
-
Related action: other permissions required to successfully perform the action. The caller must also have the permissions of the related actions for the operation to succeed.
| Action | Access level | Resource type | Condition key | Related action |
|---|---|---|---|---|
| dianjin:GenDocQaResult | create | *All resources * |
| None |
Request syntax
POST /{workspaceId}/api/virtualHuman/qa/parse HTTP/1.1
Request parameters
| Name | Type | Required | Description | Example value |
|---|---|---|---|---|
| workspaceId | string | Yes | The workspace ID. | llm-xxxxx |
| body | object | No | The request body. | |
| docId | string | Yes | The document ID. | 182364872346 |
| libraryId | string | Yes | The document library ID. | sjdgdsfg |
| requestId | string | Yes | The request ID. The request ID serves as the unique identifier of the request. The first request initiates the Q&A parsing. Subsequent requests with the same request ID query the parsing status and results. | 0FC6636E-380A-5369-AE01-D1C15BB9B254 |
Response parameters
| Name | Type | Description | Example value |
|---|---|---|---|
| object | The Q&A pair. | ||
| success | boolean | Indicates whether the request was successful. | true |
| dataType | string | The data type. | null |
| time | string | The timestamp. | 2024-04-24 11:54:34 |
| errCode | string | The error code. | 0 |
| message | string | The error message. | ok |
| data | object | The response data. | |
| libraryId | string | The document library ID. | 7wxwrjpabj |
| docId | string | The document ID. | 873648346573245 |
| currentStatus | string | The current status[INIT (initialization),PROCESSING (in progress),COMPLETED (completed),FAIL (failed)] | PROCESSING |
| parseQaResults | array<object> | The Q&A results of the parsing. | |
| parseQaResult | object | ||
| question | string | The question. | 今天的天气怎么样? |
| answer | string | The answer. | 今天的天气不错,多云转晴。 |
| requestId | string | The request ID. | 44BD277A-87F9-5310-8D63-3E6645F1DA85 |
| cost | long | The time consumed. | null |
Examples
Success response
JSON format
{
"success": true,
"dataType": null,
"time": "2024-04-24 11:54:34",
"errCode": 0,
"message": "ok",
"data": {
"libraryId": "7wxwrjpabj",
"docId": 873648346573245,
"currentStatus": "PROCESSING",
"parseQaResults": [
{
"question": "今天的天气怎么样?",
"answer": "今天的天气不错,多云转晴。\n"
}
]
},
"requestId": "44BD277A-87F9-5310-8D63-3E6645F1DA85",
"cost": 0
}
Error codes
Visit the Error Center to view more error codes.
Change history
| Change time | Change summary | Operation |
|---|
No change history yet.