mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-04 02:31:27 +00:00
fix(anthropic): drop superseded adapters tool_reference test left over from main merge
Upstream's _tool_result_part refactor now preserves tool_reference blocks as ChatCompletionToolReferenceObject on the /v1/messages path, so the older [Loaded tool: ...] text expectation in the adapters test is superseded. The responses_adapters path (LiteLLMAnthropicToResponsesAPIAdapter) still converts tool references to loaded-tool text and keeps its own regression test.
This commit is contained in:
parent
b0735eef2e
commit
dfa2602920
1 changed files with 0 additions and 64 deletions
|
|
@ -1645,70 +1645,6 @@ def test_translate_anthropic_messages_to_openai_tool_result_single_item_backward
|
|||
assert tool_message["content"] == "72°F and sunny"
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("tool_references", "expected_content"),
|
||||
[
|
||||
(
|
||||
[{"type": "tool_reference", "tool_name": "get_weather"}],
|
||||
"[Loaded tool: get_weather]",
|
||||
),
|
||||
(
|
||||
[
|
||||
{"type": "tool_reference", "tool_name": "get_weather"},
|
||||
{"type": "tool_reference", "tool_name": "search_docs"},
|
||||
],
|
||||
[
|
||||
{"type": "text", "text": "[Loaded tool: get_weather]"},
|
||||
{"type": "text", "text": "[Loaded tool: search_docs]"},
|
||||
],
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_translate_anthropic_messages_to_openai_tool_reference_results(
|
||||
tool_references: list[dict[str, str]], expected_content: Any
|
||||
):
|
||||
anthropic_messages = [
|
||||
AnthopicMessagesAssistantMessageParam(
|
||||
role="assistant",
|
||||
content=[
|
||||
{
|
||||
"type": "tool_use",
|
||||
"id": "toolu_tool_search",
|
||||
"name": "ToolSearch",
|
||||
"input": {"query": "weather"},
|
||||
}
|
||||
],
|
||||
),
|
||||
AnthropicMessagesUserMessageParam(
|
||||
role="user",
|
||||
content=[
|
||||
{
|
||||
"type": "tool_result",
|
||||
"tool_use_id": "toolu_tool_search",
|
||||
"content": tool_references,
|
||||
}
|
||||
],
|
||||
),
|
||||
]
|
||||
|
||||
result = LiteLLMAnthropicMessagesAdapter().translate_anthropic_messages_to_openai(
|
||||
messages=anthropic_messages
|
||||
)
|
||||
|
||||
tool_messages = [
|
||||
message
|
||||
for message in result
|
||||
if isinstance(message, dict) and message.get("role") == "tool"
|
||||
]
|
||||
assert tool_messages == [
|
||||
{
|
||||
"role": "tool",
|
||||
"tool_call_id": "toolu_tool_search",
|
||||
"content": expected_content,
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
def test_streaming_chunk_with_both_text_and_tool_calls_issue_18238():
|
||||
"""
|
||||
When a streaming choice contains both text content and tool_calls,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue