From 20c3a0ffe4d34c39e6e02897c7ec17f3340b539f Mon Sep 17 00:00:00 2001 From: Lucky Lodhi Date: Sun, 18 Jan 2026 18:27:27 +0000 Subject: [PATCH 1/3] fixed litellm params --- litellm/main.py | 54 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 3 deletions(-) diff --git a/litellm/main.py b/litellm/main.py index 969cf55a3d6..fb7b0bf8b4a 100644 --- a/litellm/main.py +++ b/litellm/main.py @@ -565,6 +565,10 @@ async def acompletion( model=model, custom_llm_provider=custom_llm_provider, api_base=completion_kwargs.get("base_url", None), + litellm_params=litellm.types.router.LiteLLM_Params( + model=model, + use_litellm_proxy=kwargs.get("use_litellm_proxy", False), + ), ) fallbacks = fallbacks or litellm.model_fallbacks @@ -1291,6 +1295,10 @@ def completion( # type: ignore # noqa: PLR0915 custom_llm_provider=custom_llm_provider, api_base=api_base, api_key=api_key, + litellm_params=litellm.types.router.LiteLLM_Params( + model=model, + use_litellm_proxy=kwargs.get("use_litellm_proxy", False), + ), ) if not _should_allow_input_examples( @@ -4368,6 +4376,10 @@ async def aembedding(*args, **kwargs) -> EmbeddingResponse: model=model, custom_llm_provider=custom_llm_provider, api_base=kwargs.get("api_base", None), + litellm_params=litellm.types.router.LiteLLM_Params( + model=model, + use_litellm_proxy=kwargs.get("use_litellm_proxy", False), + ), ) # Await normally @@ -4553,6 +4565,10 @@ def embedding( # noqa: PLR0915 custom_llm_provider=custom_llm_provider, api_base=api_base, api_key=api_key, + litellm_params=litellm.types.router.LiteLLM_Params( + model=model, + use_litellm_proxy=kwargs.get("use_litellm_proxy", False), + ), ) if dynamic_api_key is not None: @@ -5688,6 +5704,10 @@ def text_completion( # noqa: PLR0915 model=model, # type: ignore custom_llm_provider=custom_llm_provider, api_base=api_base, + litellm_params=litellm.types.router.LiteLLM_Params( + model=model, # type: ignore + use_litellm_proxy=kwargs.get("use_litellm_proxy", False), + ), ) if custom_llm_provider == "huggingface": @@ -5978,6 +5998,10 @@ async def amoderation( custom_llm_provider=custom_llm_provider, api_base=optional_params.api_base, api_key=optional_params.api_key, + litellm_params=litellm.types.router.LiteLLM_Params( + model=model or "", + use_litellm_proxy=kwargs.get("use_litellm_proxy", False), + ), ) except litellm.BadRequestError: # `model` is optional field for moderation - get_llm_provider will throw BadRequestError if model is not set / not recognized @@ -6043,7 +6067,12 @@ async def atranscription(*args, **kwargs) -> TranscriptionResponse: func_with_context = partial(ctx.run, func) _, custom_llm_provider, _, _ = get_llm_provider( - model=model, api_base=kwargs.get("api_base", None) + model=model, + api_base=kwargs.get("api_base", None), + litellm_params=litellm.types.router.LiteLLM_Params( + model=model, + use_litellm_proxy=kwargs.get("use_litellm_proxy", False), + ), ) # Await normally @@ -6147,6 +6176,10 @@ def transcription( custom_llm_provider=custom_llm_provider, api_base=api_base, api_key=api_key, + litellm_params=litellm.types.router.LiteLLM_Params( + model=model, + use_litellm_proxy=kwargs.get("use_litellm_proxy", False), + ), ) # type: ignore if dynamic_api_key is not None: @@ -6322,7 +6355,12 @@ async def aspeech(*args, **kwargs) -> HttpxBinaryResponseContent: func_with_context = partial(ctx.run, func) _, custom_llm_provider, _, _ = get_llm_provider( - model=model, api_base=kwargs.get("api_base", None) + model=model, + api_base=kwargs.get("api_base", None), + litellm_params=litellm.types.router.LiteLLM_Params( + model=model, + use_litellm_proxy=kwargs.get("use_litellm_proxy", False), + ), ) # Await normally @@ -6373,7 +6411,13 @@ def speech( # noqa: PLR0915 model_info = kwargs.get("model_info", None) shared_session = kwargs.get("shared_session", None) model, custom_llm_provider, dynamic_api_key, api_base = get_llm_provider( - model=model, custom_llm_provider=custom_llm_provider, api_base=api_base + model=model, + custom_llm_provider=custom_llm_provider, + api_base=api_base, + litellm_params=litellm.types.router.LiteLLM_Params( + model=model, + use_litellm_proxy=kwargs.get("use_litellm_proxy", False), + ), ) # type: ignore kwargs.pop("tags", []) @@ -6883,6 +6927,10 @@ async def ahealth_check( custom_llm_provider=custom_llm_provider_from_params, api_base=api_base_from_params, api_key=api_key_from_params, + litellm_params=litellm.types.router.LiteLLM_Params( + model=model, + use_litellm_proxy=model_params.get("use_litellm_proxy", False), + ), ) if model in litellm.model_cost and mode is None: mode = litellm.model_cost[model].get("mode") From c4013a34b8949c61ae498e2b6ab675052179e2f0 Mon Sep 17 00:00:00 2001 From: Lucky Lodhi Date: Mon, 19 Jan 2026 17:20:18 +0000 Subject: [PATCH 2/3] fix tool call for ollama - #19357 --- litellm/litellm_core_utils/prompt_templates/common_utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/litellm/litellm_core_utils/prompt_templates/common_utils.py b/litellm/litellm_core_utils/prompt_templates/common_utils.py index a8b8b207de4..7790fb83361 100644 --- a/litellm/litellm_core_utils/prompt_templates/common_utils.py +++ b/litellm/litellm_core_utils/prompt_templates/common_utils.py @@ -1071,9 +1071,9 @@ def _extract_reasoning_content(message: dict) -> Tuple[Optional[str], Optional[s """ message_content = message.get("content") if "reasoning_content" in message: - return message["reasoning_content"], message["content"] + return message["reasoning_content"], message_content elif "reasoning" in message: - return message["reasoning"], message["content"] + return message["reasoning"], message_content elif isinstance(message_content, str): return _parse_content_for_reasoning(message_content) return None, message_content From 74d3b1129068a96ebaac69bf06475dcde8fe1f85 Mon Sep 17 00:00:00 2001 From: Lucky Lodhi Date: Mon, 19 Jan 2026 17:38:29 +0000 Subject: [PATCH 3/3] undid changes --- litellm/main.py | 56 ++++--------------------------------------------- 1 file changed, 4 insertions(+), 52 deletions(-) diff --git a/litellm/main.py b/litellm/main.py index fb7b0bf8b4a..ae27b4145b3 100644 --- a/litellm/main.py +++ b/litellm/main.py @@ -565,10 +565,6 @@ async def acompletion( model=model, custom_llm_provider=custom_llm_provider, api_base=completion_kwargs.get("base_url", None), - litellm_params=litellm.types.router.LiteLLM_Params( - model=model, - use_litellm_proxy=kwargs.get("use_litellm_proxy", False), - ), ) fallbacks = fallbacks or litellm.model_fallbacks @@ -1295,10 +1291,6 @@ def completion( # type: ignore # noqa: PLR0915 custom_llm_provider=custom_llm_provider, api_base=api_base, api_key=api_key, - litellm_params=litellm.types.router.LiteLLM_Params( - model=model, - use_litellm_proxy=kwargs.get("use_litellm_proxy", False), - ), ) if not _should_allow_input_examples( @@ -4376,10 +4368,6 @@ async def aembedding(*args, **kwargs) -> EmbeddingResponse: model=model, custom_llm_provider=custom_llm_provider, api_base=kwargs.get("api_base", None), - litellm_params=litellm.types.router.LiteLLM_Params( - model=model, - use_litellm_proxy=kwargs.get("use_litellm_proxy", False), - ), ) # Await normally @@ -4565,10 +4553,6 @@ def embedding( # noqa: PLR0915 custom_llm_provider=custom_llm_provider, api_base=api_base, api_key=api_key, - litellm_params=litellm.types.router.LiteLLM_Params( - model=model, - use_litellm_proxy=kwargs.get("use_litellm_proxy", False), - ), ) if dynamic_api_key is not None: @@ -5704,10 +5688,6 @@ def text_completion( # noqa: PLR0915 model=model, # type: ignore custom_llm_provider=custom_llm_provider, api_base=api_base, - litellm_params=litellm.types.router.LiteLLM_Params( - model=model, # type: ignore - use_litellm_proxy=kwargs.get("use_litellm_proxy", False), - ), ) if custom_llm_provider == "huggingface": @@ -5998,10 +5978,6 @@ async def amoderation( custom_llm_provider=custom_llm_provider, api_base=optional_params.api_base, api_key=optional_params.api_key, - litellm_params=litellm.types.router.LiteLLM_Params( - model=model or "", - use_litellm_proxy=kwargs.get("use_litellm_proxy", False), - ), ) except litellm.BadRequestError: # `model` is optional field for moderation - get_llm_provider will throw BadRequestError if model is not set / not recognized @@ -6067,12 +6043,7 @@ async def atranscription(*args, **kwargs) -> TranscriptionResponse: func_with_context = partial(ctx.run, func) _, custom_llm_provider, _, _ = get_llm_provider( - model=model, - api_base=kwargs.get("api_base", None), - litellm_params=litellm.types.router.LiteLLM_Params( - model=model, - use_litellm_proxy=kwargs.get("use_litellm_proxy", False), - ), + model=model, api_base=kwargs.get("api_base", None) ) # Await normally @@ -6176,10 +6147,6 @@ def transcription( custom_llm_provider=custom_llm_provider, api_base=api_base, api_key=api_key, - litellm_params=litellm.types.router.LiteLLM_Params( - model=model, - use_litellm_proxy=kwargs.get("use_litellm_proxy", False), - ), ) # type: ignore if dynamic_api_key is not None: @@ -6355,12 +6322,7 @@ async def aspeech(*args, **kwargs) -> HttpxBinaryResponseContent: func_with_context = partial(ctx.run, func) _, custom_llm_provider, _, _ = get_llm_provider( - model=model, - api_base=kwargs.get("api_base", None), - litellm_params=litellm.types.router.LiteLLM_Params( - model=model, - use_litellm_proxy=kwargs.get("use_litellm_proxy", False), - ), + model=model, api_base=kwargs.get("api_base", None) ) # Await normally @@ -6411,13 +6373,7 @@ def speech( # noqa: PLR0915 model_info = kwargs.get("model_info", None) shared_session = kwargs.get("shared_session", None) model, custom_llm_provider, dynamic_api_key, api_base = get_llm_provider( - model=model, - custom_llm_provider=custom_llm_provider, - api_base=api_base, - litellm_params=litellm.types.router.LiteLLM_Params( - model=model, - use_litellm_proxy=kwargs.get("use_litellm_proxy", False), - ), + model=model, custom_llm_provider=custom_llm_provider, api_base=api_base ) # type: ignore kwargs.pop("tags", []) @@ -6927,10 +6883,6 @@ async def ahealth_check( custom_llm_provider=custom_llm_provider_from_params, api_base=api_base_from_params, api_key=api_key_from_params, - litellm_params=litellm.types.router.LiteLLM_Params( - model=model, - use_litellm_proxy=model_params.get("use_litellm_proxy", False), - ), ) if model in litellm.model_cost and mode is None: mode = litellm.model_cost[model].get("mode") @@ -7303,4 +7255,4 @@ def __getattr__(name: str) -> Any: global _encoding_cache _encoding_cache = _encoding return _encoding - raise AttributeError(f"module {__name__!r} has no attribute {name!r}") + raise AttributeError(f"module {__name__!r} has no attribute {name!r}") \ No newline at end of file