3 3 months ago

vision tools 27b
c8e2ea2c4b95 · 1.1kB
{{- if or .System .Tools }}<start_of_turn>user
{{ if .System }}{{ .System }}{{ end }}
{{- if .Tools }}
You have access to functions. If you decide to invoke any of the function(s), you MUST put it in the format of
[
{"name": function name, "arguments": dictionary of argument name and its value},
... (more tool calls as required)
]
You SHOULD NOT include any other text in the response if you call a function. Followings are available functions:
{{json .Tools }}
Use the function output to answer the user's question.
{{- end }}
{{- end }}<end_of_turn>
{{- range $i, $_ := .Messages }}
{{- $last := eq (len (slice $.Messages $i)) 1 }}
{{- if or (eq .Role "user") (eq .Role "system") (eq .Role "tool") }}<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 $i, $_ := .ToolCalls }}
{"name": "{{ .Function.Name }}", "arguments": {{ .Function.Arguments }}}
{{- end }}
]
{{- else}}
{{ .Content }}
{{- end }}
{{- if not $last }}<end_of_turn>{{- end }}
{{- end }}
{{- end }}