Skip to content

Commit

Permalink
Update anthropic type imports for v0.41.0 release (#17299)
Browse files Browse the repository at this point in the history
  • Loading branch information
mclean-connor authored Dec 17, 2024
1 parent d6b0f70 commit 5ac1a41
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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:"
Expand Down Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 5ac1a41

Please sign in to comment.