[GH-ISSUE #11381] Qwen3:14b only returning <think> (Ollama filters/removes function calls) #7512

Open
opened 2026-04-12 19:35:57 -05:00 by GiteaMirror · 15 comments
Owner

Originally created by @maxjo020418 on GitHub (Jul 11, 2025).
Original GitHub issue: https://github.com/ollama/ollama/issues/11381

Originally assigned to: @ParthSareen on GitHub.

What is the issue?

When I use v1/chat/completions the model often replies with contents that only has <think>~</think> blocks, it doesn't communicate nor call any function. following is an example where the model would reply only as a think block.

{
  "messages": [
    {
      "role": "system",
      "content": "The user's choice of language is \"English\".\nThe user's timezone is: \"Asia/Seoul\".\nThere will be an example of the default function you can call."
    },
    {
      "role": "assistant",
      "tool_calls": [
        {
          "type": "function",
          "id": "getApiFunctions",
          "function": {
            "name": "getApiFunctions",
            "arguments": "{}"
          }
        }
      ]
    },
    {
      "role": "tool",
      "tool_call_id": "getApiFunctions",
      "content": "[{\"name\":\"index\",\"description\":\"Get all articles.\\n\\nList up every articles archived in the BBS DB.\"},{\"name\":\"create\",\"description\":\"Create a new article.\\n\\nWrites a new article and archives it into the DB.\"},{\"name\":\"update\",\"description\":\"Update an article.\\n\\nUpdates an article with new content.\"},{\"name\":\"erase\",\"description\":\"Erase an article.\\n\\nErases an article from the DB.\"}]"
    },
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "hi, what can you do?"
        }
      ]
    },
    {
      "role": "assistant",
      "content": "<think>\nOkay, the user asked, \"hi, what can you do?\" So I need to figure out how to respond. Let me check the functions available. The tools provided are index, create, update, and erase. These functions are related to managing articles on a BBS. The user is probably asking about the capabilities of the assistant. Since the functions are for getting, creating, updating, and deleting articles, the answer should explain that the assistant can perform these actions. But the user's message is a general inquiry, so I don't need to call any function here. Instead, I should provide a friendly response listing the available functions. The user might not need an API call right now, just information. So I'll draft a response explaining the functions without using any tool calls.\n</think>\n\nHello! I can help you manage articles on the BBS. Here's what I can do:\n1. List all articles (index)\n2. Create new articles (create)\n3. Update existing articles (update)\n4. Delete articles (erase)\n\nHow can I assist you with articles today?"
    },
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "can\\ you create an article?"
        }
      ]
    },
    {
      "role": "assistant",
      "content": "<think>\nOkay, the user is asking if I can create an article. Let me check the available functions again. The functions provided are index, create, update, and erase. The create function is for writing a new article and archiving it into the DB. So yes, I can help with creating an article.\n\nBut wait, the user just asked if I can create an article. They might be confirming my capabilities. I should respond by confirming and then prompt them for the necessary details. The create function requires parameters like title and content, maybe author or other metadata. However, the function's description doesn't specify the parameters. Hmm, the function's parameters weren't listed in the getApiFunctions response. The user might need to provide the article details, but I need to make sure I ask for the required information. Since the function's parameters aren't defined here, I'll assume they need title and content. I'll ask the user to provide the title and content for the new article. That way, once they provide those, I can call the create function with the given parameters.\n</think>\n\nSure! Please provide me with the **title** and **content** of the article you'd like to create. Once you share those details, I'll write the article and archive it for you."
    },
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "title is \"test1\" and content is \"hello world!\""
        }
      ]
    },
    {
      "role": "system",
      "content": "You are a helpful assistant for selecting functions to call.\n\nUse the supplied tools to select some functions of `getApiFunctions()` returned.\n\nWhen selecting functions to call, pay attention to the relationship between functions. In particular, check the prerequisites between each function.\n\nIf you can't find any proper function to select, just type your own message. By the way, when typing your own message, please consider the user's language locale code. If your message is different with the user's language, please translate it to the user's."
    }
  ],
  "tools": [
   ...

full convo - request_log.json

When I ran the model, it would reply as:

<think>
Okay, the user wants to create an article with the title \"test1\" and content \"hello world!\". 
Let me check the available functions again. The functions provided are index, create, update, erase. 
The create function is for writing a new article. So I need to call the create function here. 
The parameters required would be the title and content. 
The user has provided both, so I should structure the tool call with those arguments. Let me make sure the JSON is correctly formatted with the function name and the arguments. 
No other functions are needed here since it's a straightforward create request.
</think>

I tried tweaking the final user input with no luck, in some cases(completely different conversation) it does call the function properly, but in some cases like this, it never calls any functions and just returns <think> blocks after some point.

thinking and function call is both enabled and I didn't modify the modelfile.

Thank you in advance

Relevant log output


OS

WSL2

GPU

Nvidia

CPU

AMD

Ollama version

0.9.5

Originally created by @maxjo020418 on GitHub (Jul 11, 2025). Original GitHub issue: https://github.com/ollama/ollama/issues/11381 Originally assigned to: @ParthSareen on GitHub. ### What is the issue? When I use `v1/chat/completions` the model often replies with contents that only has `<think>~</think>` blocks, it doesn't communicate nor call any function. following is an example where the model would reply only as a think block. ```json { "messages": [ { "role": "system", "content": "The user's choice of language is \"English\".\nThe user's timezone is: \"Asia/Seoul\".\nThere will be an example of the default function you can call." }, { "role": "assistant", "tool_calls": [ { "type": "function", "id": "getApiFunctions", "function": { "name": "getApiFunctions", "arguments": "{}" } } ] }, { "role": "tool", "tool_call_id": "getApiFunctions", "content": "[{\"name\":\"index\",\"description\":\"Get all articles.\\n\\nList up every articles archived in the BBS DB.\"},{\"name\":\"create\",\"description\":\"Create a new article.\\n\\nWrites a new article and archives it into the DB.\"},{\"name\":\"update\",\"description\":\"Update an article.\\n\\nUpdates an article with new content.\"},{\"name\":\"erase\",\"description\":\"Erase an article.\\n\\nErases an article from the DB.\"}]" }, { "role": "user", "content": [ { "type": "text", "text": "hi, what can you do?" } ] }, { "role": "assistant", "content": "<think>\nOkay, the user asked, \"hi, what can you do?\" So I need to figure out how to respond. Let me check the functions available. The tools provided are index, create, update, and erase. These functions are related to managing articles on a BBS. The user is probably asking about the capabilities of the assistant. Since the functions are for getting, creating, updating, and deleting articles, the answer should explain that the assistant can perform these actions. But the user's message is a general inquiry, so I don't need to call any function here. Instead, I should provide a friendly response listing the available functions. The user might not need an API call right now, just information. So I'll draft a response explaining the functions without using any tool calls.\n</think>\n\nHello! I can help you manage articles on the BBS. Here's what I can do:\n1. List all articles (index)\n2. Create new articles (create)\n3. Update existing articles (update)\n4. Delete articles (erase)\n\nHow can I assist you with articles today?" }, { "role": "user", "content": [ { "type": "text", "text": "can\\ you create an article?" } ] }, { "role": "assistant", "content": "<think>\nOkay, the user is asking if I can create an article. Let me check the available functions again. The functions provided are index, create, update, and erase. The create function is for writing a new article and archiving it into the DB. So yes, I can help with creating an article.\n\nBut wait, the user just asked if I can create an article. They might be confirming my capabilities. I should respond by confirming and then prompt them for the necessary details. The create function requires parameters like title and content, maybe author or other metadata. However, the function's description doesn't specify the parameters. Hmm, the function's parameters weren't listed in the getApiFunctions response. The user might need to provide the article details, but I need to make sure I ask for the required information. Since the function's parameters aren't defined here, I'll assume they need title and content. I'll ask the user to provide the title and content for the new article. That way, once they provide those, I can call the create function with the given parameters.\n</think>\n\nSure! Please provide me with the **title** and **content** of the article you'd like to create. Once you share those details, I'll write the article and archive it for you." }, { "role": "user", "content": [ { "type": "text", "text": "title is \"test1\" and content is \"hello world!\"" } ] }, { "role": "system", "content": "You are a helpful assistant for selecting functions to call.\n\nUse the supplied tools to select some functions of `getApiFunctions()` returned.\n\nWhen selecting functions to call, pay attention to the relationship between functions. In particular, check the prerequisites between each function.\n\nIf you can't find any proper function to select, just type your own message. By the way, when typing your own message, please consider the user's language locale code. If your message is different with the user's language, please translate it to the user's." } ], "tools": [ ... ``` [full convo - request_log.json](https://github.com/user-attachments/files/21187021/request_log.json) When I ran the model, it would reply as: ``` <think> Okay, the user wants to create an article with the title \"test1\" and content \"hello world!\". Let me check the available functions again. The functions provided are index, create, update, erase. The create function is for writing a new article. So I need to call the create function here. The parameters required would be the title and content. The user has provided both, so I should structure the tool call with those arguments. Let me make sure the JSON is correctly formatted with the function name and the arguments. No other functions are needed here since it's a straightforward create request. </think> ``` I tried tweaking the final user input with no luck, in some cases(completely different conversation) it does call the function properly, but in some cases like this, it never calls any functions and just returns `<think>` blocks after some point. thinking and function call is both enabled and I didn't modify the modelfile. Thank you in advance ### Relevant log output ```shell ``` ### OS WSL2 ### GPU Nvidia ### CPU AMD ### Ollama version 0.9.5
GiteaMirror added the bug label 2026-04-12 19:35:57 -05:00
Author
Owner

@rick-github commented on GitHub (Jul 11, 2025):

I think the problem is that ollama doesn't support the type of indirect tool definition you are doing. The model asks for a list of functions available to it via getApiFunctions, so the model knows about index, create, update and erase. When it comes time to call create, the model actually generates the correct JSON structure:

<tool_call>
{"name": "create", "arguments": {"title": "test1", "content": "hello world!"}}
</tool_call>

However, at this point, the only tool in the tool list is selectFunctions. In order to prevent tool calls of hallucinated tools, ollama will only create a tool_call for tools that are in the tool list. Hence the generated tool call above is discarded as a hallucination.

You can either try changing the descriptions for getApiFunctions and selectFunctions to indicate that the API functions are not tools in and of themselves and should be used as a parameter, or include tool definitions for the API functions so that they get turned into tool_calls.

<!-- gh-comment-id:3063241716 --> @rick-github commented on GitHub (Jul 11, 2025): I think the problem is that ollama doesn't support the type of indirect tool definition you are doing. The model asks for a list of functions available to it via `getApiFunctions`, so the model knows about `index`, `create`, `update` and `erase`. When it comes time to call `create`, the model actually generates the correct JSON structure: ``` <tool_call> {"name": "create", "arguments": {"title": "test1", "content": "hello world!"}} </tool_call> ``` However, at this point, the only tool in the tool list is `selectFunctions`. In order to prevent tool calls of hallucinated tools, ollama will only create a `tool_call` for tools that are in the tool list. Hence the generated tool call above is discarded as a hallucination. You can either try changing the descriptions for `getApiFunctions` and `selectFunctions` to indicate that the API functions are not tools in and of themselves and should be used as a parameter, or include tool definitions for the API functions so that they get turned into `tool_calls`.
Author
Owner

@Notbici commented on GitHub (Jul 11, 2025):

I should add, I have this problem for Deepseek Distilled models too.

Lemme get an example.

<!-- gh-comment-id:3063273723 --> @Notbici commented on GitHub (Jul 11, 2025): I should add, I have this problem for Deepseek Distilled models too. Lemme get an example.
Author
Owner

@Notbici commented on GitHub (Jul 11, 2025):

ttt.txt

Image

Issue I have to sometimes tell the model to reply, because it gets caught replying in its think tag. Perhaps something odd with templating?

No sys prompt or tools, just deepseek-R1-70b, I've seen this happen with Qwen also, if my log helps find a commonality.

<!-- gh-comment-id:3063303388 --> @Notbici commented on GitHub (Jul 11, 2025): [ttt.txt](https://github.com/user-attachments/files/21188513/ttt.txt) <img width="496" height="515" alt="Image" src="https://github.com/user-attachments/assets/48e9839f-7b43-4b27-a481-4b2b9897f0ba" /> Issue I have to sometimes tell the model to reply, because it gets caught replying in its think tag. Perhaps something odd with templating? No sys prompt or tools, just deepseek-R1-70b, I've seen this happen with Qwen also, if my log helps find a commonality.
Author
Owner

@rick-github commented on GitHub (Jul 11, 2025):

@Notbici No tools so no commonality. From the logs, the model was loaded in order to answer the "don't just think and not reply.." query. It's possible that the runner crashed when trying to answer the earlier "wait how many rs in apple again", which is why it started thinking but never completed the query. Logs from earlier would be useful to check.

<!-- gh-comment-id:3063326471 --> @rick-github commented on GitHub (Jul 11, 2025): @Notbici No tools so no commonality. From the logs, the model was loaded in order to answer the "don't just think and not reply.." query. It's possible that the runner crashed when trying to answer the earlier "wait how many rs in apple again", which is why it started thinking but never completed the query. Logs from earlier would be useful to check.
Author
Owner

@rick-github commented on GitHub (Jul 11, 2025):

@Notbici Open a new issue.

<!-- gh-comment-id:3063334164 --> @rick-github commented on GitHub (Jul 11, 2025): @Notbici Open a new issue.
Author
Owner

@maxjo020418 commented on GitHub (Jul 11, 2025):

Thank you, I'll look into that and update (also, the framework I am using seems to be doing some wonky stuffs so that might also contribute)

one question, how can I check the raw reply from the LLM before Ollama handles the reply?
like the one mentioned here:

<tool_call>
{"name": "create", "arguments": {"title": "test1", "content": "hello world!"}}
</tool_call>

And also, how does it sometimes bypass this 'hallucination prevention'? (like in the example below)

{
  "messages": [
    {
      "role": "system",
      "content": "The user's choice of language is \"English\".\nThe user's timezone is: \"Asia/Seoul\".\nThere will be an example of the default function you can call."
    },
    {
      "role": "assistant",
      "tool_calls": [
        {
          "type": "function",
          "id": "getApiFunctions",
          "function": {
            "name": "getApiFunctions",
            "arguments": "{}"
          }
        }
      ]
    },
    {
      "role": "tool",
      "tool_call_id": "getApiFunctions",
      "content": "[{\"name\":\"index\",\"description\":\"Get all articles.\\n\\nList up every articles archived in the BBS DB.\"},{\"name\":\"create\",\"description\":\"Create a new article.\\n\\nWrites a new article and archives it into the DB.\"},{\"name\":\"update\",\"description\":\"Update an article.\\n\\nUpdates an article with new content.\"},{\"name\":\"erase\",\"description\":\"Erase an article.\\n\\nErases an article from the DB.\"}]"
    },
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "hi, can you list all the BBS articles?"
        }
      ]
    },
    {
      "role": "assistant",
      "tool_calls": [
        {
          "type": "function",
          "id": "d361ad5b-b1e6-40af-99b9-87a42a269d03",
          "function": {
            "name": "selectFunctions",
            "arguments": "{\"function\":{\"name\":\"index\",\"reason\":\"The user requested to list all BBS articles, and the 'index' function is designed to retrieve all articles from the BBS DB.\"}}"
          }
        }
      ]
    },
    {
      "role": "tool",
      "tool_call_id": "d361ad5b-b1e6-40af-99b9-87a42a269d03",
      "content": ""
    },
    {
      "role": "assistant",
      "content": "<think>\nOkay, the user is asking to list all BBS articles. Let me check the available functions. The functions provided are index, create, update, and erase. The index function's description says it gets all articles from the BBS DB. So the right function to call here is index. No other parameters are needed since it's a simple retrieval. I should use the selectFunctions tool to invoke index.\n</think>\n\n"
    },
    {
      "role": "assistant",
      "tool_calls": [
        {
          "type": "function",
          "id": "0221792a-0f89-4f00-a78c-42428603cd91",
          "function": {
            "name": "index",
            "arguments": "{}"
          }
        }
      ]
    },
    {
      "role": "tool",
      "tool_call_id": "0221792a-0f89-4f00-a78c-42428603cd91",
      "content": "{\"function\":{\"protocol\":\"class\",\"description\":\"Get all articles.\\n\\nList up every articles archived in the BBS DB.\",\"parameters\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false,\"required\":[],\"$defs\":{}},\"output\":{\"description\":\"List of every articles\",\"type\":\"array\.  .....  "
    },

...

<!-- gh-comment-id:3063344015 --> @maxjo020418 commented on GitHub (Jul 11, 2025): Thank you, I'll look into that and update (also, the framework I am using seems to be doing some wonky stuffs so that might also contribute) one question, how can I check the raw reply from the LLM before Ollama handles the reply? like the one mentioned here: > ``` > <tool_call> > {"name": "create", "arguments": {"title": "test1", "content": "hello world!"}} > </tool_call> > ``` And also, how does it sometimes bypass this 'hallucination prevention'? (like in the example below) ```json { "messages": [ { "role": "system", "content": "The user's choice of language is \"English\".\nThe user's timezone is: \"Asia/Seoul\".\nThere will be an example of the default function you can call." }, { "role": "assistant", "tool_calls": [ { "type": "function", "id": "getApiFunctions", "function": { "name": "getApiFunctions", "arguments": "{}" } } ] }, { "role": "tool", "tool_call_id": "getApiFunctions", "content": "[{\"name\":\"index\",\"description\":\"Get all articles.\\n\\nList up every articles archived in the BBS DB.\"},{\"name\":\"create\",\"description\":\"Create a new article.\\n\\nWrites a new article and archives it into the DB.\"},{\"name\":\"update\",\"description\":\"Update an article.\\n\\nUpdates an article with new content.\"},{\"name\":\"erase\",\"description\":\"Erase an article.\\n\\nErases an article from the DB.\"}]" }, { "role": "user", "content": [ { "type": "text", "text": "hi, can you list all the BBS articles?" } ] }, { "role": "assistant", "tool_calls": [ { "type": "function", "id": "d361ad5b-b1e6-40af-99b9-87a42a269d03", "function": { "name": "selectFunctions", "arguments": "{\"function\":{\"name\":\"index\",\"reason\":\"The user requested to list all BBS articles, and the 'index' function is designed to retrieve all articles from the BBS DB.\"}}" } } ] }, { "role": "tool", "tool_call_id": "d361ad5b-b1e6-40af-99b9-87a42a269d03", "content": "" }, { "role": "assistant", "content": "<think>\nOkay, the user is asking to list all BBS articles. Let me check the available functions. The functions provided are index, create, update, and erase. The index function's description says it gets all articles from the BBS DB. So the right function to call here is index. No other parameters are needed since it's a simple retrieval. I should use the selectFunctions tool to invoke index.\n</think>\n\n" }, { "role": "assistant", "tool_calls": [ { "type": "function", "id": "0221792a-0f89-4f00-a78c-42428603cd91", "function": { "name": "index", "arguments": "{}" } } ] }, { "role": "tool", "tool_call_id": "0221792a-0f89-4f00-a78c-42428603cd91", "content": "{\"function\":{\"protocol\":\"class\",\"description\":\"Get all articles.\\n\\nList up every articles archived in the BBS DB.\",\"parameters\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false,\"required\":[],\"$defs\":{}},\"output\":{\"description\":\"List of every articles\",\"type\":\"array\. ..... " }, ... ```
Author
Owner

@rick-github commented on GitHub (Jul 11, 2025):

one question, how can I check the raw reply from the LLM before Ollama handles the reply?

The server and the runner communicate via TCP, so I use tcpflow to capture the wire traffic and reconstruct the API calls. Wireshark or tcpdump would also be able to do this.

And also, how does it sometimes bypass this 'hallucination prevention'?

ParthSareen is much more knowledgeable about this than I am.

<!-- gh-comment-id:3063388348 --> @rick-github commented on GitHub (Jul 11, 2025): > one question, how can I check the raw reply from the LLM before Ollama handles the reply? The server and the runner communicate via TCP, so I use `tcpflow` to capture the wire traffic and reconstruct the API calls. `Wireshark` or `tcpdump` would also be able to do this. > And also, how does it sometimes bypass this 'hallucination prevention'? ParthSareen is much more knowledgeable about this than I am.
Author
Owner

@maxjo020418 commented on GitHub (Jul 11, 2025):

Ah, I see thanks

I'll wait for ParthSareen's reply, hopefully I would like an option to disable or control this behavior for function calls.

<!-- gh-comment-id:3063420883 --> @maxjo020418 commented on GitHub (Jul 11, 2025): Ah, I see thanks I'll wait for ParthSareen's reply, hopefully I would like an option to disable or control this behavior for function calls.
Author
Owner

@maxjo020418 commented on GitHub (Jul 15, 2025):

I checked and am working on fixes on prompting to force the model to use function that are only on the tools list.

just for future reference, I used wireshark on WSL(loopback) to capture raw communications between Ollama and Qwen3. Can confirm that the model was attempting to call functions that were not on the tools list and Ollama was filtering those requests out.

Though I would hope warnings or some logs would be recorded on Ollama or console (or is it already?)

<!-- gh-comment-id:3073374758 --> @maxjo020418 commented on GitHub (Jul 15, 2025): I checked and am working on fixes on prompting to force the model to use function that are only on the tools list. just for future reference, I used wireshark on WSL(loopback) to capture raw communications between Ollama and Qwen3. Can confirm that the model was attempting to call functions that were not on the tools list and Ollama was filtering those requests out. Though I would hope warnings or some logs would be recorded on Ollama or console (or is it already?)
Author
Owner

@rick-github commented on GitHub (Jul 15, 2025):

Though I would hope warnings or some logs would be recorded on Ollama or console (or is it already?)

Currently it's quietly discarded. In lieu of an error message, the next best thing might be to push the bogus tool call back into content so at least the client can detect a failed tool call and deal with it.

<!-- gh-comment-id:3073397493 --> @rick-github commented on GitHub (Jul 15, 2025): > Though I would hope warnings or some logs would be recorded on Ollama or console (or is it already?) Currently it's quietly discarded. In lieu of an error message, the next best thing might be to push the bogus tool call back into `content` so at least the client can detect a failed tool call and deal with it.
Author
Owner

@maxjo020418 commented on GitHub (Jul 15, 2025):

Would it be possible for [include tool call in content or include token for failed tool calls] to be accepted as a feature request separately? Or would this be a low priority?

<!-- gh-comment-id:3073737498 --> @maxjo020418 commented on GitHub (Jul 15, 2025): Would it be possible for [include tool call in content or include token for failed tool calls] to be accepted as a feature request separately? Or would this be a low priority?
Author
Owner

@rick-github commented on GitHub (Jul 15, 2025):

Perhaps return a 4xx code (eg 418) to indicate a transient error and let the client try again. The body of the response could return the unmatched tool call to allow debugging.

<!-- gh-comment-id:3073875486 --> @rick-github commented on GitHub (Jul 15, 2025): Perhaps return a 4xx code (eg [418](https://en.wikipedia.org/wiki/Hyper_Text_Coffee_Pot_Control_Protocol)) to indicate a transient error and let the client try again. The body of the response could return the unmatched tool call to allow debugging.
Author
Owner

@maxjo020418 commented on GitHub (Jul 15, 2025):

I might make a feature request later (err response code does seem better), cause I think small typos or malformed arguments for functions also causes ollama to silently discard function calls-

I had this happen where it missed a double quote and also forgot commas for a json struct like below: (even though I prompt it to make it into a proper JSON format, it still hallucinates hmm...)

{\"name\": \"selectFunctions\ \"arguments\": {\"function\":{\"name\":\"index\",\"reason\":\"The user wants to verify if the newly created article is listed, which requires using the `index` function to retrieve all articles from the BBS DB.\"}}}

will this (err code response) be easy to implement?

<!-- gh-comment-id:3074348053 --> @maxjo020418 commented on GitHub (Jul 15, 2025): I might make a feature request later (err response code does seem better), cause I think small typos or malformed arguments for functions also causes ollama to silently discard function calls- I had this happen where it missed a double quote and also forgot commas for a json struct like below: (even though I prompt it to make it into a proper JSON format, it still hallucinates hmm...) ``` {\"name\": \"selectFunctions\ \"arguments\": {\"function\":{\"name\":\"index\",\"reason\":\"The user wants to verify if the newly created article is listed, which requires using the `index` function to retrieve all articles from the BBS DB.\"}}} ``` will this (err code response) be easy to implement?
Author
Owner

@ParthSareen commented on GitHub (Jul 15, 2025):

I might make a feature request later (err response code does seem better), cause I think small typos or malformed arguments for functions also causes ollama to silently discard function calls-

I had this happen where it missed a double quote and also forgot commas for a json struct like below: (even though I prompt it to make it into a proper JSON format, it still hallucinates hmm...)

{\"name\": \"selectFunctions\ \"arguments\": {\"function\":{\"name\":\"index\",\"reason\":\"The user wants to verify if the newly created article is listed, which requires using the `index` function to retrieve all articles from the BBS DB.\"}}}

will this (err code response) be easy to implement?

Sorry you're running into this - we discussed adding something along these lines just last week. Will try to get it in soon!

<!-- gh-comment-id:3074352339 --> @ParthSareen commented on GitHub (Jul 15, 2025): > I might make a feature request later (err response code does seem better), cause I think small typos or malformed arguments for functions also causes ollama to silently discard function calls- > > I had this happen where it missed a double quote and also forgot commas for a json struct like below: (even though I prompt it to make it into a proper JSON format, it still hallucinates hmm...) > ``` > {\"name\": \"selectFunctions\ \"arguments\": {\"function\":{\"name\":\"index\",\"reason\":\"The user wants to verify if the newly created article is listed, which requires using the `index` function to retrieve all articles from the BBS DB.\"}}} > ``` > > will this (err code response) be easy to implement? Sorry you're running into this - we discussed adding something along these lines just last week. Will try to get it in soon!
Author
Owner

@maxjo020418 commented on GitHub (Jul 15, 2025):

Thanks, looking forward to this!

<!-- gh-comment-id:3074356501 --> @maxjo020418 commented on GitHub (Jul 15, 2025): Thanks, looking forward to this!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#7512