mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-10 03:28:53 +00:00
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:
parent
9ff9f91154
commit
077c607e3a
2 changed files with 2 additions and 2 deletions
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue