CreateExperimentPlan - 创建实验计划

更新时间:
复制 MD 格式

创建实验计划。

接口说明

调用 CreateExperimentPlan 在指定 AgentSpace 下创建实验计划。用于定义一次离线或在线实验的配置,包括数据源、可选的评估器,以及在线实验所需的实验分组。创建成功后,再调用 CreateExperimentRun 发起执行。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

调试

授权信息

下表是API对应的授权信息,可以在RAM权限策略语句的Action元素中使用,用来给RAM用户或RAM角色授予调用此API的权限。具体说明如下:

  • 操作:是指具体的权限点。

  • 访问级别:是指每个操作的访问级别,取值为写入(Write)、读取(Read)或列出(List)。

  • 资源类型:是指操作中支持授权的资源类型。具体说明如下:

    • 对于必选的资源类型,用前面加 * 表示。

    • 对于不支持资源级授权的操作,用全部资源表示。

  • 条件关键字:是指云产品自身定义的条件关键字。

  • 关联操作:是指成功执行操作所需要的其他权限。操作者必须同时具备关联操作的权限,操作才能成功。

操作

访问级别

资源类型

条件关键字

关联操作

agentloop:CreateExperimentPlan

create

*Workspace

acs:agentloop:{#regionId}:{#accountId}:agentspace/{#AgentSpaceName}

请求语法

POST /api/v1/experiments/{agentSpace}/plans HTTP/1.1

路径参数

名称

类型

必填

描述

示例值

agentSpace

string

AgentSpace 名称。

al-playground-cn-hongkong

请求参数

名称

类型

必填

描述

示例值

body

object

请求体。离线实验可不传 experiments;在线实验至少传 1 个 experiments。

{"planName": "rca_benchmark_eval_experiment", "experimentType": "OFFLINE", "description": "", "datasetId": "rca_benckmark_eval", "evaluators": [{"evaluatorRef": "Builtin.agent_correctness", "name": "Builtin.agent_correctness", "type": "AGENT", "resultName": "Builtin.agent_correctness", "resultType": "score", "variableMapping": {"input": "experiment_input", "output": "experiment_output", "expected_output": "dataset.ground_truth_json"}, "filters": {"query": "", "sample": "100"}, "config": {"variables": [], "prompt": ""}}, {"evaluatorRef": "rca-toxicity-safety-accuracy", "name": "rca-toxicity-safety-accuracy", "type": "AGENT", "resultName": "rca-toxicity-safety-accuracy", "resultType": "score", "variableMapping": {"input": "experiment_input", "output": "experiment_output", "question": "dataset.question", "expected_output": "dataset.ground_truth_json", "payload_json": "dataset.payload_json"}, "filters": {"query": "", "sample": "100"}, "config": {"variables": [], "prompt": ""}}]}

planName

string

实验计划名称。同一 AgentSpace 下同一账号不可重名。

rca_benchmark_eval_experiment

experimentType

string

实验类型。请求传 OFFLINEONLINE

枚举值:

  • OFFLINE :

    OFFLINE

  • ONLINE :

    ONLINE

OFFLINE

description

string

实验计划描述。

rca_benchmark_eval_experiment 离线实验

datasetId

string

关联的数据集 ID。不传时执行阶段按 simple 模式处理。

rca_benckmark_eval

experiments

array

实验配置列表,最多 5 个。离线实验可不传或传空数组;在线实验至少传 1 个。

[{"label": "A", "name": "experimentA", "modelName": "qwen3.7-plus", "modelProvider": "dashscope", "modelParameters": {"temperature": 0.7, "topP": 0.8, "presencePenalty": 0.0, "frequencyPenalty": 0.0}, "promptTemplate": [{"role": "system", "content": "你是阿里云 ARMS 产品答疑机器人"}, {"role": "user", "content": "{{input}}"}]}, {"label": "B", "name": "experimentB", "modelName": "qwen3.7-max", "modelProvider": "dashscope", "modelParameters": {"temperature": 0.7, "topP": 0.8, "presencePenalty": 0.0, "frequencyPenalty": 0.0}, "promptTemplate": [{"role": "system", "content": "你是阿里云 ARMS 产品答疑机器人"}, {"role": "user", "content": "{{input}}"}]}]

ExperimentConfig

单个实验分组配置。在线实验必填 label、name、modelName;非 agent 模式需提供 promptTemplate。

evaluators

array

评估器列表。配置后实验完成时可自动触发评估。

[{"evaluatorRef": "Builtin.agent_correctness", "name": "Builtin.agent_correctness", "type": "AGENT", "resultName": "Builtin.agent_correctness", "resultType": "score", "variableMapping": {"input": "experiment_input", "output": "experiment_output", "expected_output": "dataset.ground_truth_json"}, "filters": {"query": "", "sample": "100"}, "config": {"variables": [], "prompt": ""}}, {"evaluatorRef": "rca-toxicity-safety-accuracy", "name": "rca-toxicity-safety-accuracy", "type": "AGENT", "resultName": "rca-toxicity-safety-accuracy", "resultType": "score", "variableMapping": {"input": "experiment_input", "output": "experiment_output", "question": "dataset.question", "expected_output": "dataset.ground_truth_json", "payload_json": "dataset.payload_json"}, "filters": {"query": "", "sample": "100"}, "config": {"variables": [], "prompt": ""}}]

Evaluator

单个评估器配置对象。

selectedItemIds

array

部分数据集模式下选定的数据项 ID 列表,需与 datasetId 配合使用。

["019ef4d5-a0f0-7114-832d-5542d771cd8c", "019f1729-be9b-7769-a006-8e98023ad7ad"]

string

数据集中的单条数据项 ID。

019ef4d5-a0f0-7114-832d-5542d771cd8c

querySql

string

部分数据集模式下的自定义查询 SQL 子句。selectedItemIds 为空时可使用。

status='OK'

pipelineName

string

input

object

可选。

{"question": "如何退款?"}

experimentType 请求传 OFFLINE / ONLINE,查询时返回 offline / online

关于 experiments

  • OFFLINE:可不传或传空数组。离线分组在 CreateExperimentRun 时通过 offlineExperiments 指定。

  • ONLINE:至少传 1 个实验分组(最多 5 个)。

离线实验请求示例

{
  "planName": "rca_benchmark_eval_experiment",
  "experimentType": "OFFLINE",
  "description": "",
  "datasetId": "rca_benckmark_eval",
  "evaluators": [
    {
      "evaluatorRef": "Builtin.agent_correctness",
      "name": "Builtin.agent_correctness",
      "type": "AGENT",
      "resultName": "Builtin.agent_correctness",
      "resultType": "score",
      "variableMapping": {
        "input": "experiment_input",
        "output": "experiment_output",
        "expected_output": "dataset.ground_truth_json"
      },
      "filters": {
        "query": "",
        "sample": "100"
      },
      "config": {
        "variables": [],
        "prompt": ""
      }
    },
    {
      "evaluatorRef": "rca-toxicity-safety-accuracy",
      "name": "rca-toxicity-safety-accuracy",
      "type": "AGENT",
      "resultName": "rca-toxicity-safety-accuracy",
      "resultType": "score",
      "variableMapping": {
        "input": "experiment_input",
        "output": "experiment_output",
        "question": "dataset.question",
        "expected_output": "dataset.ground_truth_json",
        "payload_json": "dataset.payload_json"
      },
      "filters": {
        "query": "",
        "sample": "100"
      },
      "config": {
        "variables": [],
        "prompt": ""
      }
    }
  ]
}

在线实验请求示例

{
  "planName": "arms_agent_experiment",
  "experimentType": "ONLINE",
  "description": "",
  "datasetId": "arms_customer_agent_level1",
  "experiments": [
    {
      "label": "A",
      "name": "experimentA",
      "modelName": "qwen3.7-plus",
      "modelProvider": "dashscope",
      "modelParameters": {
        "temperature": 0.7,
        "topP": 0.8,
        "presencePenalty": 0.0,
        "frequencyPenalty": 0.0
      },
      "promptTemplate": [
        {
          "role": "system",
          "content": "你是阿里云 ARMS 产品答疑机器人"
        },
        {
          "role": "user",
          "content": "{{input}}"
        }
      ]
    },
    {
      "label": "B",
      "name": "experimentB",
      "modelName": "qwen3.7-max",
      "modelProvider": "dashscope",
      "modelParameters": {
        "temperature": 0.7,
        "topP": 0.8,
        "presencePenalty": 0.0,
        "frequencyPenalty": 0.0
      },
      "promptTemplate": [
        {
          "role": "system",
          "content": "你是阿里云 ARMS 产品答疑机器人"
        },
        {
          "role": "user",
          "content": "{{input}}"
        }
      ]
    }
  ],
  "evaluators": [
    {
      "evaluatorRef": "Builtin.agent_correctness",
      "name": "Builtin.agent_correctness",
      "type": "AGENT",
      "resultName": "Builtin.agent_correctness",
      "resultType": "score",
      "variableMapping": {
        "input": "experiment_input",
        "output": "experiment_output",
        "expected_output": "dataset.expected_output"
      },
      "filters": {
        "query": "",
        "sample": "100"
      },
      "config": {
        "variables": [],
        "prompt": ""
      }
    }
  ]
}

返回参数

名称

类型

描述

示例值

object

创建实验计划响应。

requestId

string

请求 ID。

3FE4CD1E-FF41-56BE-B590-7A021D9C1524

planId

string

实验计划 ID。

exp-plan-e95bff54685a4ae29ff3a834c1008a71

status

string

创建结果。成功为 created

枚举值:

  • created :

    created

  • error :

    error

created

message

string

提示信息。

实验计划创建成功

成功时返回 planId,HTTP 201。创建后不会自动执行,需再调用 CreateExperimentRun。

示例

正常返回示例

JSON格式

{
  "requestId": "3FE4CD1E-FF41-56BE-B590-7A021D9C1524",
  "planId": "exp-plan-e95bff54685a4ae29ff3a834c1008a71",
  "status": "created",
  "message": "实验计划创建成功"
}

错误码

访问错误中心查看更多错误码。

变更历史

更多信息,参考变更详情