[RFC] 093 - Anthropic Context Caching #6705
Replies: 5 comments 10 replies
-
请问 tools 定义要不要考虑也加上缓存呢? https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching#caching-tool-definitions |
Beta Was this translation helpful? Give feedback.
-
aws bedrock 的 claude 模型支持么? |
Beta Was this translation helpful? Give feedback.
-
又实际跑了下,5w token 下,这个节省的成本力度是非常爽了: ![]() ![]() 如果按缓存前原价: 186750,缓存后 33590,缓存后价格是缓存前的 17% |
Beta Was this translation helpful? Give feedback.
-
能不能支持openrouter的Claude模型呢? |
Beta Was this translation helpful? Give feedback.
-
一个完整的演示视频: Thinking+.CoT.mp4 |
Beta Was this translation helpful? Give feedback.
-
背景
#6595 做了 Claude 3.7 搜索之后效果真的很好,但是需要 context cache 支持来降低成本。目前已经完成前置准备工作( #6699 ) , 支持了 token 的展示。
之前也有社区的讨论 issue:
本 RFC 将完成 Anthropic Context Caching 的接入集成。
设计思路
参考 Anthropic 的官方文档 ,目前做 Context Caching 已经非常容易了。
在 https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching#continuing-a-multi-turn-conversation 这一章节, Anthropic 给了一个很好的示例,介绍了多轮对话中如何添加 cache control:
其实非常简单,只需要在 systems 和最后一条 message 中添加
"cache_control": {"type": "ephemeral"}
即可。然后由于这个配置是 claude 专属,因此会新增一个模型级别的配置参数,用于对这个 context caching 进行控制。
进展
Beta Was this translation helpful? Give feedback.
All reactions