Phase II of AI Assistant, Q\\\&A API
Operation description
Precautions
-
Before using this interface, please make sure you fully understand the billing method and pricing of the Intelligent Media Management product.
-
Before calling this interface, ensure that you have indexed the files into the dataset (Dataset) through binding ( CreateBinding ) or active indexing ( IndexFileMeta or BatchIndexFileMeta ).
-
The returned result is only an example. Depending on the workflow template configuration, the categories and content of the file metadata information obtained may differ from the example. If you have any questions, please join the DingTalk group by searching for the group number 21714099 in DingTalk.
Usage Restrictions
-
The maximum length of the historical conversation is 100, including both user and assistant messages.
-
Each message should not exceed 1000 Chinese characters.
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- For mandatory resource types, indicate with a prefix of * .
- If the permissions cannot be granted at the resource level,
All Resourcesis used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
| Operation | Access level | Resource type | Condition key | Associated operation |
|---|---|---|---|---|
| imm:ContextualAnswer | none | *All Resources * |
| none |
Request parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| ProjectName | string | Yes | Project name. For how to obtain it, see Creating a Project. | test-project |
| Messages | array | Yes | Yes, the history of conversations and tool invocations. The latest message is at the end (index n-1), and the oldest message is at the beginning (index 0). It must be in the form of user-assistant pairs, with a total count of 2*n+1, and the length of the latest question should not exceed 1000 characters. The length of the historical conversation is limited to 100. | |
| ContextualMessage | Yes | List of conversation messages | ||
| Files | array | No | The content of the files involved in the current Q&A. It is recommended to use the return value of the ContextualRetrieval interface as input. | |
| ContextualFile | No | List of files involved in the Q&A |
Response parameters
Examples
Sample success responses
JSONformat
{
"RequestId": "22F081FB-90D7-525A-BFE4-D28DC906A28F",
"Answer": {
"Content": "Hello",
"References": [
{
"ProjectName": "test-project",
"DatasetName": "test-dataset",
"ObjectId": "75d5de2c50754e3dadd5c35dbca5f9949369e37eb342a73821f690c94c36c7f7",
"URI": "oss://test-bucket/test-object.jpg"
}
]
},
"Code": "ResourceNotFound",
"Message": "The specified resource project is not found."
}Error codes
For a list of error codes, visit the Service error codes.
Change history
| Change time | Summary of changes | Operation |
|---|---|---|
| 2025-01-02 | The response structure of the API has changed | View Change Details |
