mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-17 04:34:25 +00:00
fix(anthropic): index message role directly in cache control hook
This commit is contained in:
parent
6a251ac5dc
commit
74d2d617a0
1 changed files with 1 additions and 1 deletions
|
|
@ -614,7 +614,7 @@ class AnthropicCacheControlHook(CustomPromptManagement):
|
|||
# 1. string content, or a tool message: insert cache control at message level.
|
||||
# Anthropic only accepts cache_control on the tool_result block itself, never
|
||||
# inside tool_result.content; the message-level marker maps onto that block.
|
||||
if message.get("role") == "tool" or isinstance(message_content, str):
|
||||
if message["role"] == "tool" or isinstance(message_content, str):
|
||||
message["cache_control"] = control
|
||||
# 2. list of objects - only apply to last item per Anthropic spec
|
||||
elif isinstance(message_content, list):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue