从会话添加评测用例
curl --request POST \
--url http://localhost:8000/dev/apps/{app_name}/eval-sets/{eval_set_id}/add-session \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"evalId": "case-001",
"sessionId": "session-001",
"userId": "user-001"
}
'import requests
url = "http://localhost:8000/dev/apps/{app_name}/eval-sets/{eval_set_id}/add-session"
payload = {
"evalId": "case-001",
"sessionId": "session-001",
"userId": "user-001"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({evalId: 'case-001', sessionId: 'session-001', userId: 'user-001'})
};
fetch('http://localhost:8000/dev/apps/{app_name}/eval-sets/{eval_set_id}/add-session', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));null{
"detail": "<string>"
}{
"error": "CONTENT_LENGTH_REQUIRED"
}{
"error": "REQUEST_TOO_LARGE"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}开发评测
从会话添加评测用例
将已有会话转换成评测用例,使用 evalId 指定用例 ID;成功返回 JSON null
此接口由所核验的 SDK/ADK 版本提供,仅用于受信任的开发和调试。路径随安装的 ADK 版本变化,不应作为公共业务入口
POST
/
dev
/
apps
/
{app_name}
/
eval-sets
/
{eval_set_id}
/
add-session
从会话添加评测用例
curl --request POST \
--url http://localhost:8000/dev/apps/{app_name}/eval-sets/{eval_set_id}/add-session \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"evalId": "case-001",
"sessionId": "session-001",
"userId": "user-001"
}
'import requests
url = "http://localhost:8000/dev/apps/{app_name}/eval-sets/{eval_set_id}/add-session"
payload = {
"evalId": "case-001",
"sessionId": "session-001",
"userId": "user-001"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({evalId: 'case-001', sessionId: 'session-001', userId: 'user-001'})
};
fetch('http://localhost:8000/dev/apps/{app_name}/eval-sets/{eval_set_id}/add-session', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));null{
"detail": "<string>"
}{
"error": "CONTENT_LENGTH_REQUIRED"
}{
"error": "REQUEST_TOO_LARGE"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}先创建目标评测集,并确认
userId 与 sessionId 对应的会话存在。服务将该会话的交互转换成新用例,使用 evalId 标识;适合把已有调试对话保存为回归评测样本
此操作把会话内容复制到评测集,可能包含用户消息与工具结果。添加前检查样本内容,成功后通过获取评测用例接口确认保存结果
最后修改于 2026年9月19日