You need to enable JavaScript to run this app.
DataAgent (OnPremise)

DataAgent (OnPremise)

Copy page
Download PDF
Intelligent Data Query(Old Version)
Intelligent Data Query for PC
Copy page
Download PDF
Intelligent Data Query for PC

Request description

Request method: POST
Request URL: https://{domain}/aeolus/llm/openApi/v2/ada/query

Request parameters

Parameter

Type

Required

Example value

Description

question

string

Yes

How many articles are there on October 20?

Question

chatId

string

Can be omitted for standalone questions

100000

Can be omitted for standalone questions; for multi-turn conversations, the session ID must be provided. Questions with the same chatId will be treated as part of the same multi-turn conversation.

agentId

int

Yes

1000

Agent ID

questionSource

string

Yes

openapi

Indicates the source of the question; the value is fixed as openapi

imageFormat

string

Yes

lark_fragment

Specifies the format type of the chart in the returned query result:

  • lark_fragment: Lark rich text format
  • lark_image_key: Lark image key
  • vchart_schema: vchart chart configuration

warning

  • Due to the possibility that the image generation service may not be ready in some environments, to prevent errors, it is recommended to set the "imageFormat" field to the fixed value "lark_fragment".
  • The current privatized environment does not support the image_url (image URL address) format type. For applicable scenarios and usage guidance for different chart result types, see Reference: Intelligent Analysis Agent OpenAPI Chart Consumption Instructions.

stream

bool

No

true

Whether to enable streaming output

  • true: Enables streaming output. The agent will return intermediate results, and the system will output query results in real time and continuously.
  • false: Disables streaming output. The agent will output the final query result in batch mode.

enableAnalysis

bool

No

false

Whether to enable chart analysis. The default value is false. When set to true, the agent will analyze the chart of the query result in real time during data query. When returning the agent's answer, the interpretation of the chart will also be returned.

warning

The "Basic Information" page in the DataAgent management console also has a configuration switch for enabling chart analysis for the agent. When calling the OpenAPI, if the parameter configuration result here is inconsistent with the configuration result in the console interface:

  • When calling the OpenAPI, the configuration result of the OpenAPI takes precedence over the configuration result in the console interface. The OpenAPI return result is based on the configuration result of the API request parameters.
  • However, the configuration result of the OpenAPI does not override the configuration result set in the console interface. That is, when using the agent in the interface, the return result is based on the interface configuration.

dataSetId

int

No

102**362

To specify the dataset scope for the query, you can provide the dataset ID. For how to obtain the dataset ID, see dataSetId.

Request example
{
    "question": "昨天的原始调用量是多少",
    "agentId": 1,
    "questionSource":"openapi",
    "imageFormat": "lark_fragment",  // Pass this value
    "stream": true
}

Response parameters

tip

  • The following uses the parameter structure of the streaming response as an example to introduce the meaning of the response parameters.
  • The response parameters of the non-streaming result are consistent with the parameters in the result field in the table below. Refer to the result field description for details.

Parameter

Type

Example value

Description

sub_id

int

0

Sub-query ID. openapi does not support split queries, so sub_id is always 0.

type

string

thought

Type of block

  • thought: Agent's reasoning content
  • code: SQL code generated by the agent
  • result: Query result output by the agent

content

string

Question

When the type field is thought or code, the returned main content

status

string

processing

When the type field is set to result, outputs the current status

  • processing: In progress
  • success: Indicates successful execution, but does not mean everything is completed
  • completed: Indicates full completion, and returns the query result in one batch

result

object

0

When the type field is set to result, outputs the query result. For field descriptions of result, see the table below.

The result field is described as follows:

Parameter

Type

Example value
Description

charts

array

Image

Returned query result charts. Different types of charts may be returned based on your query, such as line charts, bar charts, and many other types. The first chart in the returned results is the recommended chart, which is more convenient for analyzing the query results.

  • For example, in a GUI-based query, the chart results are as follows:
    Image
  • Supported types include:
    • "column_parallel": Bar chart
    • "combination": Combination chart
    • "line": Line chart
    • "pie": Pie chart
    • "measure_card": Metric card
    • "table": Table

dataSetUrl

string

https://dataset URL

Dataset link

meta

array

Image

Result field description information, which can be understood as the table header. The role parameter indicates the role of the field in the query result: measure means metric, and dimension means dimension.

queryHistory

string

https://

SQL view address

rows

array

[ // Query data results
[
369
]
]

Result data

sql

string

SELECT (count(*)) AS article_count FROM Perfu.aeolus_event_online WHERE (1700052552137_日期) = ('2024-10-20') LIMIT 1000

Query SQL

knowledge

string

"

Note:

  1. Metrics are independent, and different metrics cannot be summed.
    "

Knowledge information used

sessioinId

int

53332234

Session ID

sessioinUrl

string

https://session URL

Session URL

recallFieldInfo

array

Image

List of recalled fields

Response example

Non-streaming response example

{
    "JSONIFY_PRETTYPRINT_REGULAR": false,
    "code": "llm/ok",
    "data": {
        "charts":  [ //chart type type
            {
                "chartType": "measure_card",    
                "image": "",
                "imageLarkKey": null,
                "larkFragment":"{\"tag\": \"column_set\", \"flex_mode\": \"stretch\", \"background_style\": \"grey\", \"horizontal_spacing\": \"default\", \"columns\": [{\"tag\": \"column\", \"width\": \"weighted\", \"weight\": 1, \"elements\": [{\"tag\": \"markdown\", \"text_align\": \"left\", \"content\": \"article_count(\文\章\数\量):\\n**369251756**\"}]}]}",
                "vchart_schema":"{}"
            },
            {
                "chartType": "table",
                "image": "",
                "imageLarkKey": null,
                "larkFragment":"{\"tag\": \"table\", \"page_size\": 6, \"row_height\": \"32px\", \"custom_tag\": \"chart_type_table\", \"header_style\": {\"bold\": true, \"background_style\": \"grey\", \"text_size\": \"normal\", \"row_height\": \"middle\", \"lines\": 2}, \"columns\": [{\"name\": \"1733299899765\", \"display_name\": \"article_count(\文\章\数\量)\", \"data_type\": \"text\"}], \"rows\": [{\"1733299899765\": \"369251756\"}]}",
                "vchart_schema":"{}"
            }
        ],
        "dataSetId": 3231942,
        "dataSetUrl": "",
        "knowledge": "\n\n提示:\n1. 指标相互独立,不同不可相加\n",
        "meta": null,
        "originalCode": "\n# 编写SQL查询\nsql = \"\"\"\nSELECT \n    SUM(`免费量`) AS 总免费量,\n    SUM(`原始量`) AS 总原始量,\n    SUM(`付费量`) AS 总付费量\nFROM 数据集\nWHERE YEAR(`日期`) = YEAR(CURRENT_DATE);\n\"\"\"\n\n# 执行SQL查询并获取结果\ndf = execute_sql(sql, max_rows=1000)\n\n# 输出结果\nanswer(df)\n\n    ",
        
        "queryHistory": "",
        "recallFieldInfo": [
            {
                "descr": null,
                "fieldName": "`客户`",
                "id": 17000641168,
                "mapType": 0,
                "type": "string"
            }
        ],
        "rows": [[100000]],
        "sessionId": 5652519,
        "sessionUrl": "https://网址",
        "sql": "\n# 编写SQL查询\nsql = \"\"\"\nSELECT \n    SUM(`免费量`) AS 总免费量,\n    SUM(`原始量`) AS 总原始量,\n    SUM(`付费量`) AS 总调用量\nFROM 数据集\nWHERE YEAR(`日期`) = YEAR(CURRENT_DATE);\n\"\"\"\n\n# 执行SQL查询并获取结果\ndf = execute_sql(sql, max_rows=1000)\n\n# 输出结果\nanswer(df)\n\n    ",
        "sqlList": [],
        "thought": {
            "columns": [],
            "dimensions": [],
            "filters": [],
            "metrics": [],
            "redactedCode": ""
        }
    },
    "msg": {}
}

Streaming response example

data: {"sub_id": 0, "type": "thought", "content": ""}
data: {"sub_id": 0, "type": "thought", "content": "用户"}
data: {"sub_id": 0, "type": "thought", "content": "的问题"}
data: {"sub_id": 0, "type": "thought", "content": "是"}
data: {"sub_id": 0, "type": "thought", "content": "询"}
data: {"sub_id": 0, "type": "thought", "content": "问"}

......

data: {"sub_id": 0, "type": "code", "content": ");"}
data: {"sub_id": 0, "type": "code", "content": "\n"}
data: {"sub_id": 0, "type": "code", "content": ""}
data: {"sub_id": 0, "type": "result", "status": "processing", "msg": "processing", "result": {}}
data: {"sub_id": 0, "type": "result", "status": "success", "msg": "success", "result": {"historyId": 1446196}}
data: {"sub_id": 0, "type": "result", "status": "completed", "result": {"data_set_id": null, "sql": "\n# \u7f16\u5199SQL\u67e5\u8be2\nsql = \"\"\"\nSELECT \n    SUM(`\u539f\u59cb\u8c03\u7528\u91cf`) AS `\u6628\u65e5\u539f\u59cb\u8c03\u7528\u91cf`\nFROM \n    \u6570\u636e\u96c6\nWHERE \n    `\u8c03\u7528\u65e5\u671f` = DATE_SUB(CURRENT_DATE, INTERVAL 1 DAY);\n\"\"\"\n\n# \u6267\u884cSQL\u67e5\u8be2\u5e76\u83b7\u53d6\u7ed3\u679c\ndf = execute_sql(sql, max_rows=1000)\n\n# \u8f93\u51fa\u7ed3\u679c\nanswer(df)\n\n    ", "thought": {"columns": ["\u6628\u65e5\u539f\u59cb\u8c03\u7528\u91cf"], "dimensions": [], "metrics": ["\u6628\u65e5\u539f\u59cb\u8c03\u7528\u91cf"], "filters": ["\u8c03\u7528\u65e5\u671f(\u7b49\u4e8e\u6628\u65e5)", "p_date(\u7b49\u4e8e2025-05-07)", "\u4e3b\u5ba2\u6237\u7b49\u7ea7(\u4e0d\u7b49\u4e8e'\u5185\u90e8\u5ba2\u6237'\u6216\u4e3a\u7a7a)", "\u8c03\u7528\u65e5\u671f(\u5927\u4e8e\u7b49\u4e8e2024-03-01)", "\u9650\u52361000\u6761"], "redacted_code": ""}, "thought_process": "\u7528\u6237\u7684\u95ee\u9898\u662f\u8be2\u95ee\u6628\u5929\u7684\u539f\u59cb\u8c03\u7528\u91cf\u3002\u6211\u4eec\u9700\u8981\u4ece\u6570\u636e\u96c6\u4e2d\u7b5b\u9009\u51fa\u8c03\u7528\u65e5\u671f\u4e3a\u6628\u5929\u7684\u6570\u636e\uff0c\u5e76\u5bf9\u5b57\u6bb5 `\u539f\u59cb\u8c03\u7528\u91cf` \u8fdb\u884c\u6c47\u603b\uff08SUM\uff09\u3002\u6628\u5929\u7684\u65e5\u671f\u53ef\u4ee5\u901a\u8fc7\u5f53\u524d\u65e5\u671f\u51cf\u53bb\u4e00\u5929\u6765\u8ba1\u7b97\u3002\n", "rows": [[1231866173336]], "meta": [{"name": "\u6628\u65e5\u539f\u59cb\u8c03\u7528\u91cf", "dataType": "float", "role": "measure"}], "charts": [{"chartType": "measure_card", "image": "https://tosv.byted.org/obj/davinci-render-output/da911f72-cad0-436d-afcb-dee07cf74e68"}, {"chartType": "table", "image": "https://tosv.byted.org/obj/davinci-render-output/82e1a6b1-1f06-4adb-bef4-a3e640c25333"}], "data_set_url": "", "query_history": "", "chart_html": "\n        <html>\n            <head>\n                <meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" />\n            </head>\n        <body>\n            <div style='overflow:auto'>\n            \n                <div style='float:left;width:400px;padding:20'>\n                    <p style='text-align:center'>\n                    measure_card (\u9ed8\u8ba4)\n                    </p>\n                    <img src='https://tosv.byted.org/obj/davinci-render-output/da911f72-cad0-436d-afcb-dee07cf74e68' width='400px' />\n                </div>\n                \n\n                <div style='float:left;width:400px;padding:20'>\n                    <p style='text-align:center'>\n                    table\n                    </p>\n                    <img src='https://tosv.byted.org/obj/davinci-render-output/82e1a6b1-1f06-4adb-bef4-a3e640c25333' width='400px' />\n                </div>\n                \n            </div>\n        </body>\n        ", "prompts": [], "sql_list": [{"origin_sql": "\nSELECT \n    SUM(`\u539f\u59cb\u8c03\u7528\u91cf`) AS `\u6628\u65e5\u539f\u59cb\u8c03\u7528\u91cf`\nFROM \n    \u6570\u636e\u96c6\nWHERE \n    `\u8c03\u7528\u65e5\u671f` = DATE_SUB(CURRENT_DATE, INTERVAL 1 DAY);\n", "rewrite_sql": "  SELECT  (`1700060687188_\u539f\u59cb\u8c03\u7528\u91cf`) AS `\u6628\u65e5\u539f\u59cb\u8c03\u7528\u91cf`  FROM `\u706b\u5c71\u5f15\u64ce\u7ecf\u8425\u7ba1\u7406.\u884c\u4e1a\u8c46\u5305\u5927\u6a21\u578b\u8c03\u7528\u805a\u5408 for \u667a\u80fd\u4f53`     WHERE ( (`1700060687218_\u8c03\u7528\u65e5\u671f`) = ((date_sub(to_date(today()), INTERVAL 1 DAY))) ) AND (to_date(`1700060687175_p_date`) = '2025-05-07') AND (((`1700060687225_\u4e3b\u5ba2\u6237\u7b49\u7ea7`) != ('\u5185\u90e8\u5ba2\u6237')) or ((`1700060687225_\u4e3b\u5ba2\u6237\u7b49\u7ea7`) IS NULL)) AND ((`1700060687218_\u8c03\u7528\u65e5\u671f`) >= ('2024-03-01'))      LIMIT 1000   "}], "recall_field_info": {}, "original_code": "\n# \u7f16\u5199SQL\u67e5\u8be2\nsql = \"\"\"\nSELECT \n    SUM(`\u539f\u59cb\u8c03\u7528\u91cf`) AS `\u6628\u65e5\u539f\u59cb\u8c03\u7528\u91cf`\nFROM \n    \u6570\u636e\u96c6\nWHERE \n    `\u8c03\u7528\u65e5\u671f` = DATE_SUB(CURRENT_DATE, INTERVAL 1 DAY);\n\"\"\"\n\n# \u6267\u884cSQL\u67e5\u8be2\u5e76\u83b7\u53d6\u7ed3\u679c\ndf = execute_sql(sql, max_rows=1000)\n\n# \u8f93\u51fa\u7ed3\u679c\nanswer(df)\n\n    ", "knowledge": null}}
Last updated: 2026.06.02 14:53:15