AWS 详解在 Amazon Bedrock 上使用 OpenAI 模型的提示词缓存模式
AWS 发布教程,介绍在 Amazon Bedrock 上调用 OpenAI 模型时如何用提示词缓存降低智能体重复读取上下文的成本,区分隐式缓存与显式 prompt_cache_breakpoint 两种方式并建议组合使用。文中给出工具与指令缓存、多轮历史滚动断点、会话中途新增工具、子智能体共享前缀等代码示例,并称在 GPT-6 Astra 的六轮工作负载中隐式缓存降低约 62% 输入成本,显式滚动断点降低约 61%。可缓存前缀需至少 1024 token,缓存写入按正常输入价格的 1.25 倍计费。

态部分:即在各请求之间保持不变的各类工具和指令。这些示例使用你现有的 Amazon Bedrock 客户端、 TOOLS,以及 task请将缩短的 INSTRUCTIONS 字符串替换为你真实的策略和示例。可复用的前缀必须达到 1,024 个 token 才符合条件。 缓存静态内容时,请使用显式模式:选择已保存前缀的结束位置。 KEY = "support-agent:v7:gpt-6-astra" INSTRUCTIONS = "Your full support policies and examples..." Rendered context: [provider context][TOOLS][INSTRUCTIONS] | [task] Cache starts at the beginning; the marker below chooses its end. resp = client.responses.create( model="us.openai.gpt-6-astra", store=False, Response storage; prompt cachi
匹配字段正文


