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.
This commit is contained in:
Arthi Arumugam 2026-08-02 08:49:13 +05:30
parent 9ff9f91154
commit 077c607e3a
2 changed files with 2 additions and 2 deletions

View file

@ -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:

View file

@ -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)