cache_control for prompt caching.
Store Anthropic-specific message flags like prompt caching
cache_control for prompt caching.
client.sessions.store_message(
session_id=session.id,
blob={
"role": "user",
"content": [
{
"type": "text",
"text": "<the entire contents of Pride and Prejudice>",
"cache_control": {"type": "ephemeral"}
}
]
},
format="anthropic"
)
# Retrieved messages preserve the cache_control flag
messages = client.sessions.get_messages(session_id=session.id, format="anthropic")