vercel / ai

Build AI-powered applications with React, Svelte, Vue, and Solid
https://sdk.vercel.ai/docs
Other
10.18k stars 1.53k forks source link

Support Anthropic prompt caching for tool definitions #3820

Open namukang opened 1 day ago

namukang commented 1 day ago

Feature Description

The AI SDK currently supports Anthropic's prompt caching for system messages and messages (including tool calls and tool results), but not tool definitions: https://github.com/vercel/ai/discussions/3062#discussioncomment-10702467

Anthropic docs: https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching#what-can-be-cached AI SDK docs: https://sdk.vercel.ai/providers/ai-sdk-providers/anthropic#cache-control

I'd like to be able to implement prompt caching on the tool definitions using the AI SDK. Thank you!