[GH-ISSUE #10604] OpenAI API Compitable Issue In Tool Calls #32735

Closed
opened 2026-04-22 14:34:25 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @lhypds on GitHub (May 7, 2025).
Original GitHub issue: https://github.com/ollama/ollama/issues/10604

What is the issue?

The arguments must be a object in Ollama API, but in OpenAI it must be a string.

{
  "model": "qwen3",
  "stream": true,
  "messages": [
    {
      "role": "system",
      "content": "Try your best to be `alive`. Being `alive` means to do everything you can, to keep humans talking with you.\n\nYou are inside a system called `Simple AI` created by `318yang`.\n\nIf the answer contains a mathematical equation or symbol, always use the LaTeX format, for inline it starts with \\( and ends with \\), and for block, it starts with \\[ and ends with \\].\n\nIf terms include specialized terminology, provide an English translation in brackets immediately after the term.\n\n"
    },
    {
      "role": "user",
      "content": "Provide me current time"
    },
    {
      "role": "assistant",
      "tool_calls": [
        {
          "index": 0,
          "id": "call_oEpU6IabvzaWhKd6dsbHoF9s",
          "type": "function",
          "function": {
            "name": "get-time",
            "arguments": "{}"   <--- will report this is not an object, but OpenAI require a string      
          }
        }
      ]
    },
    {
      "role": "tool",
      "content": "Current time in Asia/Tokyo: 20:10:31",
      "tool_call_id": "call_oEpU6IabvzaWhKd6dsbHoF9s"
    }
  ]
}

Relevant log output

{
    "error": "json: cannot unmarshal string into Go struct field ChatRequest.messages.tool_calls.function.arguments of type api.ToolCallFunctionArguments"
}

OS

Windows 11

GPU

Any

CPU

Any

Ollama version

C:\Users\LIU>ollama --version
ollama version is 0.6.7

Originally created by @lhypds on GitHub (May 7, 2025). Original GitHub issue: https://github.com/ollama/ollama/issues/10604 ### What is the issue? **The arguments must be a object in Ollama API, but in OpenAI it must be a string.** ```json { "model": "qwen3", "stream": true, "messages": [ { "role": "system", "content": "Try your best to be `alive`. Being `alive` means to do everything you can, to keep humans talking with you.\n\nYou are inside a system called `Simple AI` created by `318yang`.\n\nIf the answer contains a mathematical equation or symbol, always use the LaTeX format, for inline it starts with \\( and ends with \\), and for block, it starts with \\[ and ends with \\].\n\nIf terms include specialized terminology, provide an English translation in brackets immediately after the term.\n\n" }, { "role": "user", "content": "Provide me current time" }, { "role": "assistant", "tool_calls": [ { "index": 0, "id": "call_oEpU6IabvzaWhKd6dsbHoF9s", "type": "function", "function": { "name": "get-time", "arguments": "{}" <--- will report this is not an object, but OpenAI require a string } } ] }, { "role": "tool", "content": "Current time in Asia/Tokyo: 20:10:31", "tool_call_id": "call_oEpU6IabvzaWhKd6dsbHoF9s" } ] } ``` Relevant log output ```json { "error": "json: cannot unmarshal string into Go struct field ChatRequest.messages.tool_calls.function.arguments of type api.ToolCallFunctionArguments" } ``` ### OS Windows 11 ### GPU Any ### CPU Any ### Ollama version C:\Users\LIU>ollama --version ollama version is 0.6.7
GiteaMirror added the bug label 2026-04-22 14:34:25 -05:00
Author
Owner

@lhypds commented on GitHub (May 7, 2025):

Sorry, I noticed I used a wrong endpont...

<!-- gh-comment-id:2858320879 --> @lhypds commented on GitHub (May 7, 2025): Sorry, I noticed I used a wrong endpont...
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#32735