mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-01 07:03:02 +00:00
test: drop duplicate guard assertions
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
814fd2275e
commit
8fa1ed4066
2 changed files with 4 additions and 35 deletions
|
|
@ -9756,14 +9756,6 @@ def test_json_mode_text_without_tool_call_is_unchanged():
|
|||
assert message.tool_calls is None
|
||||
assert "json_mode_preamble_text" not in (message.provider_specific_fields or {})
|
||||
|
||||
preamble: Final = "Let me answer the question. "
|
||||
json_result: Final = _transform_json_mode_body(
|
||||
{**body, "content": [{"type": "text", "text": preamble}, *body["content"]]}
|
||||
)
|
||||
json_message: Final = json_result.choices[0].message
|
||||
assert json_message.content == '{"answer": "Hello"}'
|
||||
assert json_message.provider_specific_fields["json_mode_preamble_text"] == preamble
|
||||
|
||||
|
||||
def test_json_mode_with_a_real_tool_keeps_mixed_response_behavior():
|
||||
preamble: Final = "I will look up the details. "
|
||||
|
|
@ -9786,13 +9778,6 @@ def test_json_mode_with_a_real_tool_keeps_mixed_response_behavior():
|
|||
assert message.tool_calls[0].function.arguments == '{"location": "San Francisco"}'
|
||||
assert "json_mode_preamble_text" not in (message.provider_specific_fields or {})
|
||||
|
||||
json_result: Final = _transform_json_mode_body(
|
||||
{**body, "content": [{"type": "text", "text": preamble}, *body["content"]]}
|
||||
)
|
||||
json_message: Final = json_result.choices[0].message
|
||||
assert json_message.content == '{"answer": "Hello"}'
|
||||
assert json_message.provider_specific_fields["json_mode_preamble_text"] == preamble
|
||||
|
||||
|
||||
def test_non_dict_upstream_body_still_transforms_without_refusal_fields() -> None:
|
||||
result = AnthropicConfig().transform_parsed_response(
|
||||
|
|
|
|||
|
|
@ -6795,7 +6795,7 @@ def test_bedrock_json_mode_preserves_nonblank_text_before_json_tool_call():
|
|||
|
||||
|
||||
def test_bedrock_json_mode_omits_whitespace_only_preamble():
|
||||
whitespace_result: Final = _transform_json_mode_content_blocks(
|
||||
result: Final = _transform_json_mode_content_blocks(
|
||||
[
|
||||
{"text": " \n\t"},
|
||||
{
|
||||
|
|
@ -6808,25 +6808,9 @@ def test_bedrock_json_mode_omits_whitespace_only_preamble():
|
|||
]
|
||||
)
|
||||
|
||||
whitespace_message: Final = whitespace_result.choices[0].message
|
||||
assert whitespace_message.content == '{"answer": 42}'
|
||||
assert "json_mode_preamble_text" not in (whitespace_message.provider_specific_fields or {})
|
||||
|
||||
preamble: Final = "Here is the answer. "
|
||||
nonblank_result: Final = _transform_json_mode_content_blocks(
|
||||
[
|
||||
{"text": preamble},
|
||||
{
|
||||
"toolUse": {
|
||||
"toolUseId": "tooluse_json_001",
|
||||
"name": "json_tool_call",
|
||||
"input": {"answer": 42},
|
||||
}
|
||||
},
|
||||
]
|
||||
)
|
||||
nonblank_message: Final = nonblank_result.choices[0].message
|
||||
assert nonblank_message.provider_specific_fields["json_mode_preamble_text"] == preamble
|
||||
message: Final = result.choices[0].message
|
||||
assert message.content == '{"answer": 42}'
|
||||
assert "json_mode_preamble_text" not in (message.provider_specific_fields or {})
|
||||
|
||||
|
||||
def test_bedrock_json_mode_preamble_preserves_reasoning_content_fields():
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue