[GH-ISSUE #11878] Ollama Turbo doesn't support "tool" role in messages #69942

Closed
opened 2026-05-04 19:50:21 -05:00 by GiteaMirror · 5 comments
Owner

Originally created by @mgs-ckopsa on GitHub (Aug 13, 2025).
Original GitHub issue: https://github.com/ollama/ollama/issues/11878

Originally assigned to: @ParthSareen on GitHub.

What is the issue?

Steps to reproduce:

This works when the role is set to 'user':

curl -X POST 'https://ollama.com/api/chat' \
  -H 'Host: ollama.com' \
  -H 'Authorization: Bearer abc123' \
  --data '{"model":"gpt-oss:120b","stream":false,"options":{},"messages":[{"role":"user","content": "Hi"}]}'

This yields an upstream error when the role is switched to "tool":

curl -X POST 'https://ollama.com/api/chat' \
  -H 'Host: ollama.com' \
  -H 'Authorization: Bearer abc123' \
  --data '{"model":"gpt-oss:120b","stream":false,"options":{},"messages":[{"role":"tool","content": "Hi"}]}'

This works as expected when running locally, but when using ollama turbo it shows upstream error

Relevant log output

curl -X POST 'https://ollama.com/api/chat' \
  -H 'Authorization: Bearer abc123' \
  --data '{"model":"gpt-oss:120b","stream":false,"options":{},"messages":[{"role":"tool","user": "Hi"}]}'
{"error": "upstream error"}%

OS

No response

GPU

No response

CPU

No response

Ollama version

No response

Originally created by @mgs-ckopsa on GitHub (Aug 13, 2025). Original GitHub issue: https://github.com/ollama/ollama/issues/11878 Originally assigned to: @ParthSareen on GitHub. ### What is the issue? Steps to reproduce: This works when the role is set to 'user': ```bash curl -X POST 'https://ollama.com/api/chat' \ -H 'Host: ollama.com' \ -H 'Authorization: Bearer abc123' \ --data '{"model":"gpt-oss:120b","stream":false,"options":{},"messages":[{"role":"user","content": "Hi"}]}' ``` This yields an upstream error when the role is switched to "tool": ```bash curl -X POST 'https://ollama.com/api/chat' \ -H 'Host: ollama.com' \ -H 'Authorization: Bearer abc123' \ --data '{"model":"gpt-oss:120b","stream":false,"options":{},"messages":[{"role":"tool","content": "Hi"}]}' ``` This works as expected when running locally, but when using ollama turbo it shows `upstream error` ### Relevant log output ```shell curl -X POST 'https://ollama.com/api/chat' \ -H 'Authorization: Bearer abc123' \ --data '{"model":"gpt-oss:120b","stream":false,"options":{},"messages":[{"role":"tool","user": "Hi"}]}' {"error": "upstream error"}% ``` ### OS _No response_ ### GPU _No response_ ### CPU _No response_ ### Ollama version _No response_
GiteaMirror added the bug label 2026-05-04 19:50:21 -05:00
Author
Owner

@ParthSareen commented on GitHub (Aug 13, 2025):

Sorry about this! Taking a look now

<!-- gh-comment-id:3185060209 --> @ParthSareen commented on GitHub (Aug 13, 2025): Sorry about this! Taking a look now
Author
Owner

@ParthSareen commented on GitHub (Aug 13, 2025):

@mgs-ckopsa are you passing in the tool call history and tools? That's most likely causing the issue right now. Here's an example you can try:

curl https://ollama.com/api/chat \
  -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OLLAMA_TURBO_KEY" \
  -d '{
        "model": "gpt-oss:20b",
        "stream": false,
        "messages": [
          {
            "role": "user",
            "content": "What is the weather like in London? What are the conditions in Toronto?"
          },
          {
            "role": "assistant",
            "thinking": "We have two requests: weather in London, conditions in Toronto. Use functions: get_weather, get_weather_conditions. For London: likely current temperature? get_weather. For Toronto: get_weather_conditions. We need to use tool calls.",
            "tool_calls": [
              {
                "function": {
                  "name": "get_weather",
                  "arguments": {"city": "London"}
                }
              }
            ]
          },
          {
            "role": "tool",
            "content": "The temperature in London is 7°C",
            "tool_name": "get_weather"
          },
          {
            "role": "assistant",
            "thinking": "Now get conditions Toronto.",
            "tool_calls": [
              {
                "function": {
                  "name": "get_weather_conditions",
                  "arguments": {"city": "Toronto"}
                }
              }
            ]
          },
          {
            "role": "tool",
            "content": "rainy",
            "tool_name": "get_weather_conditions"
          }
        ],
        "tools": [
          {
            "type": "function",
            "function": {
              "name": "get_weather",
              "description": "Get the current temperature for a city",
              "parameters": {
                "type": "object",
                "required": ["city"],
                "properties": {
                  "city": {
                    "type": "string",
                    "description": "The name of the city"
                  }
                }
              }
            }
          },
          {
            "type": "function",
            "function": {
              "name": "get_weather_conditions",
              "description": "Get the weather conditions for a city",
              "parameters": {
                "type": "object",
                "required": ["city"],
                "properties": {
                  "city": {
                    "type": "string",
                    "description": "The name of the city"
                  }
                }
              }
            }
          }
        ]
      }'

I will be consolidating the behavior between turbo and local, and return some better errors!

<!-- gh-comment-id:3185922901 --> @ParthSareen commented on GitHub (Aug 13, 2025): @mgs-ckopsa are you passing in the tool call history and tools? That's most likely causing the issue right now. Here's an example you can try: ``` curl https://ollama.com/api/chat \ -X POST \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $OLLAMA_TURBO_KEY" \ -d '{ "model": "gpt-oss:20b", "stream": false, "messages": [ { "role": "user", "content": "What is the weather like in London? What are the conditions in Toronto?" }, { "role": "assistant", "thinking": "We have two requests: weather in London, conditions in Toronto. Use functions: get_weather, get_weather_conditions. For London: likely current temperature? get_weather. For Toronto: get_weather_conditions. We need to use tool calls.", "tool_calls": [ { "function": { "name": "get_weather", "arguments": {"city": "London"} } } ] }, { "role": "tool", "content": "The temperature in London is 7°C", "tool_name": "get_weather" }, { "role": "assistant", "thinking": "Now get conditions Toronto.", "tool_calls": [ { "function": { "name": "get_weather_conditions", "arguments": {"city": "Toronto"} } } ] }, { "role": "tool", "content": "rainy", "tool_name": "get_weather_conditions" } ], "tools": [ { "type": "function", "function": { "name": "get_weather", "description": "Get the current temperature for a city", "parameters": { "type": "object", "required": ["city"], "properties": { "city": { "type": "string", "description": "The name of the city" } } } } }, { "type": "function", "function": { "name": "get_weather_conditions", "description": "Get the weather conditions for a city", "parameters": { "type": "object", "required": ["city"], "properties": { "city": { "type": "string", "description": "The name of the city" } } } } } ] }' ``` I will be consolidating the behavior between turbo and local, and return some better errors!
Author
Owner

@mgs-ckopsa commented on GitHub (Aug 13, 2025):

The original request included tools and tool call history, but I was just looking for the smallest example that would give the error.

The example you gave here works as expected.

I will see if I can put together a better example that shows my issue., but yes returning better errors would be helpful along those lines.

Just to leave somewhat of a paper trail, I was using the "http_request" tool within Amazon's strand agent python sdk and was consistently getting an upstream error whenever using ollama turbo and no error when using ollama local.

<!-- gh-comment-id:3186017596 --> @mgs-ckopsa commented on GitHub (Aug 13, 2025): The original request included tools and tool call history, but I was just looking for the smallest example that would give the error. The example you gave here works as expected. I will see if I can put together a better example that shows my issue., but yes returning better errors would be helpful along those lines. Just to leave somewhat of a paper trail, I was using the "http_request" tool within Amazon's strand agent python sdk and was consistently getting an upstream error whenever using ollama turbo and no error when using ollama local.
Author
Owner

@ParthSareen commented on GitHub (Aug 13, 2025):

@mgs-ckopsa yeah apologies for the obscure errors. Will get to that ASAP. And I haven't tried the strand agent but we don't support openai compatibility on ollama.com directly so that could be another cause of the issue. Again once I add some better error messages this should be a bit easier to deal with. We're also going to be adding some new ways of using turbo which hopefully will also improve this entire experience!

<!-- gh-comment-id:3186049111 --> @ParthSareen commented on GitHub (Aug 13, 2025): @mgs-ckopsa yeah apologies for the obscure errors. Will get to that ASAP. And I haven't tried the strand agent but we don't support openai compatibility on ollama.com directly so that could be another cause of the issue. Again once I add some better error messages this should be a bit easier to deal with. We're also going to be adding some new ways of using turbo which hopefully will also improve this entire experience!
Author
Owner

@ashworthpayne commented on GitHub (Aug 14, 2025):

I think I speak for all the worlds' GPU-poor when I say "Thank you".

If anyone cares, I'd love to be able to push my LLM to Turbo and use it with tools etc. I could pay a bit more for the feature, but keep in mind that I am GPU poor for real reasons 👈

<!-- gh-comment-id:3188790578 --> @ashworthpayne commented on GitHub (Aug 14, 2025): I think I speak for all the worlds' GPU-poor when I say "Thank you". If anyone cares, I'd love to be able to push my LLM to Turbo and use it with tools etc. I could pay a bit more for the feature, but keep in mind that I am GPU poor for real reasons 👈
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#69942