Models
GitHub
Discord
Docs
Cloud
Sign in
Download
Models
Download
GitHub
Discord
Docs
Cloud
Sign in
mashriram
/
gemma3_tools
:270m
57
Downloads
Updated
2 months ago
Cancel
tools
270m
gemma3_tools:270m
...
/
template
de59fad4fbcf · 1.4kB
{{- /* System message and tool definitions are presented first */ -}}
{{- if or .System .Tools }}
<start_of_turn>user
{{- if .System }}
{{ .System }}
{{- end }}
{{- if .Tools }}
**Here are the tools you can use:**
{{ range .Tools }}
{{ . }}
{{ end }}
**Tool Call Format:**
You must call tools using this exact JSON format inside a <tool_call> block:
<tool_call>
{"name": "tool_name", "parameters": {"param1": "value1", "param2": "value2"}}
</tool_call>
{{- end }}
<end_of_turn>
{{- end }}
{{- /* This section processes all the messages in the conversation history */ -}}
{{- range $i, $_ := .Messages }}
{{- $last := eq (len (slice $.Messages $i)) 1 }}
{{- /* User messages */ -}}
{{- if eq .Role "user" }}
<start_of_turn>user
{{ .Content }}<end_of_turn>
{{- if $last }}<start_of_turn>model
{{ end }}
{{- /* Assistant's turn (either a text response or a tool call) */ -}}
{{- else if eq .Role "assistant" }}
<start_of_turn>model
{{- if .ToolCalls }}
<tool_call>
{{- range .ToolCalls }}
{"name": "{{ .Function.Name }}", "parameters": {{ .Function.Arguments }}}
{{- end }}
</tool_call>
{{- else }}
{{ .Content }}
{{- end }}
{{- if not $last }}<end_of_turn>
{{ end }}
{{- /* Tool results provided back to the model */ -}}
{{- else if eq .Role "tool" }}
<start_of_turn>user
<tool_response>
{{ .Content }}
</tool_response><end_of_turn>
{{- if $last }}<start_of_turn>model
{{ end }}
{{- end }}
{{- end }}