Skip to content

[FEAT]: Prompt Caching for Claude Sonnet 3.5 #2500

@brian12184

Description

@brian12184

What would you like to see?

It would be helpful to support prompt caching for Claude 3.5 Sonnet. This not only helps cut down on LLM costs, but also latency.

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

This can be done by adding an extra header, as an example...

with anthropic_client.beta.prompt_caching.messages.stream( system=system_prompt, model="claude-3-5-sonnet-20240620", max_tokens=8000, temperature=0, messages=messages, extra_headers={"anthropic-beta": "prompt-caching-2024-07-31"} ) as stream:

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions