8000 Error when using ollama_chat provider with sub-agents: Content format incompatibility · Issue #376 · google/adk-python · GitHub
[go: up one dir, main page]

Skip to content
Error when using ollama_chat provider with sub-agents: Content format incompatibility #376
Open
@knaou

Description

@knaou

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:

  1. Install Google ADK
  2. Configure an agent with sub-agents
  3. Set ollama_chat as the provider
  4. Try to use the agent (e.g. python sample.py)
  5. See error

Expected behavior
The agent should process requests without errors and return responses normally, as it does when sub-agents are not configured.

Screenshots
Image

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.

Metadata

Metadata

Assignees

Labels

modelsIssues about model support

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0