mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-09 03:18:44 +00:00
fix(anthropic): let add_code_execution_tool take the pass-through message union
The translator now emits role=system inside messages for models that accept it, so anthropic_messages_pt returns the pass-through union. add_code_execution_tool still declared the narrower user/assistant union while only ever reading content, so upstream's strip_advisor_blocks_from_messages call in between made the mismatch visible to the type checker.
This commit is contained in:
parent
2d57480f03
commit
154bb532e0
1 changed files with 6 additions and 3 deletions
|
|
@ -31,7 +31,7 @@ from litellm.types.llms.anthropic import (
|
|||
ANTHROPIC_ADVISOR_TOOL_TYPE,
|
||||
ANTHROPIC_BETA_HEADER_VALUES,
|
||||
ANTHROPIC_HOSTED_TOOLS,
|
||||
AllAnthropicMessageValues,
|
||||
AllAnthropicPassThroughMessageValues,
|
||||
AllAnthropicToolsValues,
|
||||
AnthropicCodeExecutionTool,
|
||||
AnthropicComputerTool,
|
||||
|
|
@ -1702,10 +1702,13 @@ class AnthropicConfig(AnthropicModelInfo, BaseConfig):
|
|||
|
||||
def add_code_execution_tool(
|
||||
self,
|
||||
messages: list[AllAnthropicMessageValues],
|
||||
messages: list[AllAnthropicPassThroughMessageValues],
|
||||
tools: list[AllAnthropicToolsValues | dict],
|
||||
) -> list[AllAnthropicToolsValues | dict]:
|
||||
"""if 'container_upload' in messages, add code_execution tool"""
|
||||
"""if 'container_upload' in messages, add code_execution tool
|
||||
|
||||
Takes the pass-through union because the translator emits ``role: "system"``
|
||||
in ``messages`` for models that accept it; only ``content`` is read here."""
|
||||
add_code_execution_tool = False
|
||||
for message in messages:
|
||||
message_content = message.get("content", None)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue