RunDocQa - Answer questions about articles and multimodal files

Updated at:

Article question answering: answers a natural language query using specified articles, with images when available and source information. Multimodal file question answering: answers a natural language query using specified multimodal files, with related images, video clips, or text and source information.

Try it out

You can call this operation in OpenAPI Explorer without calculating a signature. After a successful call, OpenAPI Explorer can automatically generate SDK code examples.

Try it out

Authorization information

The following table describes the authorization information for this API operation. You can use this information in the Action element of a RAM policy statement to grant a RAM user or RAM role permission to call the operation. The columns are described as follows:

  • Action: a specific permission.

  • Access level: the access level of an action. Valid values: Write, Read, and List.

  • Resource type: the types of resources for which the action supports authorization:

    • Required resource types are marked with an asterisk (*).
    • Actions that do not support resource-level authorization use All resources.
  • Condition key: a condition key defined by the cloud service.

  • Dependent action: an additional permission required to perform the action. The caller must also have permission to perform the dependent action.

ActionAccess levelResource typeCondition keyDependent action
aimiaobi:RunDocQaget
*All resources
*
    None
None

Request syntax

POST /miaodu/stream/runDocQA HTTP/1.1

Request parameters

NameTypeRequiredDescriptionExample value
WorkspaceIdstringYes

The Alibaba Cloud Model Studio workspace ID. For information about how to obtain it, see Use workspaces.

llm-dswd4003ny4gh9rw
SearchSourcestringYes

The search source

Valid values:
  • fromIndexLib: answers questions based on the entire document library.
  • fromWeb: answers questions based on web search results.
  • fromRefContent: answers questions based on the ReferenceContent field.
  • fromDoc: answers questions based on the specified document IDs.
fromWeb
DocIdsarrayNo

The array of document IDs

stringNo

The document ID

10022
QuerystringYes

The question

When will the iPhone 16 be released?
ReferenceContentstringNo

The relevant content provided by the questioner

The relevant content
ConversationContextsarray<object>No

The array of conversation history content

objectNo

The conversation history

ContentstringNo

The question and answer content

The question and answer content
RolestringNo

The role

user
SessionIdstringYes

The conversation ID

f486c4e2-b773-4d65-88f8-2ba540610456
CategoryIdsarrayNo

The array of directory IDs used for filtering. This parameter takes effect only when SearchSource is fromIndexLib

stringNo

The category ID

default
ModelNamestringNo

The user-defined model name

quanmiao-max, quanmiao-plus

Response parameters

NameTypeDescriptionExample value
object

Schema of Response

Headerobject

The response header

ErrorCodestring

The error code

success
ErrorMessagestring

The error message

success
Eventstring

The event

task-started
EventInfostring

The event description

A model generation event
SessionIdstring

The session ID

f5517ee8-dbec-4dc8-bd0a-af084b5e3db1
TaskIdstring

The task ID

3f7045e099474ba28ceca1b4eb6d6e21
TraceIdstring

The end-to-end trace ID

46e5c2b5-0877-4f09-bd91-ab0cf314e48b
Payloadobject

The response body

Outputobject

The output

Contentstring

The answer content

The answer content
InterveneContentstring

The answer content after intervention

The answer content after intervention
IsRejectboolean

Indicates whether the request was rejected

false
MediaUrlListarray<object>

The list of multimodal resources

mediaUrlListobject

The multimodal resource object

ClipInfosarray<object>

The array of time information for related video segments

clipInfosobject

The time information for a related video segment

Fromdouble

The start time of the video segment

0
Todouble

The end time of the video segment

30
FileUrlstring

The file URL

https://gw.alicdn.com/imgextra/i3/2775676850/O1CN01kdeffE20TM0E7wvpq_!!2775676850.jpg_q60.jpg
MediaTypestring

The media asset type

video
Recommendsarray<object>

The array of recommended content

recommendsobject

The recommended content

Titlestring

The title of the recommended content

The title content
Urlstring

The URL of the recommended content

The URL of the recommended content
Referencesarray<object>

The array of answer sources

referencesobject

The answer source

PubTimestring

The publication time

2024-10-08 18:00
Sourcestring

The source

Sina News
SourceDocIdstring

The source docId

123456
Titlestring

The title of the relevant content

The title content
Urlstring

The article URL

http://xxxxx
Usageobject

The token usage

InputTokenslong

The number of input tokens

100
OutputTokenslong

The number of output tokens

100
TotalTokenslong

The total number of tokens

200
RequestIdstring

The request ID

1813ceee-7fe5-41b4-87e5-982a4d18cca5

Examples

Sample success response

JSON format

{
  "Header": {
    "ErrorCode": "success",
    "ErrorMessage": "success",
    "Event": "task-started",
    "EventInfo": "模型生成事件",
    "SessionId": "f5517ee8-dbec-4dc8-bd0a-af084b5e3db1",
    "TaskId": "3f7045e099474ba28ceca1b4eb6d6e21",
    "TraceId": "46e5c2b5-0877-4f09-bd91-ab0cf314e48b"
  },
  "Payload": {
    "Output": {
      "Content": "回答内容",
      "InterveneContent": "干预后的回答内容",
      "IsReject": false,
      "MediaUrlList": [
        {
          "ClipInfos": [
            {
              "From": 0,
              "To": 30
            }
          ],
          "FileUrl": "https://gw.alicdn.com/imgextra/i3/2775676850/O1CN01kdeffE20TM0E7wvpq_!!2775676850.jpg_q60.jpg",
          "MediaType": "video"
        }
      ],
      "Recommends": [
        {
          "Title": "标题内容",
          "Url": "推荐内容url"
        }
      ],
      "References": [
        {
          "PubTime": "2024-10-08 18:00",
          "Source": "新浪新闻",
          "SourceDocId": 123456,
          "Title": "标题内容",
          "Url": "http://xxxxx"
        }
      ]
    },
    "Usage": {
      "InputTokens": 100,
      "OutputTokens": 100,
      "TotalTokens": 200
    }
  },
  "RequestId": "1813ceee-7fe5-41b4-87e5-982a4d18cca5"
}

Error codes

HTTP status codeError codeError messageDescription
403NoPermissionYou are not authorized to perform this action.Check the value of workspaceId.

For more error codes, see Error Center.