fumito-ito / AnthropicSwiftSDK

Yet another Anthropic API client for Swift.
Apache License 2.0
7 stars 3 forks source link

Cache control support #27

Closed fumito-ito closed 2 months ago

fumito-ito commented 2 months ago

refs: https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching

Prompt Caching is a powerful feature that optimizes your API usage by allowing resuming from specific prefixes in your prompts. This approach significantly reduces processing time and costs for repetitive tasks or prompts with consistent elements.

Here’s an example of how to implement Prompt Caching with the Messages API using a cache_control in system prompt.