From ee86931b0dddd23fc87ee43456254ca36e9f7af4 Mon Sep 17 00:00:00 2001 From: woongstardev Date: Tue, 22 Sep 2026 21:25:21 +0900 Subject: [PATCH] chore(ollama): mark the object cast at the helper call sites as cast-ok The loop value is untyped dict content, so widening it to object is the only way to hand it to the typed helper without a new unknown-argument report. Names the LIT006 suppression and its reason as the gate expects --- litellm/llms/ollama/chat/transformation.py | 8 +++++++- litellm/llms/ollama/completion/transformation.py | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/litellm/llms/ollama/chat/transformation.py b/litellm/llms/ollama/chat/transformation.py index cdc0ad00786..e63448fc0d6 100644 --- a/litellm/llms/ollama/chat/transformation.py +++ b/litellm/llms/ollama/chat/transformation.py @@ -172,7 +172,13 @@ class OllamaChatConfig(BaseConfig): optional_params["format"] = value["json_schema"]["schema"] if ( param == "reasoning_effort" - and (think := think_from_reasoning_effort(model, cast(object, value))) is not None + and ( + think := think_from_reasoning_effort( + model, + cast(object, value), # cast-ok: [LIT006] untyped dict value, widened to object for the helper + ) + ) + is not None ): optional_params["think"] = think ### FUNCTION CALLING LOGIC ### diff --git a/litellm/llms/ollama/completion/transformation.py b/litellm/llms/ollama/completion/transformation.py index b0cb2d4ed27..b712bb7cc5b 100644 --- a/litellm/llms/ollama/completion/transformation.py +++ b/litellm/llms/ollama/completion/transformation.py @@ -216,7 +216,13 @@ class OllamaConfig(BaseConfig): optional_params["stop"] = value elif ( param == "reasoning_effort" - and (think := think_from_reasoning_effort(model, cast(object, value))) is not None + and ( + think := think_from_reasoning_effort( + model, + cast(object, value), # cast-ok: [LIT006] untyped dict value, widened to object for the helper + ) + ) + is not None ): optional_params["think"] = think elif param == "response_format" and isinstance(value, dict):