A strong, economical, and efficient Mixture-of-Experts language model with Tool Calling.
tools
16b
236b
170 Pulls Updated 2 months ago
a3723e8242d3 · 1.3kB
{{- if .Messages }}
{{- if or .System .Tools }}
{{- if .System }}
{{ .System }}
{{- end }}
{{- if .Tools }}
You are a helpful assistant with tool calling capabilities. When you receive a tool call response, use the output to format an answer to the original user's question.
{{- end }}
{{- end }}
{{- range $i, $_ := .Messages }}
{{- $last := eq (len (slice $.Messages $i)) 1 }}
{{- if eq .Role "user" }}
User:
{{- 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": dictionary of argument name and its value}. Do not use variables.
{{ $.Tools }}
{{- end }}
{{ .Content }}
{{- if $last }}Assistant:{{ end }}
{{- else if eq .Role "assistant" }}
Assistant:
{{- if .ToolCalls }}
{{- range .ToolCalls }}
{"name": "{{ .Function.Name }}", "parameters": {{ .Function.Arguments }}}
{{- end }}
{{- else }}
{{ .Content }}
{{- if not $last }}{{ end }}
{{- end }}
{{- else if eq .Role "tool" }}
{{ .Content }}
{{- if $last }}Assistant:{{ end }}
{{- end }}
{{- end }}
{{- else }}
{{- if .System }}
{{ .System }}
{{- end }}
{{- if .Prompt }}
User:
{{ .Prompt }}
{{- end }}
Assistant:
{{ .Response }}
{{- if .Response }}{{ end }}
{{- end }}