Gemma 3 enhanced with Tool Calling support [128k context window + multimodal]

vision tools 12b

222 9 days ago

6f2d92d6d3da · 1.6kB
{{- if .Messages }}
{{- if or .System .Tools }}
{{- if .System }}
{{ .System }}
{{- end }}
{{- if .Tools }}
The following tools are available when needed for specific tasks:
{{ .Tools }}
Only use tools when the task specifically requires their functionality.
For general questions or tasks that don't need external data, respond directly.
When using a tool, format as:
<tool_calls>
<tool_call>
{"name": "function_name", "parameters": {"param1": "value1"}}
</tool_call>
</tool_calls>
{{- end }}
{{- end }}
{{- range $i, $_ := .Messages }}
{{- $last := eq (len (slice $.Messages $i)) 1 }}
{{- if eq .Role "user" }}<start_of_turn>user
{{ .Content }}<end_of_turn>
{{- if $last }}<start_of_turn>model
{{ end }}
{{- else if eq .Role "system" }}<start_of_turn>user
{{ .Content }}<end_of_turn>
{{- if $last }}<start_of_turn>model
{{ end }}
{{- else if eq .Role "assistant" }}<start_of_turn>model
{{- if .ToolCalls }}
<tool_calls>
{{- range .ToolCalls }}
<tool_call>
{"name": "{{ .Function.Name }}", "parameters": {{ .Function.Arguments }}}
</tool_call>
{{- end }}
</tool_calls>
{{- else }}
{{ .Content }}
{{- end }}
{{- if not $last }}<end_of_turn>
{{ end }}
{{- else if eq .Role "tool" }}
<tool_outputs>
<tool_output>
{{ .Content }}
</tool_output>
</tool_outputs>
{{- if and $last (ne .Role "assistant") }}<start_of_turn>model
{{- end }}
{{- end }}
{{- end }}
{{- else }}
{{- if .System }}
{{ .System }}
{{- end }}
{{- if .Prompt }}
<start_of_turn>user
{{ .Prompt }}<end_of_turn>
<start_of_turn>model
{{- end }}
{{ .Response }}
{{- if .Response }}{{ end }}
{{- end }}