SetAgentSessionModel - 设置会话模型
设置会话使用的模型,并可选配置思考等级。
接口说明
将 CreateAgentSession 返回的
sessionId与 ListModels 返回的Models[].Id分别作为Params.sessionId、Params.modelId传入。模型目录可见不代表目标会话支持该模型,最终由目标会话校验。modelId必填。仅修改模型时,可省略thinkingLevel;思考等级的配置方式见请求参数补充说明。本操作仅修改目标会话,不修改智能体或账号的全局默认模型。会话执行期间可能拒绝配置修改,不保证支持运行中切换。
模型与思考等级按步骤设置。调用失败时,模型可能已经变更,不保证整体回滚;应调用 GetAgentSessionModel 查询当前配置,再决定后续操作。调用成功后可从返回结果读取实际生效值。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
|
操作 |
访问级别 |
资源类型 |
条件关键字 |
关联操作 |
|
ada:SetAgentSessionModel |
update |
*全部资源
|
无 | 无 |
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| Jsonrpc |
string |
否 |
JSON-RPC 版本,填写 |
2.0 |
| Id |
string |
否 |
客户端请求标识,在响应中回显。用于关联本次调用,不具有幂等语义。 |
request-001 |
| Params |
any |
是 |
已定义的业务参数结构,核心嵌套字段见补充说明。 |
{"sessionId":"0123456789abcdef0123456789abcdef","modelId":"text-model-example"} |
调用方式为 POST,业务参数位于 formData。地域由客户端配置确定。示例仅展示业务参数;Action、Version、身份和签名由 POP 客户端处理,Params 按客户端要求序列化一次。
| 名称 | 类型 | 必填 | 描述 | 示例值 |
Params.sessionId | string | 是 | CreateAgentSession 返回的会话 ID。 | 0123456789abcdef0123456789abcdef |
Params.modelId | string | 是 | 目标模型标识,使用 ListModels 返回的 Models[].Id,并确保目标会话支持。 | text-model-example |
Params.thinkingLevel | string | 否 | 可选高级配置:目标思考等级。当前定义包含 off、default、low、medium、high、xhigh、max,具体可用值由目标模型与会话决定。 | off |
配置思考等级时,应参考模型目录及 GetAgentSessionModel 返回的等级选项。省略 thinkingLevel 表示本次不显式设置该选项,不等于关闭思考,也不保证切换模型后等级保持不变。off 表示关闭思考;default 表示恢复默认配置,返回值可能为实际生效的具体等级。仅填写目标模型与会话支持的值。
请求示例
以下示例仅设置模型;需要配置思考等级时,在 Params 中增加 thinkingLevel。
{
"Jsonrpc": "2.0",
"Id": "request-001",
"Params": {
"sessionId": "0123456789abcdef0123456789abcdef",
"modelId": "text-model-example"
}
}
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
|||
| RequestId |
string |
本次请求 ID,用于问题排查。 |
0A1B2C3D-4E5F-6789-ABCD-EF0123456789 |
| JsonRpcResponse |
any |
已定义的 JSON-RPC 响应结构,核心嵌套字段见补充说明。 |
{"jsonrpc":"2.0","id":"request-001","result":{"modelId":"text-model-example","thinkingLevel":"off","thinkingLevels":["off","low","medium","high"]}} |
| Success |
boolean |
本次设置成功时为 |
true |
模型目录的 Models[].Id 用于提交选择,会话返回的 modelId 表示实际生效配置,两者可能不同。调用方应保存设置结果,并与后续 GetAgentSessionModel 返回的 modelId 核对;不要仅凭目录 ID 与会话 ID 字符串不相等判定失败,也不要自行拼接或移除提供方后缀。
模型配置位于 JsonRpcResponse.result。
| 名称 | 类型 | 描述 | 示例值 |
JsonRpcResponse.jsonrpc | string | JSON-RPC 版本,当前为 2.0。 | 2.0 |
JsonRpcResponse.id | string | 回显请求中的 Id。 | request-001 |
JsonRpcResponse.result | any | 设置后查询得到的模型配置结构。 | {"modelId":"text-model-example"} |
JsonRpcResponse.result.modelId | string | 当前实际生效的模型标识。 | text-model-example |
JsonRpcResponse.result.thinkingLevel | string | 可选高级配置:当前实际生效的思考等级。客户端应容忍字段缺省。 | off |
JsonRpcResponse.result.thinkingLevels | array<string> | 可选高级配置:当前会话提供的思考等级选项。空数组或字段缺省不表示支持全部等级。 | ["off","low","medium","high"] |
正常返回示例
示例中的模型标识仅用于说明,调用时应使用实际查询到的模型标识。
{
"RequestId": "0A1B2C3D-4E5F-6789-ABCD-EF0123456789",
"Success": true,
"JsonRpcResponse": {
"jsonrpc": "2.0",
"id": "request-001",
"result": {
"modelId": "text-model-example",
"thinkingLevel": "off",
"thinkingLevels": [
"off",
"low",
"medium",
"high"
]
}
}
}
示例
正常返回示例
JSON格式
{
"RequestId": "0A1B2C3D-4E5F-6789-ABCD-EF0123456789",
"JsonRpcResponse": "{\"jsonrpc\":\"2.0\",\"id\":\"request-001\",\"result\":{\"modelId\":\"text-model-example\",\"thinkingLevel\":\"off\",\"thinkingLevels\":[\"off\",\"low\",\"medium\",\"high\"]}}",
"Success": true
}
错误码
|
HTTP status code |
错误码 |
错误信息 |
描述 |
|---|---|---|---|
| 400 | InvalidParameter | The specified parameter is invalid. | |
| 401 | Unauthenticated | Authentication required. | |
| 500 | InternalError | Internal server error. | |
| 403 | Forbidden | You are not authorized to perform this operation. | |
| 404 | AgentSession.SessionNotFound | The specified agent session does not exist. | |
| 503 | ServiceUnavailable | The service is not ready or temporarily unavailable. | |
| 409 | AgentSession.SessionBusy | A turn is already running in the agent session. |