Closed stevekrouse closed 2 months ago
Agreed. ""cache_control": {"type": "ephemeral"}" code line in the 'make_non_cached_api_calls() function is doubtful.
Ah yes it includes the cache line but on the first hit this is only a cache write, not a cache read, and thus functions like a normal API call in terms of latency.
Maybe I am misunderstanding how to cache things, but this "non-cached" example seems cached:
https://github.com/anthropics/anthropic-cookbook/blob/7786b9f39db8ba65202792f564c59697a5222531/misc/prompt_caching.ipynb#L160
I wasn't able to find a key difference between it and the cached version.
For context, I'm trying to convert this notebook to javascript: https://www.val.town/v/stevekrouse/anthropicCaching