Description
Please make sure you read the contribution guide and file the issues in the right place.
Contribution guide.
Describe the bug
When using the ollama_chat provider with sub-agents, an error occurs:
litellm.exceptions.APIConnectionError: litellm.APIConnectionError: Ollama_chatException - {"error":"json: cannot unmarshal array into Go struct field ChatRequest.messages.content of type string"}
.
To Reproduce
Steps to reproduce the behavior:
- Install Google ADK
- Configure an agent with sub-agents
- Set ollama_chat as the provider
- Try to use the agent (e.g.
python sample.py
) - See error
Expected behavior
The agent should process requests without errors and return responses normally, as it does when sub-agents are not configured.
Desktop (please complete the following information):
- OS: WSL2 (Ubuntu 24.04.2 LTS) on Windows 11
- Python version(python -V): Python 3.12.9
- ADK version(pip show google-adk): Version: 0.2.0
- Ollama: ollama version is 0.6.6
Additional context
When litellm._turn_on_debug()
is enabled, logs show that part of the request to ollama includes:
{'role': 'user', 'content': [{'type': 'text', 'text': 'For context:'}, {'type': 'text', 'text': '[root_agent] transfer_to_agent tool returned result: {}'}]}
The ollama_chat interface expects the 'content' field to be a string, but with sub-agents, the content is being passed as an array of objects, causing the error. This issue does not occur when sub-agents are not being used.