获取评估任务对比结果 - ShowOpsEvaluationTasksCompareResult
功能介绍
该接口用于统计不同评估任务的对比结果,包含每个任务在每个评估器的得分情况、每个评估器得分、任务状态、任务耗时、任务消耗总token,适用于数据特征分析和评估任务管理的场景。
调用方法
请参见如何调用API。
授权信息
账号根用户具备所有API的调用权限,如果使用账号下的IAM用户调用当前API,该IAM用户需具备如下身份策略权限,更多的权限说明请参见权限和授权项。
| 授权项 | 访问级别 | 资源类型(*为必须) | 条件键 | 别名 | 依赖的授权项 |
|---|---|---|---|---|---|
| agentarts:evaluationTask:showOpsEvaluationTasksCompareResult | Read | evaluationTask * | g:ResourceTag/<tag-key> | - | - |
URI
GET /v1/ops/evaluation-tasks/{task_id}/result-comparisons
| 参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
| task_id | 是 | String | 参数解释: 基线评估任务的唯一标识符(ID)。 约束限制: 字符长度在0到100之间。 取值范围: 长度为0到100个字符的字符串。 默认取值: 不涉及。 |
| 参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
| task_ids | 是 | String | 参数解释: 基线评估任务的唯一标识符列表,多个任务间用逗号相隔。 约束限制: 字符串类型,最大长度1000字符。 取值范围: 字符串长度不超过1000。 默认取值: 不涉及。 |
| offset | 否 | Integer | 参数解释: 分页查询的起始偏移量。用于指定从满足条件的第几条记录开始返回,常与 limit参数配合实现分页功能。 约束限制: 必须为整数,且大小在0到10,000之间。 取值范围: 0-10000。 默认取值: 0。 |
| limit | 否 | Integer | 参数解释: 单次查询返回的最大记录数量。用于控制分页查询时每页显示的数据条数。 约束限制: 必须为整数,且大小在1到100之间。 取值范围: 1-100。 默认取值: 10。 |
请求参数
无
响应参数
状态码:200
| 参数 | 参数类型 | 描述 |
|---|---|---|
| data | Array of CompareResultItem objects | 评估任务对比返回结构体。 |
| total | Integer | 参数解释: 符合查询过滤条件的总记录数。 约束限制: 整型数值。 取值范围: 0-500。 默认取值: 不涉及。 |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| benchmark_group | Array of CompareGroupItem objects | 基准组评估结果列表,通常是被测系统的标准输出或对比基线。 |
| control_group | Array of CompareGroupItem objects | 对照组评估结果列表,通常是实验系统的输出或待评估的变体。 |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| item_id | String | 测试项的唯一标识符(ObjectId格式)。 |
| item_data | Array of CompareItemData objects | 测试数据的原始输入输出对列表,每轮对话或单次测试的明细。 |
| dataset_id | String | 测试所用数据集的唯一标识符(UUID格式)。 |
| dataset_version | String | 数据集的版本标识符(UUID格式)。 |
| evaluations | Array of CompareEvaluation objects | 对该测试项执行的所有评估器结果列表。 |
| task_name | String | 测试任务的名称,如“正确性评估-正式测试xxxxx”。 |
| task_id | String | 测试任务的唯一标识符(UUID 格式)。 |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| evaluator_id | String | 评估器的唯一标识符,如TaskCompletion、TurnRelevancy等。 |
| evaluator_version | String | 评估器的版本号,如“1.0.0”。 |
| score | Float | 评估得分,通常在0到1之间;若评估失败,该值可能为0。 |
| reason | String | 评估得分的详细理由文本,失败时可为空字符串。 |
| latency_s | Integer | 评估器执行的耗时,单位为秒。 |
| status_code | String | 评估执行状态:SUCCESS表示成功,FAILED表示失败(如超时、网络错误等)。 |
| error | String | 失败时的详细错误信息;成功时为空字符串。 |
| input_token_usage | Integer | 评估器处理输入时消耗的 token 数量。 |
| output_token_usage | Integer | 评估器生成输出时消耗的 token 数量。 |
| correction | Object | 纠正信息字段,通常为null;预留用于自动纠错或人工校正结果。 |
| retry_count | Integer | 评估器失败后重试的次数。 |
| created_at | String | 评估记录创建时间,ISO 8601格式(UTC)。 |
| evaluator_name | String | 评估器的人类可读名称,如“任务完成度”、“相关性”。 |
状态码:400
| 参数 | 参数类型 | 描述 |
|---|---|---|
| error_code | String | 参数解释: 系统定义的标准化错误代码。 取值范围: 业务异常编码字符串。 |
| error_msg | String | 参数解释: 对错误的详细描述,包含异常原因或解决建议。 约束限制: 字符串类型,最小长度为2,最大长度为512。 取值范围: 字符长度2-512,任意文本内容。 |
请求示例
获取评估任务对比结果
GET https://*.com/agentarts/v1/ops/evaluation-tasks/a67452bf21f819-6f91-4568-9f2f-57ef9562ab7b/result-comparisons?task_ids=a64cd819-6f91-4568-9f2f-57ef9562ab7b,a64cd819-6f91-4568-9f2f-57ef9562ab7c&limit=10&offset=0
响应示例
状态码:200
返回添加成功
{
"data" : [ {
"benchmark_group" : [ {
"item_id" : "69cb54fa4ff1d28db99b80f9",
"item_data" : [ {
"user_input" : "2-1",
"user_output" : "2-1"
}, {
"user_input" : "2-2",
"user_output" : "2-2"
} ],
"dataset_id" : "c5784498-75a4-4a39-9a88-d34c96c5ac23",
"dataset_version" : "410eef1f-292c-41e9-9d92-cfd54c202954",
"evaluations" : [ {
"evaluator_id" : "TaskCompletion",
"evaluator_version" : "1.0.0",
"score" : 0,
"reason" : "",
"latency_s" : 8,
"status_code" : "FAILED",
"error" : "评估失败。【[ERR_INVALID_TYPE(1002)] Metric 'TaskCompletionMetric' is not a valid metric for a multi-turn TestCase. (Hint: Use a metric that inherits from BaseSessionMetric for TestCases with multiple turns.)】",
"input_token_usage" : 20,
"output_token_usage" : 3,
"correction" : null,
"retry_count" : 4,
"created_at" : "2026-03-31T06:54:09.974Z",
"evaluator_name" : "任务完成度"
}, {
"evaluator_id" : "TurnRelevancy",
"evaluator_version" : "1.0.0",
"score" : 1,
"reason" : "得分为 1.0,因为不相关性描述列表为空,表明AI回复的消息'actual_output'与用户的消息'input'之间没有任何不相关之处,完全符合对话上下文和用户需求。",
"latency_s" : 6,
"status_code" : "SUCCESS",
"error" : "",
"input_token_usage" : 1864,
"output_token_usage" : 92,
"correction" : null,
"retry_count" : 1,
"created_at" : "2026-03-31T06:54:09.974Z",
"evaluator_name" : "相关性"
} ],
"task_name" : "正确性评估-正式测试3544585",
"task_id" : "a9bc0aa7-f93c-464d-945b-b7dd3b52945a"
} ],
"control_group" : [ {
"item_id" : "69cb54fa4ff1d28db99b80f9",
"item_data" : [ {
"user_input" : "2-1",
"user_output" : "2-1"
}, {
"user_input" : "2-2",
"user_output" : "2-2"
} ],
"item_data_list" : null,
"dataset_id" : "c5784498-75a4-4a39-9a88-d34c96c5ac23",
"dataset_version" : "410eef1f-292c-41e9-9d92-cfd54c202954",
"evaluations" : [ {
"evaluator_id" : "TurnRelevancy",
"evaluator_version" : "1.0.0",
"score" : 1,
"reason" : "得分为 1.0,因为不相关性描述列表为空,表明AI回复的消息与用户的消息完全相关,没有任何不相关之处。",
"latency_s" : 6,
"status_code" : "SUCCESS",
"error" : "",
"input_token_usage" : 1864,
"output_token_usage" : 79,
"correction" : null,
"retry_count" : 1,
"created_at" : "2026-03-31T05:03:01.736Z",
"evaluator_name" : "相关性"
} ],
"task_name" : "正确性评估-正式测试358585",
"task_id" : "ca1ca597-e3ea-4a0b-9e4b-e1967630eef0"
}, {
"item_id" : "69ca264687cc01c224371c78",
"item_data" : [ {
"user_input" : "1",
"user_output" : "测试33333"
}, {
"user_input" : "1",
"user_output" : "测试33333"
} ],
"item_data_list" : null,
"dataset_id" : "710916e2-4969-44dd-9e79-0461b1f0472f",
"dataset_version" : "a42aa06a-5309-4967-9a22-fae2cb9a6238",
"evaluations" : [ {
"evaluator_id" : "TurnRelevancy",
"evaluator_version" : "1.0.0",
"score" : 0,
"reason" : "",
"latency_s" : 4,
"status_code" : "FAILED",
"error" : "评估失败。【{'code': 5004, 'name': 'ERR_LLM_TIMEOUT', 'message': 'LLM network timeout or connection error: Connection error.', 'suggestion': 'Check your network connectivity or try running the evaluation later.', 'details': {'error_type': 'APIConnectionError'}}】",
"input_token_usage" : 0,
"output_token_usage" : 0,
"correction" : null,
"retry_count" : 4,
"created_at" : "2026-03-31T04:45:55.052Z",
"evaluator_name" : "相关性"
} ],
"task_name" : "正确性评估-正式测试38995",
"task_id" : "73922be4-f10b-414b-94fa-f0c802e04b78"
} ]
}, {
"benchmark_group" : [ {
"item_id" : "69cb54fa4ff1d28db99b80f8",
"item_data" : [ {
"user_input" : "1-1",
"user_output" : "1-2"
}, {
"user_input" : "1-2",
"user_output" : "1-2"
} ],
"item_data_list" : null,
"dataset_id" : "c5784498-75a4-4a39-9a88-d34c96c5ac23",
"dataset_version" : "410eef1f-292c-41e9-9d92-cfd54c202954",
"evaluations" : [ {
"evaluator_id" : "TaskCompletion",
"evaluator_version" : "1.0.0",
"score" : 0,
"reason" : "",
"latency_s" : 1,
"status_code" : "FAILED",
"error" : "评估失败。【[ERR_INVALID_TYPE(1002)] Metric 'TaskCompletionMetric' is not a valid metric for a multi-turn TestCase. (Hint: Use a metric that inherits from BaseSessionMetric for TestCases with multiple turns.)】",
"input_token_usage" : 2,
"output_token_usage" : 1,
"correction" : null,
"retry_count" : 4,
"created_at" : "2026-03-31T06:54:09.974Z",
"evaluator_name" : "任务完成度"
}, {
"evaluator_id" : "TurnRelevancy",
"evaluator_version" : "1.0.0",
"score" : 1,
"reason" : "得分为 1.0,因为不相关性描述列表为空,表明AI回复的消息与用户的消息完全相关,没有任何不相关之处。",
"latency_s" : 5,
"status_code" : "SUCCESS",
"error" : "",
"input_token_usage" : 1864,
"output_token_usage" : 79,
"correction" : null,
"retry_count" : 1,
"created_at" : "2026-03-31T06:54:09.974Z",
"evaluator_name" : "相关性"
} ],
"task_name" : "正确性评估-正式测试3544585",
"task_id" : "a9bc0aa7-f93c-464d-945b-b7dd3b52945a"
} ],
"control_group" : [ {
"item_id" : "69cb54fa4ff1d28db99b80f8",
"item_data" : [ {
"user_input" : "1-1",
"user_output" : "1-2"
}, {
"user_input" : "1-2",
"user_output" : "1-2"
} ],
"item_data_list" : null,
"dataset_id" : "c5784498-75a4-4a39-9a88-d34c96c5ac23",
"dataset_version" : "410eef1f-292c-41e9-9d92-cfd54c202954",
"evaluations" : [ {
"evaluator_id" : "TurnRelevancy",
"evaluator_version" : "1.0.0",
"score" : 1,
"reason" : "得分为 1.0,因为不相关性描述列表为空,表明AI回复的消息与用户的消息完全相关,没有任何不相关之处。",
"latency_s" : 5,
"status_code" : "SUCCESS",
"error" : "",
"input_token_usage" : 1864,
"output_token_usage" : 76,
"correction" : null,
"retry_count" : 1,
"created_at" : "2026-03-31T05:03:01.736Z",
"evaluator_name" : "相关性"
} ],
"task_name" : "正确性评估-正式测试358585",
"task_id" : "ca1ca597-e3ea-4a0b-9e4b-e1967630eef0"
}, {
"item_id" : "69c9ef8fd642c4aacc40ab98",
"item_data" : [ {
"user_input" : "1",
"user_output" : "测试33333"
}, {
"user_input" : "1",
"user_output" : "测试33333"
} ],
"item_data_list" : null,
"dataset_id" : "710916e2-4969-44dd-9e79-0461b1f0472f",
"dataset_version" : "a42aa06a-5309-4967-9a22-fae2cb9a6238",
"evaluations" : [ {
"evaluator_id" : "TurnRelevancy",
"evaluator_version" : "1.0.0",
"score" : 0,
"reason" : "",
"latency_s" : 4,
"status_code" : "FAILED",
"error" : "评估失败。【{'code': 5004, 'name': 'ERR_LLM_TIMEOUT', 'message': 'LLM network timeout or connection error: Connection error.', 'suggestion': 'Check your network connectivity or try running the evaluation later.', 'details': {'error_type': 'APIConnectionError'}}】",
"input_token_usage" : 0,
"output_token_usage" : 0,
"correction" : null,
"retry_count" : 4,
"created_at" : "2026-03-31T04:45:55.052Z",
"evaluator_name" : "相关性"
} ],
"task_name" : "正确性评估-正式测试38995",
"task_id" : "73922be4-f10b-414b-94fa-f0c802e04b78"
} ]
} ],
"total" : 10
} 状态码
| 状态码 | 描述 |
|---|---|
| 200 | 返回添加成功 |
| 400 | 错误 |
错误码
请参见错误码。