diff --git a/llama-index-integrations/llms/llama-index-llms-anthropic/llama_index/llms/anthropic/utils.py b/llama-index-integrations/llms/llama-index-llms-anthropic/llama_index/llms/anthropic/utils.py index dd1e906c43243..c41eb10d36857 100644 --- a/llama-index-integrations/llms/llama-index-llms-anthropic/llama_index/llms/anthropic/utils.py +++ b/llama-index-integrations/llms/llama-index-llms-anthropic/llama_index/llms/anthropic/utils.py @@ -12,13 +12,14 @@ TextBlock, ) -from anthropic.types import MessageParam, TextBlockParam, ImageBlockParam +from anthropic.types import ( + MessageParam, + TextBlockParam, + ImageBlockParam, + CacheControlEphemeralParam, +) from anthropic.types.tool_result_block_param import ToolResultBlockParam from anthropic.types.tool_use_block_param import ToolUseBlockParam -from anthropic.types.beta.prompt_caching import ( - PromptCachingBetaTextBlockParam, - PromptCachingBetaCacheControlEphemeralParam, -) HUMAN_PREFIX = "\n\nHuman:" ASSISTANT_PREFIX = "\n\nAssistant:" @@ -156,12 +157,10 @@ def messages_to_anthropic_messages( for block in message.blocks: if isinstance(block, TextBlock): content_ = ( - PromptCachingBetaTextBlockParam( + TextBlockParam( text=block.text, type="text", - cache_control=PromptCachingBetaCacheControlEphemeralParam( - type="ephemeral" - ), + cache_control=CacheControlEphemeralParam(type="ephemeral"), ) if "cache_control" in message.additional_kwargs else TextBlockParam(text=block.text, type="text") diff --git a/llama-index-integrations/llms/llama-index-llms-anthropic/pyproject.toml b/llama-index-integrations/llms/llama-index-llms-anthropic/pyproject.toml index 9756e0e500716..9cd67a3377b62 100644 --- a/llama-index-integrations/llms/llama-index-llms-anthropic/pyproject.toml +++ b/llama-index-integrations/llms/llama-index-llms-anthropic/pyproject.toml @@ -27,11 +27,11 @@ exclude = ["**/BUILD"] license = "MIT" name = "llama-index-llms-anthropic" readme = "README.md" -version = "0.6.1" +version = "0.6.3" [tool.poetry.dependencies] python = ">=3.9,<4.0" -anthropic = {extras = ["bedrock", "vertex"], version = ">=0.39.0"} +anthropic = {extras = ["bedrock", "vertex"], version = ">=0.41.0"} llama-index-core = "^0.12.5" [tool.poetry.group.dev.dependencies] diff --git a/llama-index-integrations/llms/llama-index-llms-bedrock/pyproject.toml b/llama-index-integrations/llms/llama-index-llms-bedrock/pyproject.toml index 20f28280db1f3..234830b74eeb9 100644 --- a/llama-index-integrations/llms/llama-index-llms-bedrock/pyproject.toml +++ b/llama-index-integrations/llms/llama-index-llms-bedrock/pyproject.toml @@ -31,7 +31,7 @@ version = "0.3.1" [tool.poetry.dependencies] python = ">=3.9,<4.0" -llama-index-llms-anthropic = "^0.5.0" +llama-index-llms-anthropic = "^0.6.3" boto3 = "^1.34.26" llama-index-core = "^0.12.0" diff --git a/llama-index-integrations/llms/llama-index-llms-portkey/pyproject.toml b/llama-index-integrations/llms/llama-index-llms-portkey/pyproject.toml index 0d29002982a3e..fc36a0bb50a1f 100644 --- a/llama-index-integrations/llms/llama-index-llms-portkey/pyproject.toml +++ b/llama-index-integrations/llms/llama-index-llms-portkey/pyproject.toml @@ -31,7 +31,7 @@ version = "0.3.0" [tool.poetry.dependencies] python = ">=3.9,<4.0" -llama-index-llms-anthropic = "^0.5.0" +llama-index-llms-anthropic = "^0.6.3" portkey-ai = "^1.1.4" portkey = "^0.1.2" llama-index-llms-openai = "^0.3.0"