Skip to content

Commit

Permalink
update anthropic type imports
Browse files Browse the repository at this point in the history
  • Loading branch information
mclean-connor committed Dec 17, 2024
1 parent ea589c0 commit 72e1a85
Showing 1 changed file with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,9 @@
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,10 +152,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(
cache_control=CacheControlEphemeralParam(
type="ephemeral"
),
)
Expand Down

0 comments on commit 72e1a85

Please sign in to comment.