57 11 months ago

vision tools 12b
ff475260545a · 1.2kB
{{- if .System }}<start_of_turn>user
{{ .System }}
{{- if .Tools }}
You have access to functions.
{{- range .Tools }}
{{ . }}
{{- end }}
If you decide to invoke any of the function(s), you MUST put it in the format of
<tool_call>
{"name": function name, "parameters": dictionary of argument name and its value}
</tool_call>
{"name": function name, "parameters": dictionary of argument name and its value}
You SHOULD NOT include any other text in the response if you call a function
{{- end }}<end_of_turn>
<start_of_turn>model
I understand.
<end_of_turn>
{{- 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 "assistant" }}<start_of_turn>model
{{ if .ToolCalls }}
{{- range .ToolCalls }}
<tool>
{"name": "{{ .Function.Name }}", "parameters": {{ .Function.Arguments }}}
</tool>
{{- end }}
{{- else }}
{{ .Content }}
{{- end }}{{ if not $last }}<end_of_turn>
{{ end }}
{{- 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 }}