vercel/ai

Anthropic cache-control flag not passed to assistant messages

Closed this issue · 1 comments

Description

The current implementation doesn't pass cache control flags to assistant messages: https://github.com/vercel/ai/blob/main/packages/anthropic/src/convert-to-anthropic-messages-prompt.ts#L180

Whereas anthropic allows assistant messages to be cached as well:
https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching#:~:text=for%20both%20user%20and%20assistant%20turns

Code example

No response

Additional context

No response

Fix: #2890