Skip to content

Drop in a screenshot and convert it to clean code (HTML/Tailwind/React/Vue)

Python

support prompt caching for anthropic

Abi Raja8d7291cd7599
diff --git a/backend/agent/providers/anthropic.py b/backend/agent/providers/anthropic.py
index 05841042..2685c61d 100644
--- a/backend/agent/providers/anthropic.py
+++ b/backend/agent/providers/anthropic.py
@@ -271,6 +271,7 @@ class AnthropicProviderSession(ProviderSession):
"system": self._system_prompt,
"messages": self._messages,
"tools": self._tools,
+ "cache_control": {"type": "ephemeral"},
}
if self._model.value in ADAPTIVE_THINKING_MODELS:
diff --git a/backend/poetry.lock b/backend/poetry.lock
index 9e4fedf1..9bc1ef87 100644
--- a/backend/poetry.lock
+++ b/backend/poetry.lock
@@ -1,4 +1,4 @@
-# This file is automatically @generated by Poetry 2.1.3 and should not be changed by hand.
+# This file is automatically @generated by Poetry 2.3.2 and should not be changed by hand.
[[package]]
name = "aiohappyeyeballs"
@@ -140,14 +140,14 @@ files = [
[[package]]
name = "anthropic"
-version = "0.78.0"
+version = "0.84.0"
description = "The official Python library for the anthropic API"
optional = false
python-versions = ">=3.9"
groups = ["main"]
files = [
- {file = "anthropic-0.78.0-py3-none-any.whl", hash = "sha256:2a9887d2e99d1b0f9fe08857a1e9fe5d2d4030455dbf9ac65aab052e2efaeac4"},
- {file = "anthropic-0.78.0.tar.gz", hash = "sha256:55fd978ab9b049c61857463f4c4e9e092b24f892519c6d8078cee1713d8af06e"},
+ {file = "anthropic-0.84.0-py3-none-any.whl", hash = "sha256:861c4c50f91ca45f942e091d83b60530ad6d4f98733bfe648065364da05d29e7"},
+ {file = "anthropic-0.84.0.tar.gz", hash = "sha256:72f5f90e5aebe62dca316cb013629cfa24996b0f5a4593b8c3d712bc03c43c37"},
]
[package.dependencies]
@@ -163,6 +163,7 @@ typing-extensions = ">=4.10,<5"
[package.extras]
aiohttp = ["aiohttp", "httpx-aiohttp (>=0.1.9)"]
bedrock = ["boto3 (>=1.28.57)", "botocore (>=1.31.57)"]
+mcp = ["mcp (>=1.0) ; python_version >= \"3.10\""]
vertex = ["google-auth[requests] (>=2,<3)"]
[[package]]
@@ -2605,4 +2606,4 @@ type = ["pytest-mypy"]
[metadata]
lock-version = "2.1"
python-versions = "^3.10"
-content-hash = "4127a92b3846243520232b1447f6555c234a9c4d9a471ed045bf5b52dc53268e"
+content-hash = "b86b4d62ab193770370654df1c016d050d0d0c440a09d9e557b6da6d94a473a5"
diff --git a/backend/pyproject.toml b/backend/pyproject.toml
index 7f3565b4..a12d8594 100644
--- a/backend/pyproject.toml
+++ b/backend/pyproject.toml
@@ -16,7 +16,7 @@ python-dotenv = "^1.0.0"
beautifulsoup4 = "^4.12.2"
httpx = "^0.28.1"
pre-commit = "^3.6.2"
-anthropic = "^0.78.0"
+anthropic = "^0.84.0"
moviepy = "^1.0.3"
pillow = "^10.3.0"
types-pillow = "^10.2.0.20240520"