Commit Graph

3 Commits

Author SHA1 Message Date
Pyry Takala 5a3d340ec4 fix: add type ignores for pyright in cache tests
Content blocks are dictionaries at runtime despite type annotations
indicating Pydantic models. Added type: ignore comments to allow
dictionary-style .get() access which works correctly at runtime.
2025-11-21 01:12:56 +00:00
Pyry Takala 3787380829 fix: apply cache_control only to last block in Anthropic messages
Previously, cache_control was applied to every content block and tool call
in a message, which could exceed Anthropic's limit of 4 cache breakpoints
per request. This fix ensures cache_control is only applied to the last
block in each message type:
- Last text block in UserMessage/AssistantMessage content
- Last tool_use block when AssistantMessage has tool calls
- Only the last overall block when AssistantMessage has both content and tools

This prevents exceeding the cache breakpoint limit while maintaining
correct caching behavior.
2025-11-21 01:04:12 +00:00
Gregor Žunič 2ee526d903 updated pricing for cached tokens support 2025-06-25 15:33:47 +02:00