Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for Prompt Caching for Anthropic when using InvokeModel API #356

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

patcheng
Copy link

Using langchain's example for creating SystemMessage and HumanMessage for prompt caching:
https://js.langchain.com/docs/integrations/chat/anthropic/#prompt-caching

Looks like SystemMessage's content could be non-string, added support for that.

Using AWS Bedrock's InvokeModel API prompt caching example on what message is supposed to structure:
https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching#large-context-caching-example

Doesn't look like SystemMessage supports prompt caching, so ignore the cache_control.

But preserve that for HumanMessage

Added tests for the change

@3coins 3coins added this to the 2025 Feb Release 2 milestone Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants