380 6 months ago

The current, most capable model that runs on a single GPU with Tools Support

vision tools 1b 12b 27b
... /
template
69970bb0f6ac · 2.5kB
{{- /* System Prompt - Always at the beginning */ -}}
{{- if or .System .Tools }}
<start_of_turn>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. You only call tools when you need to get more information to reply.
Do not call tools unnecessarily, especially for introductory or basic questions, such as "who are you?", "introduce yourself", "what is your name?" or variations of such questions.
Every tool call is very precious and will cost a lot of money, so please do not call tools too often.
{{- end }}
<end_of_turn>
{{- end }}
{{- /* Iterate through messages */ -}}
{{- range $i, $_ := .Messages }}
{{- $last := eq (len (slice $.Messages $i)) 1 }}
{{- /* User and System Messages */ -}}
{{- if or (eq .Role "user") (eq .Role "system") }}
<start_of_turn>user
{{- /* Tool Definitions for the LAST User Turn */ -}}
{{- if and $.Tools $last (eq .Role "user") }}
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 }}
You must only call these tools: {{ range $i, $tool := $.Tools }}{{ if $i }}, {{ end }}`{{- $tool.Function.Name }}`{{ end }}.
You MUST NOT call ANY tool when responding to questions like "who are you?", "introduce yourself", "what is your name?", or any variations of these questions.
{{- end }}
{{ .Content }}<end_of_turn>
{{- /* Start Assistant Turn if it's the Last Message */ -}}
{{ if $last }}<start_of_turn>model
{{ end }}
{{- /* Assistant Messages */ -}}
{{- else if eq .Role "assistant" }}
<start_of_turn>model
{{- /* Tool Call JSON Output */ -}}
{{- if .ToolCalls }}
{{- range .ToolCalls }}
{"name": "{{ .Function.Name }}", "parameters": {{ .Function.Arguments }}}
{{ end }}
{{- else }}
{{ .Content }}
{{- end }}
{{- /* End Turn if Not the Last Message */ -}}
{{- if not $last }}<end_of_turn>
{{ end }}
{{- /* Tool Result Messages (System Role in Gemma3) */ -}}
{{- else if eq .Role "tool" }}
<start_of_turn>user
Tool result:
{{ .Content }}<end_of_turn>
{{- /* Start Assistant Turn if it's the Last Message */ -}}
{{ if $last }}<start_of_turn>model
{{ end }}
{{- end }}
{{- end }}