From 9905ecb2b02a5477acc60ac64053873bd0219002 Mon Sep 17 00:00:00 2001 From: Priyansh Nandwana Date: Sun, 6 Sep 2026 11:34:39 +0530 Subject: [PATCH] refactor(websearch): cut the helper and test docstrings to one line --- litellm/litellm_core_utils/core_helpers.py | 6 +----- tests/unit/litellm_core_utils/test_core_helpers.py | 6 +----- tests/unit/llms/custom_httpx/test_llm_http_handler.py | 6 +----- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/litellm/litellm_core_utils/core_helpers.py b/litellm/litellm_core_utils/core_helpers.py index f9216159cde..2472b9bf9b1 100644 --- a/litellm/litellm_core_utils/core_helpers.py +++ b/litellm/litellm_core_utils/core_helpers.py @@ -32,11 +32,7 @@ def is_codex_user_agent(user_agent: str) -> bool: def qualify_provider_stripped_model(model: str, custom_llm_provider: str) -> str: - """Put the provider prefix back on a provider-stripped model. - - A sub-path provider (``bedrock/mantle/...``) leaves a slash in the remainder, so - treating any slash as "already qualified" would drop the prefix. - """ + """Put the provider prefix back on a provider-stripped model.""" if not custom_llm_provider or model.startswith(f"{custom_llm_provider}/"): return model return f"{custom_llm_provider}/{model}" diff --git a/tests/unit/litellm_core_utils/test_core_helpers.py b/tests/unit/litellm_core_utils/test_core_helpers.py index 5cc861002f5..803705b8a56 100644 --- a/tests/unit/litellm_core_utils/test_core_helpers.py +++ b/tests/unit/litellm_core_utils/test_core_helpers.py @@ -590,10 +590,7 @@ class TestProviderResponseHeadersInHiddenParams: class TestQualifyProviderStrippedModel: - """#38829: an agentic follow-up re-dispatched the provider-stripped model. For providers - that route through a sub-path the remainder still holds a slash, and the old - "any slash means already qualified" test dropped the prefix, leaving a string - litellm.acompletion could not resolve a provider from.""" + """#38829: a model whose remainder still holds a slash must keep its provider prefix.""" @pytest.mark.parametrize( "model,provider,expected", @@ -619,7 +616,6 @@ class TestQualifyProviderStrippedModel: assert qualify_provider_stripped_model(model, provider) == model def test_a_provider_that_only_shares_a_prefix_is_still_qualified(self): - """`openai` must not be read as a prefix of `openai_like`.""" assert qualify_provider_stripped_model("openai_like/foo", "openai") == "openai/openai_like/foo" def test_no_provider_leaves_the_model_untouched(self): diff --git a/tests/unit/llms/custom_httpx/test_llm_http_handler.py b/tests/unit/llms/custom_httpx/test_llm_http_handler.py index 6cd74d1bbf1..60b37452eca 100644 --- a/tests/unit/llms/custom_httpx/test_llm_http_handler.py +++ b/tests/unit/llms/custom_httpx/test_llm_http_handler.py @@ -5059,10 +5059,7 @@ async def test_retrieve_file_rejects_unverified_bedrock_range_error( class TestAgenticFollowUpKeepsTheProviderPrefix: - """#38829: the follow-up re-dispatched the provider-stripped model. For a provider that - routes through a sub-path the remainder still holds a slash, so the old - "a slash means already qualified" test dropped the prefix and the follow-up raised - "LLM Provider NOT provided".""" + """#38829: the follow-up must re-dispatch a model litellm.acompletion can route.""" @staticmethod def _plan(): @@ -5094,7 +5091,6 @@ class TestAgenticFollowUpKeepsTheProviderPrefix: @pytest.mark.asyncio async def test_a_sub_path_model_still_resolves_a_provider(self): - """bedrock/mantle/... reaches the handler as mantle/..., which alone is unroutable.""" response = await self._run_followup("mantle/anthropic.claude-sonnet-5", "bedrock") assert response.choices[0].message.content == "ok from followup"