Request method: POST
Request URL: https://{domain}/aeolus/llm/openApi/v2/ada/query
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:
warning
|
stream | bool | No | true | Whether to enable streaming output
|
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:
|
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. |
{ "question": "昨天的原始调用量是多少", "agentId": 1, "questionSource":"openapi", "imageFormat": "lark_fragment", // Pass this value "stream": true }
tip
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
|
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
|
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 | 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.
| |
dataSetUrl | string | https://dataset URL | Dataset link |
meta | array | 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 | Result data |
sql | string | SELECT (count(*)) AS article_count FROM | Query SQL |
knowledge | string | " Note:
| Knowledge information used |
sessioinId | int | 53332234 | Session ID |
sessioinUrl | string | https://session URL | Session URL |
recallFieldInfo | array | List of recalled fields |
{ "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": {} }
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}}