mirror of
https://github.com/langgenius/dify-official-plugins.git
synced 2026-07-21 17:45:23 -04:00
[PR #1268] [MERGED] refract: anthropic claude prompt caching #1807
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/langgenius/dify-official-plugins/pull/1268
Author: @fdb02983rhy
Created: 7/11/2025
Status: ✅ Merged
Merged: 7/12/2025
Merged by: @crazywoola
Base:
main← Head:feat-anthropic-claude-prompt-caching📝 Commits (4)
ee0605dfeat: anthropic claude prompt caching49e95c1Update llm.pyd14607dImprove cache block pruning by prioritizing longer textb63e215Handle base64 source data length in LLM blocks📊 Changes
11 files changed (+671 additions, -189 deletions)
View changed files
📝
models/anthropic/README.md(+22 -0)📝
models/anthropic/main.py(+3 -0)📝
models/anthropic/manifest.yaml(+1 -1)📝
models/anthropic/models/llm/claude-3-5-haiku-20241022.yaml(+60 -0)📝
models/anthropic/models/llm/claude-3-5-sonnet-20240620.yaml(+60 -0)📝
models/anthropic/models/llm/claude-3-5-sonnet-20241022.yaml(+60 -0)📝
models/anthropic/models/llm/claude-3-7-sonnet-20250219.yaml(+60 -0)📝
models/anthropic/models/llm/claude-opus-4-20250514.yaml(+60 -0)📝
models/anthropic/models/llm/claude-sonnet-4-20250514.yaml(+60 -0)📝
models/anthropic/models/llm/llm.py(+284 -187)📝
models/anthropic/requirements.txt(+1 -1)📄 Description
Related Issues or Context
Also handle multi-modal contents in best practice.

https://docs.anthropic.com/en/docs/build-with-claude/pdf-support#:~:text=Send%20your%20first%20PDF%20request
https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching
This PR contains Changes to Non-Plugin
This PR contains Changes to Non-LLM Models Plugin
This PR contains Changes to LLM Models Plugin
Before Caching
After Caching
Tool Definitions Caching
Images and Documents Caching
System Message Caching
Tool Use Results Caching
Assistant and User Message Flow Caching
Version Control (Any Changes to the Plugin Will Require Bumping the Version)
VersionField, Not in Meta Section)Dify Plugin SDK Version
dify_plugin>=0.3.0,<0.5.0is in requirements.txt (SDK docs)Environment Verification (If Any Code Changes)
Local Deployment Environment
SaaS Environment
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.