更新画像模板

更新时间:
复制 MD 格式

更新画像模板的名称、描述或策略版本

更新画像模板。修改 plan_version 后,新写入的记忆遵循新策略版本规则,已写入的记忆不受影响。

请求体必须至少包含 name、description、plan_version、extract_scene 或 attributes_operations 中的一项。

接口

PATCHhttps://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v2/apps/memory/profile_schemas/{profile_schema_id}

调用时请将 {WorkspaceId} 替换为真实的业务空间 ID。

路径参数

profile_schema_idstring必填

画像模板 ID

位置:Path

请求体

namestring可选

更新后的模板名称,最多 32 个字符

位置:Body
descriptionstring可选

更新后的模板描述

位置:Body
plan_versionstring可选

收费计划:pro 或 lite

位置:Body
extract_scenestring可选

提取场景:efficient 或 intelligent

位置:Body
attributes_operationsarray可选

属性变更操作列表

位置:Body
attributes_operations[].opstring必填

操作类型:add、update 或 delete

位置:Body
attributes_operations[].namestring条件必填

属性名称;op=add 时必填,op=update 时可选

位置:Body
attributes_operations[].descriptionstring可选

属性描述;适用于 add 和 update

位置:Body
attributes_operations[].default_valuestring可选

属性默认值;op=update 时可更新

位置:Body
attributes_operations[].attribute_idstring条件必填

属性 ID;op=update 或 op=delete 时必填

位置:Body
memory_library_idstring可选

记忆库 ID

位置:Body

请求示例

curl -X PATCH "https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v2/apps/memory/profile_schemas/{profile_schema_id}" \
  --header "Authorization: Bearer $DASHSCOPE_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
    "name": "更新后的用户基础画像",
    "description": "包含用户的稳定属性和偏好信息",
    "plan_version": "lite",
    "extract_scene": "intelligent",
    "attributes_operations": [
      {"op": "add", "name": "喜欢的音乐", "description": "用户喜欢的音乐类型"},
      {"op": "update", "attribute_id": "attr_002", "name": "常用运动", "default_value": "跑步"},
      {"op": "delete", "attribute_id": "attr_003"}
    ]
  }'

响应示例

{
  "request_id": "813e8d62-062c-97d5-877b-e10f356ca7d4"
}