#24091 [Bug]: LiteLLM fails to parse Ollama's tool_calls when using function calling
### Check for existing issues
- [x] I have searched the existing issues and checked that my issue is not a duplicate.
### What happened?
When using LiteLLM to call an Ollama model (e.g., qwen3.5:9b) with tool definitions, the response from Ollama contains a valid tool_calls field, but LiteLLM does not expose it in the returned ModelResponse object. Instead, the message.tool_calls is None, and the model's text response is returned (e.g., asking for location) or, in some cases, the raw XML-style <tool_code> from the system prompt may appear.
Directly querying Ollama's API with the same payload works correctly and returns tool_calls.
> Environment > OS: Windows 11 > Python: 3.12.10 > LiteLLM version: 1.82.4 > Ollama version: 0.17.7 > Model: qwen3.5:9b
- Analysis
Ollama's response format for tool calls includes a message.tool_calls array, each with an id, function.name, and function.arguments (as an object). This is similar to OpenAI's format, but LiteLLM may not be correctly extracting it.
The issue seems to be in LiteLLM's Ollama response adapter (litellm/llms/ollama.py), where the tool_calls from the raw response are not mapped into the ModelResponse structure.
The finish_…