From 077c607e3abc2140576586ca685738d45759c724 Mon Sep 17 00:00:00 2001 From: Arthi Arumugam Date: Sun, 2 Aug 2026 08:49:13 +0530 Subject: [PATCH] fix(ollama): give the two new LIT violations a reason Merging staging in brought a tighter type-discipline budget with it, so two lines this PR already had became net-new violations against the new ceiling: the tool-call arguments annotation (LIT001) and the prompted_tool_calls fallback list (LIT002). Both are deliberate. The arguments field mirrors Ollama's arbitrary JSON argument object and the model is validated on construction, and the fallback has to be a fresh list per request because an empty one means no tools were offered and a shared default would leak across requests. Suppressed in place with reasons, as the gate asks, rather than moving the ceiling. --- litellm/llms/ollama/completion/transformation.py | 2 +- litellm/utils.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/litellm/llms/ollama/completion/transformation.py b/litellm/llms/ollama/completion/transformation.py index 7d35a7fc4f9..83f77b1ef62 100644 --- a/litellm/llms/ollama/completion/transformation.py +++ b/litellm/llms/ollama/completion/transformation.py @@ -473,7 +473,7 @@ class _OllamaJsonModeToolCall(BaseModel): model_config = ConfigDict(extra="forbid") name: str - arguments: dict[str, object] + arguments: dict[str, object] # mutable-ok: mirrors Ollama's arbitrary JSON argument object def _build_tool_call(response_text: str, tool_names: frozenset[str]) -> ChatCompletionToolCallChunk | None: diff --git a/litellm/utils.py b/litellm/utils.py index 1ddba30c6da..5cfce42379e 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -3915,7 +3915,7 @@ def pre_process_optional_params(passed_params: dict, non_default_params: dict, c non_default_params.pop("tool_choice", None) # causes ollama requests to hang elif "functions" in non_default_params: optional_params["functions_unsupported_model"] = non_default_params.pop("functions") - optional_params["prompted_tool_calls"] = optional_params.get("functions_unsupported_model") or [] + optional_params["prompted_tool_calls"] = optional_params.get("functions_unsupported_model") or [] # mutable-ok: fresh per-request list; empty means no tools offered elif litellm.add_function_to_prompt: # if user opts to add it to prompt instead optional_params["functions_unsupported_model"] = non_default_params.pop( "tools", non_default_params.pop("functions", None)