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:RunDocQa

get

*All resources*

None

None

Request syntax

POST /miaodu/stream/runDocQA HTTP/1.1

Request parameters

NameTypeRequiredDescriptionExample

WorkspaceId

string

Yes

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

llm-dswd4003ny4gh9rw

SearchSource

string

Yes

The search source.

Valid values:

  • fromIndexLib: answer questions based on the entire document library.
  • fromWeb: answer questions based on web searches.
  • fromRefContent: answer questions based on the ReferenceContent field.
  • fromDoc: answer questions based on the specified document IDs.

fromWeb

DocIds

array

No

The document IDs.

string

No

The document ID.

10022

Query

string

Yes

The question.

When will the iPhone 16 be released?

ReferenceContent

string

No

The relevant content provided by the questioner.

The relevant content.

ConversationContexts

array<object>

No

The conversation history.

object

No

The historical context.

Content

string

No

The question and answer content.

The question and answer content.

Role

string

No

The role.

user

SessionId

string

Yes

The conversation ID.

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

CategoryIds

array

No

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

string

No

The category ID.

default

ModelName

string

No

The user-defined model name.

quanmiao-max、quanmiao-plus

Response parameters

NameTypeDescriptionExample

object

Schema of Response

Header

object

The response header.

ErrorCode

string

The error code.

success

ErrorMessage

string

The error message.

success

Event

string

The event.

task-started

EventInfo

string

The event description.

A model generation event.

SessionId

string

The session ID.

f5517ee8-dbec-4dc8-bd0a-af084b5e3db1

TaskId

string

The task ID.

3f7045e099474ba28ceca1b4eb6d6e21

TraceId

string

The end-to-end trace ID.

46e5c2b5-0877-4f09-bd91-ab0cf314e48b

Payload

object

The response body.

Output

object

The output.

Content

string

The answer.

The answer.

InterveneContent

string

The answer after intervention.

The answer after intervention.

IsReject

boolean

Indicates whether the request was rejected.

false

MediaUrlList

array<object>

The multimodal resources.

mediaUrlList

object

A multimodal resource object.

ClipInfos

array<object>

The time ranges of related video segments.

clipInfos

object

The time range of a related video segment.

From

double

The start time of the video segment.

0

To

double

The end time of the video segment.

30

FileUrl

string

The file URL.

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

MediaType

string

The media asset type.

video

Recommends

array<object>

The recommended content items.

recommends

object

The recommended content.

Title

string

The title of the recommended content.

The title content.

Url

string

The URL of the recommended content.

The URL of the recommended content.

References

array<object>

The sources of the answer.

references

object

The source of the answer.

PubTime

string

The publication time.

2024-10-08 18:00

Source

string

The source.

Sina News

SourceDocId

string

The source docId.

123456

Title

string

The title of the relevant content.

The title content.

Url

string

The article URL.

http://xxxxx

Usage

object

The token usage.

InputTokens

long

The number of input tokens.

100

OutputTokens

long

The number of output tokens used.

100

TotalTokens

long

The total number of tokens.

200

RequestId

string

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 codeThe error code.The error message.Description

403

NoPermission

You are not authorized to perform this action.

Check the value of workspaceId.

For more error codes, see Error Center.