You need to enable JavaScript to run this app.
文档中心
火山方舟

火山方舟

复制全文
下载 pdf
使用 Responses API
上下文编辑
复制全文
下载 pdf
上下文编辑
上下文编辑功能可以管理上下文中思维链内容及工具调用内容,具备以下优势:​
  • 工具使用效果提升:能够让模型利用历史上下文中思考的内容,提高工具触发及使用效果。​
  • 上下文窗口管理:自动保持在模型上下文窗口限制内。​
  • 智能缓存:与缓存功能协同工作,优化性能。​
说明​
该能力尚在 beta 阶段,请谨慎在生产环境使用。​
支持模型​
  • doubao-seed-evolving​
  • doubao-seed-2-1-pro-260915​
  • doubao-seed-2-1-lite-260915​
  • doubao-seed-2-1-pro-260628​
  • doubao-seed-2-1-turbo-260628​
  • doubao-seed-2-0-lite-260428​
  • doubao-seed-2-0-mini-260428​
  • doubao-seed-2-0-pro-260215​
  • doubao-seed-2-0-lite-260215​
  • doubao-seed-2-0-mini-260215​
  • doubao-seed-2-0-code-preview-260215​
  • doubao-seed-character-260628​
API 文档​
功能策略​
​
功能策略​
标识符​
描述​
思维链内容清除​
clear_thinking​
在开启思考时管理思维链内容。​
该策略会自动清除先前轮次较旧的思维链内容。​
工具调用内容清除​
clear_tool_uses​
在对话上下文增长超过配置的阈值时清除工具调用内容。​
该策略会自动清除先前轮次较旧的工具调用内容。​
​
思维链内容清除​
配置项​
clear_thinking 策略支持以下配置:​
​
配置项​
类型​
默认值​
说明​
keep​
Object / String​
{type: "thinking_turns", value: 1}​
定义思维链保留策略。​
​
保留轮次同时覆盖工具调用和非工具调用场景,只基于轮数判断。​
配置示例:​
  • 保留最近 N 个轮次的思维链内容:(N 必须 > 0)​
  • ​
    // 保留最近 3 个轮次的思维链内容​
    {​
    "type": "clear_thinking",​
    "keep": {​
    "type": "thinking_turns",​
    "value": 3​
    }​
    }​
    ​
  • 保留所有思维链内容:​
  • ​
    {​
    "type": "clear_thinking",​
    "keep": "all"​
    }​
    ​
使用示例​
​
Curl
​
​
curl https://ark.cn-beijing.volces.com/api/v3/responses \​
-H "Authorization: Bearer $ARK_API_KEY" \​
-H "Content-Type: application/json" \​
-d '{​
"model": "doubao-seed-2-0-lite-260215",​
"input": "推理模型与非推理模型区别。",​
"thinking":{"type": "enabled"},​
"context_management": {​
"edits": [​
{​
"type": "clear_thinking",​
"keep": {​
"type": "thinking_turns",​
"value": 3​
}​
}​
]​
}​
}'​
​
​
工具调用内容清除​
配置项​
clear_tool_uses策略支持以下配置:​
​
配置项​
类型​
默认值​
说明​
trigger​
Object​
​
触发工具调用内容清除策略的阈值。​
keep​
object​
3 轮工具调用​
保留最近 N 轮工具调用内容。​
exclude_tools​
Array​
​
不会被清除的工具名称列表,用于保留重要上下文。​
clear_tool_inputs​
Bool​
false​
是否清除工具调用参数。​
​
配置示例:​
​
{​
"type": "clear_tool_uses",​
"trigger": {​
"type": "tool_uses",​
"value": 5​
},​
"keep": {​
"type": "tool_uses",​
"value": 3​
},​
"exclude_tools": [​
"web_search"​
]​
}​
​
使用示例​
​
Curl
​
​
curl https://ark.cn-beijing.volces.com/api/v3/responses \​
-H "Authorization: Bearer $ARK_API_KEY" \​
-H "Content-Type: application/json" \​
-d '{​
"model": "doubao-seed-2-0-lite-260215",​
"input": [​
{​
"role": "system",​
"content": "你是人工智能助手."​
},​
{​
"role": "user",​
"content": "今天北京天气怎么样"​
}​
],​
"thinking":{"type": "enabled"},​
"tools": [​
{​
"type": "function",​
"name": "get_weather",​
"description": "根据城市名称查询该城市当日天气(含温度、天气状况)",​
"parameters": {​
"type": "object",​
"properties": {​
"location": {​
"type": "string",​
"description": "城市名称,如北京、上海(仅支持国内地级市)"​
}​
},​
"required": ["location"]​
}​
}​
],​
"context_management": {​
"edits": [​
{​
"type": "clear_tool_uses",​
"trigger": {​
"type": "tool_uses",​
"value": 5​
}​
}​
]​
}​
}'​
​
​
组合策略​
可以同时使用思维链内容清除和工具调用内容清除,使用多个策略时:​
  • 定义顺序:clear_thinking 必须排在 clear_tool_uses 之前。​
  • 处理顺序:先处理思维链内容清除,再处理工具调用内容清除。​
​
Curl
​
​
curl https://ark.cn-beijing.volces.com/api/v3/responses \​
-H "Authorization: Bearer $ARK_API_KEY" \​
-H "Content-Type: application/json" \​
-d '{​
"model": "doubao-seed-2-0-lite-260215",​
"input": [​
{​
"role": "system",​
"content": "你是人工智能助手."​
},​
{​
"role": "user",​
"content": "今天北京天气怎么样"​
}​
],​
"thinking":{"type": "enabled"},​
"tools": [​
{​
"type": "function",​
"name": "get_weather",​
"description": "根据城市名称查询该城市当日天气(含温度、天气状况)",​
"parameters": {​
"type": "object",​
"properties": {​
"location": {​
"type": "string",​
"description": "城市名称,如北京、上海(仅支持国内地级市)"​
}​
},​
"required": ["location"]​
}​
}​
],​
"context_management": {​
"edits": [​
{​
"type": "clear_thinking",​
"keep": {​
"type": "thinking_turns",​
"value": 3​
}​
},​
{​
"type": "clear_tool_uses",​
"trigger": {​
"type": "tool_uses",​
"value": 5​
}​
}​
]​
}​
}'​
​
​
​
最近更新时间:2026.09.21 17:32:49
这个页面对您有帮助吗?
有用
有用
无用
无用