Bedrock Anthropic prompt caching middleware.
Requires:
A chat model that uses the Bedrock API.
Prompt Caching Middleware for ChatBedrock (InvokeModel API).
Optimizes API usage by caching conversation prefixes for Anthropic models on AWS Bedrock. Adds cache_control to the last message, caching the entire conversation prefix (including system prompt) for improved cache hits in multi-turn conversations.
Requires both 'langchain' and 'langchain-aws' packages to be installed.
Learn more about Anthropic prompt caching here.