PATCH /openapi/memorylake/api/v3/workspaces/{workspaceId}/analysis-models/{modelId}/entries/{entryId}
payload 时会整体替换条目的内容,所以请带上所有要保留的槽位,而不只是要修改的那些。和添加条目时一样,保存时会再次检查优化案例中的 SQL。
如果只是想停用或恢复条目,也可以调用停用或恢复知识条目。
所需权限:
analysis_model:modify路径参数
string
required
工作空间 ID
string
required
分析模型 ID
string
required
知识条目 ID
请求体
string
required
被编辑条目创建时的类型,例如
general 或 few_shot。编辑请求按它路由,而有些类型仅凭 ID 无法定位。object
条目的新内容,结构须符合
entity_type 的要求。不传则保留当前内容。Show general · 通用知识
Show general · 通用知识
object
背景知识本身,通常是纯文本或 Markdown
Show drilldown_entity · 业务模型
Show drilldown_entity · 业务模型
boolean
设为
true 时让条目不再参与回答,设为 false 时让它重新参与。不传则保持当前状态。object
您希望随条目一起保存的任意内容。不传则保留现有内容;传入的值会替换它。
curl -X PATCH 'https://app.memorylake.cn/openapi/memorylake/api/v3/workspaces/ws-8001856949ad4f6a5b6226f415ffa877/analysis-models/am-9d3f7b1e5a2c4d8f6b0e3a7c9d1f5b2e/entries/5d2e7b9cb31d11f1a7c35e9b2d4f6a81' \
-H 'Authorization: Bearer sk_xxxxxx' \
-H 'Content-Type: application/json' \
--data-binary @- <<'EOF'
{
"entity_type": "few_shot",
"payload": {
"artifact": {
"question": {
"type": "TEXT",
"content": "What was total revenue last month?"
},
"few_shot": {
"type": "SQL",
"content": "SELECT COALESCE(SUM(total_amount), 0) FROM sales.orders WHERE created_at >= date_trunc('month', now()) - interval '1 month' AND created_at < date_trunc('month', now())"
}
}
}
}
EOF
curl -X PATCH 'https://app.memorylake.cn/openapi/memorylake/api/v3/workspaces/ws-8001856949ad4f6a5b6226f415ffa877/analysis-models/am-9d3f7b1e5a2c4d8f6b0e3a7c9d1f5b2e/entries/5d2e7b9cb31d11f1a7c35e9b2d4f6a81' \
-H 'Authorization: Bearer sk_xxxxxx' \
-H 'Content-Type: application/json' \
-d '{
"entity_type": "few_shot",
"disabled": true
}'
响应
返回编辑后的条目。object
Show 知识条目对象
Show 知识条目对象
string
知识条目标识符,请把它当作不透明字符串处理。
string
知识类型,例如
general 或 few_shot。它决定 payload 的结构。string
条目用于匹配的文本:问题要与它相似,条目才会被使用。对通用知识条目,它只用于命名条目;对业务规则,它可能是根据规则本身推导出来的。
boolean
条目当前是否被排除在回答之外
number
条目与检索时
keyword 的接近程度,取值 0 到 1。不在检索中时它不携带任何信息,通常为 0 或不返回,请不要把它当作条目的质量分。object
条目的内容。结构随
entity_type 而定:内容放在 artifact 下的具名槽位中,每个槽位都是一个槽位对象。这里没有列出的键按保存时的原样返回。Show general · 通用知识
Show general · 通用知识
object
背景知识本身,通常是纯文本或 Markdown
Show drilldown_entity · 业务模型
Show drilldown_entity · 业务模型
object
您随条目一起保存的内容,原样返回。没有保存时不返回该字段。
integer
指向这个条目的条目数量
integer
这个条目指向的条目数量
string
条目的添加时间
string
条目的最后修改时间。停用或恢复也算一次修改。
{
"success": true,
"data": {
"id": "5d2e7b9cb31d11f1a7c35e9b2d4f6a81",
"embedding": "What was total revenue last month?",
"disabled": false,
"score": 0.0,
"payload": {
"artifact": {
"question": {
"type": "TEXT",
"content": "What was total revenue last month?"
},
"few_shot": {
"type": "SQL",
"content": "SELECT COALESCE(SUM(total_amount), 0) FROM sales.orders WHERE created_at >= date_trunc('month', now()) - interval '1 month' AND created_at < date_trunc('month', now())"
}
}
},
"entity_type": "few_shot",
"source_count": 0,
"target_count": 0,
"created_at": "2026-09-21T09:26:38.417Z",
"updated_at": "2026-09-22T03:05:12.630Z"
}
}