#369·aisuite

Groq + Ollama tool calling (max_turns) broken: reasoning_content, is_mcp_config, and empty tools bugs

Author: mitesh1112Created Jul 17, 2026Updated Jul 17, 2026

Description

Using client.chat.completions.create(..., tools=[...], max_turns=N) for automatic tool execution fails for both the Groq and Ollama providers, in three distinct ways depending on setup. Manually looping (executing tool_calls myself, without max_turns) works for Ollama but tool calling with max_turns does not work reliably for either provider.

Environment

  • aisuite version: [run pip show aisuite and paste version]
  • OS: Windows
  • Python: [run python --version]
  • Models tested: groq:llama-3.3-70b-versatile, ollama:llama3.1:8b, ollama:llama3.2:3b

Bug 1: Groq — 'reasoning_content' is unsupported

With max_turns=3 on Groq, the second turn fails:

BadRequestError: Error code: 400 - {'error': {'message': "'messages.1' : for 'role:assistant' the following must be satisfied[('messages.1' : property 'reasoning_content' is unsupported)]"}} ​

Repro: ​```python import aisuite as ai

def get_weather(city: str) -> str: """Get the current weather for a city.""" return f"It's sunny in {city}, 25°C"

client = ai.Client() messages = [{"role": "user", "content": "What's the weather in Tokyo? Use the get_weather tool."}] response = client.chat.completions.create( model="groq:llama-3.3-70b-versatile", messages=messages, tools=[get_weather], tool_choice="required", max_turns=3 ) ​```

Bug 2: NameError: is_mcp_config not defined

When the optional mcp package is not installed, _process_mcp_configs in client.py falls into a broken except-branch that references is_mcp_config, which was never imported/defined in that branch:

NameError: name 'is_mcp_config' is not defined ​ (Full traceback: client.py line 148, inside _process_mcp_configs)

Workaround: pip install mcp avoids the broken branch, but the except-path itself is still broken and should raise its intended ImportError instead of NameError.

Bug 3: Groq — "tool_choice is required no tools or functions are defined"

When passing tools as OpenAI-format JSON schemas (not raw functions) without max_turns, Groq rejects the request saying no tools were sent, suggesting the tools list isn't being forwarded correctly:

BadRequestError: Error code: 400 - {'error': {'message': 'code=400, message=tool_choice is required no tools or functions are defined in the request'}} ​

Bug 4: Ollama provider — tool_calls always None, no error

With max_turns set, ollama:llama3.1:8b returns blank content and tool_calls: None, with no error raised. Verified the model itself supports tool calling correctly by calling the raw ollama Python package directly with the same model/prompt/tool — it returned a proper ToolCall. So the issue is isolated to aisuite's Ollama provider not correctly passing tools= through or not parsing tool_calls back from Ollama's response.

Expected behavior

Per the docs (https://www.tryaisuite.com/docs/tool-calling), passing functions with max_turns should transparently handle tool execution for any supported provider.