Skip to content

Commit 0034cfb

Browse files
committed
Add document to allowed cacheable_types for anthropic
1 parent e61bb5e commit 0034cfb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pydantic_ai_slim/pydantic_ai/models/anthropic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,7 @@ def _add_cache_control_to_last_param(params: list[BetaContentBlockParam], ttl: L
776776

777777
# Only certain types support cache_control
778778
# See https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching#what-can-be-cached
779-
cacheable_types = {'text', 'tool_use', 'server_tool_use', 'image', 'tool_result'}
779+
cacheable_types = {'text', 'tool_use', 'server_tool_use', 'image', 'tool_result', 'document'}
780780
# Cast needed because BetaContentBlockParam is a union including response Block types (Pydantic models)
781781
# that don't support dict operations, even though at runtime we only have request Param types (TypedDicts).
782782
last_param = cast(dict[str, Any], params[-1])

0 commit comments

Comments
 (0)