All Products
Search
Document Center

:ContextualAnswer

Last Updated:Jan 19, 2026
This topic is generated by a machine translation engine without any human intervention. ALIBABA CLOUD DOES NOT GUARANTEE THE ACCURACY OF MACHINE TRANSLATED CONTENT. To request a human-translated version of this topic or provide feedback on this translation, please include it in the feedback form.

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

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

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 Resources is 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.
OperationAccess levelResource typeCondition keyAssociated operation
imm:ContextualAnswernone
*All Resources
*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
ProjectNamestringYes

Project name. For how to obtain it, see Creating a Project.

test-project
MessagesarrayYes

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.

ContextualMessageYes

List of conversation messages

FilesarrayNo

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.

ContextualFileNo

List of files involved in the Q&A

Response parameters

ParameterTypeDescriptionExample
object

Schema of Response

RequestIdstring

Request ID of the current request.

22F081FB-90D7-525A-BFE4-D28DC906A28F
AnswerAnswer

Content of the response from the large model.

Codestring

Error code.

ResourceNotFound
Messagestring

Error message.

The specified resource project is not found.

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 timeSummary of changesOperation
2025-01-02The response structure of the API has changedView Change Details