Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save allenporter/67852610cf70a857c5efa3cb20e05d95 to your computer and use it in GitHub Desktop.
Save allenporter/67852610cf70a857c5efa3cb20e05d95 to your computer and use it in GitHub Desktop.
FROM mistral:latest
TEMPLATE """{{- range $index, $_ := .Messages }}
{{- if eq .Role "user" }}
{{- if and (eq (len (slice $.Messages $index)) 1) $.Tools }}[AVAILABLE_TOOLS] {{ $.Tools }}[/AVAILABLE_TOOLS]
{{- end }}[INST] {{ if and (eq (len (slice $.Messages $index)) 1) $.System }}{{ $.System }}
{{ end }}{{ .Content }}[/INST]
{{- else if eq .Role "assistant" }}
{{- if .Content }} {{ .Content }}</s>
{{- else if .ToolCalls }}[TOOL_CALLS] [
{{- range .ToolCalls }}{"name": "{{ .Function.Name }}", "arguments": {{ .Function.Arguments }}}
{{- end }}]</s>
{{- end }}
{{- else if eq .Role "tool" }}[TOOL_RESULTS] {"content": {{ .Content }}}[/TOOL_RESULTS]
{{- end }}
{{- end }}"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment