Created
March 14, 2025 04:57
-
-
Save ehartford/f34ba4ad4d97c5941fddcfa1504e54a4 to your computer and use it in GitHub Desktop.
gemma3 tool
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM gemma3:latest | |
TEMPLATE """{{- /* If you want to inject system or tool instructions before the conversation, do it here */ -}} | |
{{- if or .System .Tools }} | |
<start_of_turn>user | |
{{ if .System }} | |
{{ .System }} | |
{{ end }} | |
{{ if .Tools }} | |
Cutting Knowledge Date: December 2023 | |
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 }} | |
<end_of_turn> | |
<start_of_turn>model | |
{{ end }} | |
{{- range $i, $_ := .Messages }} | |
{{- $last := eq (len (slice $.Messages $i)) 1 }} | |
{{- if or (eq .Role "user") (eq .Role "system") }} | |
<start_of_turn>user | |
{{/* If it’s the user’s final turn and we have Tools, insert the JSON instructions */}} | |
{{ 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": {argument_name: value}}. Do not use variables. | |
{{ range $.Tools }} | |
{{ . }} | |
{{ end }} | |
Question: {{ .Content }} | |
<end_of_turn> | |
{{ if $last }}<start_of_turn>model{{ end }} | |
{{ else }} | |
{{ .Content }} | |
<end_of_turn> | |
{{ if $last }}<start_of_turn>model{{ end }} | |
{{ end }} | |
{{- else if eq .Role "assistant" }} | |
<start_of_turn>model | |
{{- if .ToolCalls }} | |
{{ range .ToolCalls }} | |
{"name": "{{ .Function.Name }}", "parameters": {{ .Function.Arguments }}} | |
{{ end }} | |
{{- else }} | |
{{ .Content }} | |
{{- end }} | |
{{ if not $last }}<end_of_turn>{{ end }} | |
{{- else if eq .Role "tool" }} | |
<start_of_turn>tool | |
{{ .Content }} | |
{{ if not $last }}<end_of_turn>{{ end }} | |
{{- end }} | |
{{- end }}""" | |
PARAMETER stop <end_of_turn> | |
PARAMETER temperature 0.1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment