[GH-ISSUE #8329] dolphin3 template doesn't support tools #5337

Open
opened 2026-04-12 16:32:16 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @rick-github on GitHub (Jan 7, 2025).
Original GitHub issue: https://github.com/ollama/ollama/issues/8329

The blurb for the new dolphin3 model mentions "function calling" but the template doesn't support it. Replacing it with the template from llama3.1 (the base model) seems to work fine.

Originally created by @rick-github on GitHub (Jan 7, 2025). Original GitHub issue: https://github.com/ollama/ollama/issues/8329 The blurb for the new [dolphin3](https://ollama.com/library/dolphin3) model mentions "function calling" but the template doesn't support it. Replacing it with the template from llama3.1 (the base model) seems to work fine.
GiteaMirror added the model label 2026-04-12 16:32:16 -05:00
Author
Owner

@rick-github commented on GitHub (Jan 7, 2025):

After further testing, the llama3.1 template is not a drop-in replacement.

<!-- gh-comment-id:2574403560 --> @rick-github commented on GitHub (Jan 7, 2025): After further testing, the llama3.1 template is not a drop-in replacement.
Author
Owner

@rick-github commented on GitHub (Jan 7, 2025):

A slightly modified version passes initial tests.

{{- if or .System .Tools }}<|im_start|>system
{{- if .System }}

{{ .System }}
{{- end }}
{{- if .Tools }}

When you receive a tool call response, use the output to format an answer to the original user question.

You are a helpful assistant with tool calling capabilities.
{{- end }}<|im_end|>
{{- end }}
{{- range $i, $_ := .Messages }}
{{- $last := eq (len (slice $.Messages $i)) 1 }}
{{- if eq .Role "user" }}<|im_start|>user
{{- if and $.Tools $last }}

Given the following functions, please respond with a JSON for a function call with its proper arguments that best answers the given prompt.

Respond in the format {"name": function name, "parameters": dictionary of argument name and its value}. Do not use variables.

{{ range $.Tools }}
{{- . }}
{{ end }}
Question: {{ .Content }}<|im_end|>
{{- else }}

{{ .Content }}<|im_end|>
{{- end }}{{ if $last }}<|im_start|>assistant

{{ end }}
{{- else if eq .Role "assistant" }}<|im_start|>assistant
{{- if .ToolCalls }}
{{ range .ToolCalls }}
{"name": "{{ .Function.Name }}", "parameters": {{ .Function.Arguments }}}{{ end }}
{{- else }}

{{ .Content }}
{{- end }}{{ if not $last }}<|im_end|>{{ end }}
{{- else if eq .Role "tool" }}<|im_start|>ipython

{{ .Content }}<|im_end|>{{ if $last }}<|im_start|>assistant

{{ end }}
{{- end }}
{{- end -}}
<!-- gh-comment-id:2574455322 --> @rick-github commented on GitHub (Jan 7, 2025): A slightly modified version passes initial tests. ```go {{- if or .System .Tools }}<|im_start|>system {{- if .System }} {{ .System }} {{- end }} {{- if .Tools }} When you receive a tool call response, use the output to format an answer to the original user question. You are a helpful assistant with tool calling capabilities. {{- end }}<|im_end|> {{- end }} {{- range $i, $_ := .Messages }} {{- $last := eq (len (slice $.Messages $i)) 1 }} {{- if eq .Role "user" }}<|im_start|>user {{- if and $.Tools $last }} Given the following functions, please respond with a JSON for a function call with its proper arguments that best answers the given prompt. Respond in the format {"name": function name, "parameters": dictionary of argument name and its value}. Do not use variables. {{ range $.Tools }} {{- . }} {{ end }} Question: {{ .Content }}<|im_end|> {{- else }} {{ .Content }}<|im_end|> {{- end }}{{ if $last }}<|im_start|>assistant {{ end }} {{- else if eq .Role "assistant" }}<|im_start|>assistant {{- if .ToolCalls }} {{ range .ToolCalls }} {"name": "{{ .Function.Name }}", "parameters": {{ .Function.Arguments }}}{{ end }} {{- else }} {{ .Content }} {{- end }}{{ if not $last }}<|im_end|>{{ end }} {{- else if eq .Role "tool" }}<|im_start|>ipython {{ .Content }}<|im_end|>{{ if $last }}<|im_start|>assistant {{ end }} {{- end }} {{- end -}} ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#5337