continue icon indicating copy to clipboard operation
continue copied to clipboard

Feature Request: Support Qwen3 Coder 30B Local Model for Tool Calls

Open desugar-64 opened this issue 1 year ago • 24 comments

Before submitting your bug report

Relevant environment info

- OS: macOS
- Continue version:1.1.71
- IDE version: VS Code 1.102.3 (Universal)
- Model: qwen/qwen3-coder-30b
- config:
  
name: Local Assistant
version: 1.0.0
schema: v1
models:
  - name: LM Studio
    provider: lmstudio
    apiBase: http://192.168.0.45:6970/v1
    capabilities:
      - tool_use
    model: qwen/qwen3-coder-30b
    roles:
      - chat
      - edit
      - apply
  - name: Nomic Embed Text
    provider: lmstudio
    model: nomic-ai/nomic-embed-text-v1.5-GGUF
    roles:
      - embed
context:
  - provider: code
  - provider: docs
  - provider: diff
  - provider: terminal
  - provider: problems
  - provider: folder
  - provider: codebase

  
  OR link to assistant in Continue hub:

Description

I’m trying to use the new Qwen3 Coder 30B model locally with Continue.dev via LM Studio. While the model loads and responds, it seems that tool call requests (e.g., run_terminal_command, grep_search) are not handled, the tool call structure is printed out literally instead of being executed.

Image

It looks like the plugin doesn’t recognize or properly handle tool call outputs from this model. Would be great to add support for Qwen3 Coder 30B as it performs well and supports function/tool calling.

Let me know if any debug logs or configs would help. Thanks for the awesome project!

To reproduce

No response

Log output


desugar-64 avatar Jul 31 '25 22:07 desugar-64

https://x.com/lmstudiodevs/status/1951101732269773021?s=46

Looks like it might be a model issue. The LM Studio released a fix for this. I’ll take a look.

desugar-64 avatar Aug 01 '25 06:08 desugar-64

That beta version (0.3.21-beta) of lmstudio doesn't solve the problem in my case :( It still exists

    provider: lmstudio
    model: lmstudio-community/Qwen3-Coder-30B-A3B-Instruct-MLX-4bit
    roles:
      - chat
      - edit
      - apply
      - summarize
    capabilities:
      - tool_use
    defaultCompletionOptions:
      contextLength: 40960

Model: qwen3-coder-30b-a3b-instruct-mlx-4bit

Pizzaschachtel avatar Aug 01 '25 07:08 Pizzaschachtel

Yeah, it didn’t help for me either. LM Studio 0.3.21 (Build 2)

desugar-64 avatar Aug 01 '25 09:08 desugar-64

I also want to mention, that the bug occured on intellij for Mac. It is not just a bug on vscode.

Edit: Could the reason for the error perhaps be the fact that qwen3-coder uses XML instead of JSON for tool calls? Qwen3-coder provides its own parser for this purpose. The question is whether continue.dev should implement this parser, or whether this should be handled elsewhere. See here: https://huggingface.co/Qwen/Qwen3-Coder-30B-A3B-Instruct/blob/main/qwen3coder_tool_parser.py

Pizzaschachtel avatar Aug 01 '25 15:08 Pizzaschachtel

Hey there! I'd like to add that I've encountered a similar error when using the VSCode extension on Linux and trying to connect to an Ollama instance running Qwen3-Coder.

OS: Manjaro Linux Continue Version: v1.1.71 Model: qwen3-coder:30b VSCode Version: 1.101.2

Image

Here's my config.yaml:

name: Local Assistant
version: 1.0.0
schema: v1
models:
  - name: Qwen3-Coder
    provider: ollama
    model: qwen3-coder:30b
    apiBase: http://192.168.1.84:11434
    roles:
      - chat
      - autocomplete
      - edit
      - apply
  - name: Qwen2.5-Coder
    provider: ollama
    model: qwen2.5-coder:1.5b
    apiBase: http://192.168.1.84:11434
    roles:
      - chat
      - autocomplete
      - edit
      - apply
  - name: Nomic Embed
    provider: ollama
    model: nomic-embed-text:latest
    apiBase: http://192.168.1.84:11434
    roles:
      - embed
context:
  - provider: code
  - provider: docs
  - provider: diff
  - provider: terminal
  - provider: problems
  - provider: folder
  - provider: codebase

XiXinping avatar Aug 01 '25 17:08 XiXinping

Hey there! I'd like to add that I've encountered a similar error when using the VSCode extension on Linux and trying to connect to an Ollama instance running Qwen3-Coder.

OS: Manjaro Linux Continue Version: v1.1.71 Model: qwen3-coder:30b VSCode Version: 1.101.2 Image

Here's my config.yaml:

name: Local Assistant
version: 1.0.0
schema: v1
models:
  - name: Qwen3-Coder
    provider: ollama
    model: qwen3-coder:30b
    apiBase: http://192.168.1.84:11434
    roles:
      - chat
      - autocomplete
      - edit
      - apply
  - name: Qwen2.5-Coder
    provider: ollama
    model: qwen2.5-coder:1.5b
    apiBase: http://192.168.1.84:11434
    roles:
      - chat
      - autocomplete
      - edit
      - apply
  - name: Nomic Embed
    provider: ollama
    model: nomic-embed-text:latest
    apiBase: http://192.168.1.84:11434
    roles:
      - embed
context:
  - provider: code
  - provider: docs
  - provider: diff
  - provider: terminal
  - provider: problems
  - provider: folder
  - provider: codebase

Hi @XiXinping in this case you need to add

capabilities:
      - tool_use

as show in my example https://github.com/continuedev/continue/issues/6913#issuecomment-3143498931 However, you’ll likely run into the same issue that the author and I experienced.

Pizzaschachtel avatar Aug 01 '25 18:08 Pizzaschachtel

So this is using Ollama, but I was able to get tool-calling working with qwen3-coder by editing the model template to use qwen3's template which does support tool-calling.

This is my Modelfile:

FROM qwen3-coder:30b

TEMPLATE """


{{- $lastUserIdx := -1 -}}
{{- range $idx, $msg := .Messages -}}
{{- if eq $msg.Role "user" }}{{ $lastUserIdx = $idx }}{{ end -}}
{{- end }}
{{- if or .System .Tools }}<|im_start|>system
{{ if .System }}
{{ .System }}
{{- end }}
{{- if .Tools }}

# Tools

You may call one or more functions to assist with the user query.

You are provided with function signatures within <tools></tools> XML tags:
<tools>
{{- range .Tools }}
{"type": "function", "function": {{ .Function }}}
{{- end }}
</tools>

For each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:
<tool_call>
{"name": <function-name>, "arguments": <args-json-object>}
</tool_call>
{{- end -}}
<|im_end|>
{{ end }}
{{- range $i, $_ := .Messages }}
{{- $last := eq (len (slice $.Messages $i)) 1 -}}
{{- if eq .Role "user" }}<|im_start|>user
{{ .Content }}<|im_end|>
{{ else if eq .Role "assistant" }}<|im_start|>assistant
{{ if (and $.IsThinkSet (and .Thinking (or $last (gt $i $lastUserIdx)))) -}}
<think>{{ .Thinking }}</think>
{{ end -}}
{{ if .Content }}{{ .Content }}
{{- else if .ToolCalls }}<tool_call>
{{ range .ToolCalls }}{"name": "{{ .Function.Name }}", "arguments": {{ .Function.Arguments }}}
{{ end }}</tool_call>
{{- end }}{{ if not $last }}<|im_end|>
{{ end }}
{{- else if eq .Role "tool" }}<|im_start|>user
<tool_response>
{{ .Content }}
</tool_response><|im_end|>
{{ end }}
{{- if and (ne .Role "assistant") $last }}<|im_start|>assistant
{{ end }}
{{- end }}
"""

PARAMETER stop "User:"
PARAMETER stop "Assistant:"

I then ran: ollama create qwen3-coder-tool:30b -f Modelfile

I then edited my config.yaml accordingly and it seemed to work.

XiXinping avatar Aug 01 '25 21:08 XiXinping

The latest beta of LMStudio (LM Studio 0.3.21 (Build 3)) works for me. I can now execute terminal commands, make web requests, and read and edit the current file. It was just a quick test, but it seems promising.

Pizzaschachtel avatar Aug 02 '25 07:08 Pizzaschachtel

Looks like LM Studio 0.3.21 Build 3 fixed the issue.

desugar-64 avatar Aug 04 '25 09:08 desugar-64

@desugar-64 How is this supposed to work when using model hosted through llama.cpp? (as OpenAI compatible provider)

llama.cpp related issue: https://github.com/ggml-org/llama.cpp/issues/15012

prusswan avatar Aug 04 '25 15:08 prusswan

@prusswan I assume LM Studio is modifying the response on their end. https://github.com/lmstudio-ai/lmstudio-bug-tracker/issues/825

desugar-64 avatar Aug 04 '25 19:08 desugar-64

@prusswan I assume LM Studio is modifying the response on their end. lmstudio-ai/lmstudio-bug-tracker#825

but this only works for LMStudio + continuedev? I'm using this through Windsurf/VSCode + llama.cpp

prusswan avatar Aug 05 '25 01:08 prusswan

This works LM Studio + anything that can consume OpenAI compatible API.

desugar-64 avatar Aug 05 '25 05:08 desugar-64

I had some major problems with the llama.cpp provider and then I figured that this provider does not provide an appropriate list of tools in the prompt (even if you add tool_use to capabilities). However, by simply switching to openai provider and apiBase: http://localhost:8080/v1, I managed to make tool calling work with qwen3-coder + llama.cpp.

meanderix avatar Aug 27 '25 20:08 meanderix

So this is using Ollama, but I was able to get tool-calling working with qwen3-coder by editing the model template to use qwen3's template which does support tool-calling.

This is my Modelfile:

FROM qwen3-coder:30b

TEMPLATE """


{{- $lastUserIdx := -1 -}}
{{- range $idx, $msg := .Messages -}}
{{- if eq $msg.Role "user" }}{{ $lastUserIdx = $idx }}{{ end -}}
{{- end }}
{{- if or .System .Tools }}<|im_start|>system
{{ if .System }}
{{ .System }}
{{- end }}
{{- if .Tools }}

# Tools

You may call one or more functions to assist with the user query.

You are provided with function signatures within <tools></tools> XML tags:
<tools>
{{- range .Tools }}
{"type": "function", "function": {{ .Function }}}
{{- end }}
</tools>

For each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:
<tool_call>
{"name": <function-name>, "arguments": <args-json-object>}
</tool_call>
{{- end -}}
<|im_end|>
{{ end }}
{{- range $i, $_ := .Messages }}
{{- $last := eq (len (slice $.Messages $i)) 1 -}}
{{- if eq .Role "user" }}<|im_start|>user
{{ .Content }}<|im_end|>
{{ else if eq .Role "assistant" }}<|im_start|>assistant
{{ if (and $.IsThinkSet (and .Thinking (or $last (gt $i $lastUserIdx)))) -}}
<think>{{ .Thinking }}</think>
{{ end -}}
{{ if .Content }}{{ .Content }}
{{- else if .ToolCalls }}<tool_call>
{{ range .ToolCalls }}{"name": "{{ .Function.Name }}", "arguments": {{ .Function.Arguments }}}
{{ end }}</tool_call>
{{- end }}{{ if not $last }}<|im_end|>
{{ end }}
{{- else if eq .Role "tool" }}<|im_start|>user
<tool_response>
{{ .Content }}
</tool_response><|im_end|>
{{ end }}
{{- if and (ne .Role "assistant") $last }}<|im_start|>assistant
{{ end }}
{{- end }}
"""

PARAMETER stop "User:"
PARAMETER stop "Assistant:"

I then ran: ollama create qwen3-coder-tool:30b -f Modelfile

I then edited my config.yaml accordingly and it seemed to work.

I tried this custom-model approach by @XiXinping with Ollama + Continue but it still seems to have the same issues in regards to tool calling.

my config.yaml:

Image Image

Another try:

Image

Sometimes the original qwen3-coder:30b model seems to be able to successfully use tool_calling, but never more than one tool per task (after the first tool call, it just outputs the contents/outputs in chat of what should've been another tool call, like creating a file):

Image Image

Often seems to stop after 2nd Tool Call:

Image

faetschi avatar Oct 14 '25 08:10 faetschi

It seems like the problem is fixed in the qwen model and using lmstudio

https://github.com/QwenLM/qwen-code/issues/783 https://github.com/lmstudio-ai/lmstudio-bug-tracker/issues/1071

Maybe a similiar problem exists in Continue, hence the Tool Calls fail with Ollama?

faetschi avatar Oct 14 '25 08:10 faetschi

So this is using Ollama, but I was able to get tool-calling working with qwen3-coder by editing the model template to use qwen3's template which does support tool-calling.

This is my Modelfile:

FROM qwen3-coder:30b

TEMPLATE """


{{- $lastUserIdx := -1 -}}
{{- range $idx, $msg := .Messages -}}
{{- if eq $msg.Role "user" }}{{ $lastUserIdx = $idx }}{{ end -}}
{{- end }}
{{- if or .System .Tools }}<|im_start|>system
{{ if .System }}
{{ .System }}
{{- end }}
{{- if .Tools }}

# Tools

You may call one or more functions to assist with the user query.

You are provided with function signatures within <tools></tools> XML tags:
<tools>
{{- range .Tools }}
{"type": "function", "function": {{ .Function }}}
{{- end }}
</tools>

For each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:
<tool_call>
{"name": <function-name>, "arguments": <args-json-object>}
</tool_call>
{{- end -}}
<|im_end|>
{{ end }}
{{- range $i, $_ := .Messages }}
{{- $last := eq (len (slice $.Messages $i)) 1 -}}
{{- if eq .Role "user" }}<|im_start|>user
{{ .Content }}<|im_end|>
{{ else if eq .Role "assistant" }}<|im_start|>assistant
{{ if (and $.IsThinkSet (and .Thinking (or $last (gt $i $lastUserIdx)))) -}}
<think>{{ .Thinking }}</think>
{{ end -}}
{{ if .Content }}{{ .Content }}
{{- else if .ToolCalls }}<tool_call>
{{ range .ToolCalls }}{"name": "{{ .Function.Name }}", "arguments": {{ .Function.Arguments }}}
{{ end }}</tool_call>
{{- end }}{{ if not $last }}<|im_end|>
{{ end }}
{{- else if eq .Role "tool" }}<|im_start|>user
<tool_response>
{{ .Content }}
</tool_response><|im_end|>
{{ end }}
{{- if and (ne .Role "assistant") $last }}<|im_start|>assistant
{{ end }}
{{- end }}
"""

PARAMETER stop "User:"
PARAMETER stop "Assistant:"

I then ran: ollama create qwen3-coder-tool:30b -f Modelfile

I then edited my config.yaml accordingly and it seemed to work.

this didnt work for me. the model doesnt produce text outputs and tool calls look like

Image

k3mist avatar Oct 24 '25 15:10 k3mist

I have the same problem in VSCode on my DGX Spark (Linux) running this model locally with continue.dev. Sometimes if I really make it think with multiple requests it will create a file, but not consistently. It doesn't work with qwen2.5 either, just prints <function=create_new_file> <parameter=filepath> docs/architecture.md<parameter=contents> in the chat but doesn't action it.

haidij avatar Oct 30 '25 10:10 haidij

Same issue as haidiji on DGX Spark. When running locally with Ollama and Qwen3 Coder 30 B Plan and Agent are not supported. The tool calling results in print statements.

Image

martintalero avatar Nov 03 '25 23:11 martintalero

To be fair I can't get any local model to work agentically in Continue on my DGX spark. I've tried ollama with gpt-oss:120b, Qwen 3 coder, Qwen 2.5 coder and Gemma3:27b. The best they can do seems to be an occasional unreadable file creation.

haidij avatar Nov 04 '25 07:11 haidij