跳转到主要内容
用户画像

获取用户画像

获取指定用户的画像属性

GET
/profile_schemas/{profile_schema_id}/user_profile
cURL
curl --request GET \
  --url 'https://maas.qianwenaiapi.com/api/v2/apps/memory/profile_schemas/{profile_schema_id}/user_profile?user_id=%3Cstring%3E' \
  --header 'Authorization: Bearer <YOUR_API_KEY>'
{
  "request_id": "<string>",
  "profile": {
    "attributes": [
      {
        "name": "<string>",
        "value": "<string>"
      }
    ]
  }
}
获取指定用户的画像属性。需在调用 AddMemory 添加对话后等待约 3 秒,待画像提取完成。
若返回的属性值均为空,请确认调用 AddMemory 时已传入相同的 profile_schema。未传该参数时不会触发画像提取。

请求参数

参数类型必填说明
profile_schema_idstring画像模板 ID(路径参数)
user_idstring记忆实体 ID

返回结果

字段类型说明
request_idstring请求 ID
profile.attributesarray画像属性列表
profile.attributes[].namestring属性名称
profile.attributes[].valuestring属性值

代码示例

curl -X GET "https://maas.qianwenaiapi.com/api/v2/apps/memory/profile_schemas/{profile_schema_id}/user_profile?user_id=user_001" \
  --header "Authorization: Bearer $DASHSCOPE_API_KEY" \
  --header "Content-Type: application/json"

# response
{
  "profile": {
    "attributes": [
      {"name": "年龄", "value": "28"},
      {"name": "职业", "value": "软件工程师"},
      {"name": "爱好", "value": "踢足球"}
    ]
  },
  "request_id": "f9g0h1i2-..."
}
完整画像流程参见使用用户画像

鉴权

string
header
必填

路径参数

string
必填

画像模板 ID

查询参数

string
必填

记忆实体 ID

响应

200-application/json
string
object