mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-01 07:03:02 +00:00
test(responses): shard the bridge check tests and mark their locals Final
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
4ffb145435
commit
39de3bcbab
3 changed files with 15 additions and 10 deletions
1
.github/workflows/test-unit.yml
vendored
1
.github/workflows/test-unit.yml
vendored
|
|
@ -735,6 +735,7 @@ jobs:
|
|||
tests/unit/responses/test_no_duplicate_spend_logs.py
|
||||
tests/unit/responses/test_null_test_fix.py
|
||||
tests/unit/responses/test_responses_api_bridge_flag.py
|
||||
tests/unit/responses/test_bridge_check.py
|
||||
tests/unit/responses/test_responses_api_lifecycle.py
|
||||
tests/unit/responses/test_responses_api_request_body.py
|
||||
tests/unit/responses/test_responses_prompt_management.py
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
Test for response_format to text.format conversion in completion -> responses bridge
|
||||
"""
|
||||
|
||||
from typing import Final
|
||||
|
||||
import pytest
|
||||
from litellm.completion_extras.litellm_responses_transformation.transformation import (
|
||||
LiteLLMResponsesTransformationHandler,
|
||||
|
|
@ -267,9 +269,9 @@ class _LoggingObj:
|
|||
def test_transform_request_flattens_chat_web_search_user_location_for_the_responses_tool():
|
||||
"""Chat Completions nests the location under `approximate`; OpenAI's Responses web_search tool rejects that
|
||||
key ("Unknown parameter: 'tools[0].user_location.approximate'") and takes the fields flat."""
|
||||
handler = LiteLLMResponsesTransformationHandler()
|
||||
handler: Final = LiteLLMResponsesTransformationHandler()
|
||||
|
||||
result = handler.transform_request(
|
||||
result: Final = handler.transform_request(
|
||||
model="gpt-5.6-sol",
|
||||
messages=[{"role": "user", "content": "What is a top local headline today?"}],
|
||||
optional_params={
|
||||
|
|
@ -293,9 +295,9 @@ def test_transform_request_flattens_chat_web_search_user_location_for_the_respon
|
|||
|
||||
|
||||
def test_transform_request_keeps_a_web_search_option_without_a_location_as_sent():
|
||||
handler = LiteLLMResponsesTransformationHandler()
|
||||
handler: Final = LiteLLMResponsesTransformationHandler()
|
||||
|
||||
result = handler.transform_request(
|
||||
result: Final = handler.transform_request(
|
||||
model="gpt-5.6-sol",
|
||||
messages=[{"role": "user", "content": "What is the top headline today?"}],
|
||||
optional_params={"web_search_options": {"search_context_size": "low"}},
|
||||
|
|
|
|||
|
|
@ -1,35 +1,37 @@
|
|||
from typing import Final
|
||||
|
||||
from litellm.responses.bridge_check import bridge_check_request_params
|
||||
|
||||
|
||||
def test_a_dropped_effort_inside_extra_body_is_not_read_by_the_route_decision():
|
||||
request = {
|
||||
request: Final = {
|
||||
"extra_body": {"reasoning_effort": "low", "reasoningSummary": "auto"},
|
||||
"additional_drop_params": ["reasoning_effort"],
|
||||
"tools": [{"type": "function", "function": {"name": "get_weather"}}],
|
||||
}
|
||||
|
||||
params = bridge_check_request_params(request)
|
||||
params: Final = bridge_check_request_params(request)
|
||||
|
||||
assert params["extra_body"] == {"reasoningSummary": "auto"}, params
|
||||
assert params["tools"] is request["tools"]
|
||||
|
||||
|
||||
def test_a_dropped_top_level_alias_is_removed_too():
|
||||
params = bridge_check_request_params({"reasoningSummary": "auto", "additional_drop_params": ["reasoningSummary"]})
|
||||
params: Final = bridge_check_request_params({"reasoningSummary": "auto", "additional_drop_params": ["reasoningSummary"]})
|
||||
|
||||
assert "reasoningSummary" not in params, params
|
||||
|
||||
|
||||
def test_a_request_without_drops_is_returned_whole():
|
||||
request = {"extra_body": {"reasoning_effort": "low"}, "tools": []}
|
||||
request: Final = {"extra_body": {"reasoning_effort": "low"}, "tools": []}
|
||||
|
||||
params = bridge_check_request_params(request)
|
||||
params: Final = bridge_check_request_params(request)
|
||||
|
||||
assert params == request
|
||||
assert params["extra_body"] == {"reasoning_effort": "low"}
|
||||
|
||||
|
||||
def test_a_non_list_additional_drop_params_drops_nothing():
|
||||
request = {"extra_body": {"reasoning_effort": "low"}, "additional_drop_params": "reasoning_effort"}
|
||||
request: Final = {"extra_body": {"reasoning_effort": "low"}, "additional_drop_params": "reasoning_effort"}
|
||||
|
||||
assert bridge_check_request_params(request)["extra_body"] == {"reasoning_effort": "low"}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue