mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-24 00:52:24 +00:00
test(bedrock): remove dead code from test_tool_choice_stripped_when_no_tools
Remove unused patch.object wrapper (no-op pass-through) and unused messages variable as flagged by Greptile review.
This commit is contained in:
parent
947acce268
commit
f20537708c
1 changed files with 11 additions and 21 deletions
|
|
@ -4586,34 +4586,24 @@ def test_tool_choice_stripped_when_no_tools():
|
|||
it must be popped before _transform_inference_params to avoid
|
||||
ValidationException from Bedrock.
|
||||
"""
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
from litellm.llms.bedrock.chat.converse_transformation import (
|
||||
AmazonConverseConfig,
|
||||
)
|
||||
|
||||
config = AmazonConverseConfig()
|
||||
inference_params = {
|
||||
optional_params = {
|
||||
"temperature": 0.7,
|
||||
"tool_choice": {"auto": {}},
|
||||
}
|
||||
|
||||
with patch.object(
|
||||
config,
|
||||
"_transform_request",
|
||||
wraps=config._transform_request,
|
||||
):
|
||||
messages = [{"role": "user", "content": [{"text": "Hello"}]}]
|
||||
optional_params = dict(inference_params)
|
||||
result = config.transform_request(
|
||||
model="anthropic.claude-3-sonnet-20240229-v1:0",
|
||||
messages=[{"role": "user", "content": "Hello"}],
|
||||
optional_params=optional_params,
|
||||
litellm_params={"api_base": None},
|
||||
headers={},
|
||||
)
|
||||
|
||||
result = config.transform_request(
|
||||
model="anthropic.claude-3-sonnet-20240229-v1:0",
|
||||
messages=[{"role": "user", "content": "Hello"}],
|
||||
optional_params=optional_params,
|
||||
litellm_params={"api_base": None},
|
||||
headers={},
|
||||
)
|
||||
|
||||
inference_config = result.get("inferenceConfig", {})
|
||||
assert "tool_choice" not in inference_config
|
||||
assert result.get("toolConfig") is None
|
||||
inference_config = result.get("inferenceConfig", {})
|
||||
assert "tool_choice" not in inference_config
|
||||
assert result.get("toolConfig") is None
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue