Japanese language models trained by SB Intuitions, available in [F16, q8_0, q6_K, q4_K_S]

tools

90 4 weeks ago

94aabaeb4847 · 1.7kB
{{- range .Messages }}
{{- if eq .Role "user" }}
{{- if $.Tools }}
{{- print "<|available_tools|>[" }}
{{- range $index, $tool := $.Tools }}
{{- if $index }}
{{- print ", " }}
{{- end }}
{{- $function := $tool.Function }}
{{- print "{" }}
{{- range $key, $val := $function }}
{{- if ne $key "return" }}
{{- print ", " }}
{{- printf "'%s': %s" $key (json $val) }}
{{- end }}
{{- end }}
{{- print "}" }}
{{- end }}
{{- print "]" }}
{{- print "\n" }}
{{- end }}
{{- print "<|user|>" .Content "\n" }}
{{- else if eq .Role "system" }}
{{- print "<|system|>" .Content "\n" }}
{{- else if eq .Role "assistant" }}
{{- print "<|assistant|>" .Content }}
{{- if .ToolCalls }}
{{- print "<|tool_calls|>[" }}
{{- range $index, $tool_call := .ToolCalls }}
{{- if $index }}
{{- print ", " }}
{{- end }}
{{- printf "{'id': '%s', 'name': '%s', 'arguments': %s}" $tool_call.Id $tool_call.Name (json $tool_call.Arguments) }}
{{- end }}
{{- print "]" }}
{{- end }}
{{- print "\n" }}
{{- else if eq .Role "tool_results" }}
{{- print "<|tool_results|>[" }}
{{- range $index, $tool_result := .ToolResults }}
{{- if $index }}
{{- print ", " }}
{{- end }}
{{- printf "{'content': %s, 'call_id': '%s'}" (json $tool_result.Content) $tool_result.CallId }}
{{- end }}
{{- print "]" }}
{{- print "\n" }}
{{- end }}
{{- end }}
{{- print "<|assistant|>" }}