mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-11 08:38:24 +00:00
fix(responses): keep router default stream off plain retrieves
This commit is contained in:
parent
310bf4fe02
commit
c0090b6fda
2 changed files with 12 additions and 4 deletions
|
|
@ -4833,7 +4833,7 @@ class Router:
|
|||
Handles inserting this as either "metadata" or "litellm_metadata" depending on the metadata_variable_name
|
||||
"""
|
||||
# 1) copy your defaults and pull out metadata
|
||||
defaults: Final = self.default_litellm_params.copy()
|
||||
defaults: Final = dict(without_retrieve_stream_defaults(self.default_litellm_params, kwargs))
|
||||
metadata_defaults: Final = defaults.pop("metadata", {}) or {}
|
||||
|
||||
# 2) add any non-metadata defaults that aren't already in kwargs
|
||||
|
|
|
|||
|
|
@ -541,7 +541,14 @@ async def test_a_routed_resume_requested_in_extra_query_gets_the_deployment_stre
|
|||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_a_routed_plain_retrieve_on_a_deployment_that_forces_stream_answers_the_response_object() -> None:
|
||||
@pytest.mark.parametrize(
|
||||
("deployment_stream", "router_defaults"),
|
||||
[({"stream": True}, None), ({}, {"stream": True})],
|
||||
ids=["deployment_forces_stream", "router_default_forces_stream"],
|
||||
)
|
||||
async def test_a_routed_plain_retrieve_where_config_forces_stream_answers_the_response_object(
|
||||
deployment_stream: dict[str, bool], router_defaults: dict[str, bool] | None
|
||||
) -> None:
|
||||
router: Final = litellm.Router(
|
||||
model_list=[
|
||||
{
|
||||
|
|
@ -550,10 +557,11 @@ async def test_a_routed_plain_retrieve_on_a_deployment_that_forces_stream_answer
|
|||
"model": "openai/gpt-5.5",
|
||||
"api_key": "sk-test",
|
||||
"api_base": "https://api.openai.com/v1",
|
||||
"stream": True,
|
||||
**deployment_stream,
|
||||
},
|
||||
}
|
||||
]
|
||||
],
|
||||
default_litellm_params=router_defaults,
|
||||
)
|
||||
with respx.mock() as mock_router:
|
||||
route: Final = _retrieve_route(mock_router, "openai").mock(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue