Skip to content

Conversation

@Wh1isper
Copy link
Contributor

@Wh1isper Wh1isper commented Nov 15, 2025

closes #3441

see #3441 for more details

@Wh1isper Wh1isper changed the title feat: add anthropic_cache_all in AnthropicModel for auto caching all … feat: add anthropic_cache_all in AnthropicModel Nov 15, 2025
See https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching for more information.
"""

anthropic_cache_all_ttl: Literal['5m', '1h']
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #3450 for notes on how we could handle TTL

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good, let's move forward with #3450 first

model_settings=AnthropicModelSettings(
anthropic_cache_all=True,
anthropic_cache_instructions=True,
anthropic_cache_tool_definitions=True,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need these 2 if cache_all is used?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think with #3450, we should consider their priority.

For instructions and tool_definitions, first respect the string values of anthropic_cache_tool_definitions and anthropic_cache_instructions, then use the string value of anthropic_cache_all.

@Wh1isper
Copy link
Contributor Author

One more thing, if enable anthropic_cache_all, we should ignore all CachePoint in message history

@DouweM
Copy link
Collaborator

DouweM commented Nov 18, 2025

One more thing, if enable anthropic_cache_all, we should ignore all CachePoint in message history

@Wh1isper Ignore all, or only respect the final 4 i.e. #3467?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Anthropic prompt caching for tool response

2 participants