作文润色
更新时间:2026-04-28
POST
https://qianfan.baidubce.com/v2/tools/ai_education/k9_composition_polishing
本接口用于对K9作文按照词汇、句子进行润色,优化段落结构,并给出范文参考。
该组件为付费功能,具体计费说明请参见使用文档。
权限说明
调用本文API,需使用API Key鉴权方式。使用API Key鉴权调用API流程,具体调用流程,请查看认证鉴权。
请求参数
Headers 参数
除公共头域外,无其它特殊头域
Body 参数
parameters
object {1}
调用传参
必选
显示子属性
隐藏子属性
content
string
作文内容,需要进行润色的文本
必选
stream
boolean
是否流式返回。
必选
请求结构
POST /v2/tools/ai_education/k9_composition_polishing HTTP/1.1
HOST: qianfan.baidubce.com
Authorization: Bearer <API Key>
Content-Type: application/json
{
"stream": false,
"parameters": {
"content": "今天我去公园玩,天气很好,我很开心。"
}
}
示例代码
请求示例
curl -X POST "https://qianfan.baidubce.com/v2/tools/ai_education/k9_composition_polishing" \
-H "Authorization: Bearer bce-v3/ALTAK-******ZftZDTn7/125eeb1c5e9ddc8cf3edf18ef6d03f1517ec9408" \
-H "Content-Type: application/json" \
-d '{
"stream": false,
"parameters": {
"content": "今天我去公园玩,天气很好,我很开心。"
}
}'
返回响应
Headers 参数
除公共头域外,无其它特殊头域
返回参数
code
string
错误代码,当发生异常时返回
可选
message
string
错误消息,当发生异常时返回
可选
status
string
当前对话状态。
running:对话进行过程中。
done:对话结束。
error:执行过程发生错误。
interrupt:中断
可选
content
array
响应内容列表
可选
显示子属性
隐藏子属性
items
object {3}
显示子属性
隐藏子属性
type
string
代表event 类型。该字段的取值决定了下面text字段的内容结构。
枚举:text、json、code、files、urls、oral_text、references、image、chart、audio、function_call
可选
text
object {1}
响应文本对象
可选
显示子属性
隐藏子属性
data
string
响应的具体内容字符串(润色结果)
可选
event
object {3}
事件信息对象
可选
显示子属性
隐藏子属性
status
string
事件执行状态。
枚举值:
preparing:运行中。
running:运行中。
error:错误。
done:执行完成。
可选
error_code
string
错误码
可选
error_message
string
错误详情
可选
requestId
string
请求ID
可选
JSON
{
"code": "",
"message": "",
"status": "done",
"content": [
{
"type": "json",
"text": {
"data": "{\"output\":\"[ {\\\"original\\\": \\\"今天我去公园玩\\\", \\\"optimized\\\": \\\"今天阳光明媚,我怀着兴奋的心情,蹦蹦跳跳地来到了美丽的公园玩耍。\\\"}, {\\\"original\\\": \\\"天气很好\\\", \\\"optimized\\\": \\\"天空湛蓝,像被清水洗过一样,白云像棉花糖一样漂浮,天气好极了。\\\"}, {\\\"original\\\": \\\"我很开心\\\", \\\"optimized\\\": \\\"我像一只快乐的小鸟,在公园里跑来跑去,脸上洋溢着灿烂的笑容。\\\"} ]\"}"
},
"event": {
"status": "done",
"error_code": "",
"error_message": ""
}
}
],
"requestId": "test-request-123"
}
评价此篇文章
