mistral-medium-3.5:128b-q8_0

6 19 hours ago

Mistral Medium 3.5 is the first flagship model of Mistral AI that merged instruction-following, reasoning, and coding in a single set of 128B weights.

vision tools thinking 128b
20c887c0de3e · 4.0kB
{{- define "jsonValue" -}}
{{- if eq (printf "%T" .) "template.templateArgs" -}}{{ template "jsonMap" . }}
{{- else if eq (printf "%T" .) "map[string]interface {}" -}}{{ template "jsonMap" . }}
{{- else if eq (printf "%T" .) "[]interface {}" -}}{{ template "jsonSlice" . }}
{{- else if eq (printf "%T" .) "[]string" -}}{{ template "jsonSlice" . }}
{{- else -}}{{ json . }}
{{- end -}}
{{- end -}}
{{- define "jsonMap" -}}
{{- if . -}}{ {{- $first := true -}}{{ range $key, $value := . }}{{ if not $first }}, {{ end }}{{ $first = false }}{{ json $key }}: {{ template "jsonValue" $value }}{{ end -}} }{{- else -}}{}{{- end -}}
{{- end -}}
{{- define "jsonSlice" -}}
[{{- range $index, $value := . }}{{ if $index }}, {{ end }}{{ template "jsonValue" $value }}{{ end -}}]
{{- end -}}
{{- define "toolsJSON" -}}
[{{- range $index, $tool := . }}{{ if $index }}, {{ end }}{{ template "toolJSON" $tool }}{{ end -}}]
{{- end -}}
{{- define "toolJSON" -}}
{"function": {{ template "toolFunctionJSON" .Function }}{{ if .Items }}, "items": {{ template "jsonValue" .Items }}{{ end }}, "type": {{ json .Type }}}
{{- end -}}
{{- define "toolFunctionJSON" -}}
{"description": {{ json .Description }}, "name": {{ json .Name }}, "parameters": {{ template "toolParametersJSON" .Parameters }}}
{{- end -}}
{{- define "toolParametersJSON" -}}
{ {{- $first := true -}}{{ if .Defs }}{{ $first = false }}"$defs": {{ template "jsonValue" .Defs }}{{ end }}{{ if .Items }}{{ if not $first }}, {{ end }}{{ $first = false }}"items": {{ template "jsonValue" .Items }}{{ end }}{{ if .Properties }}{{ if not $first }}, {{ end }}{{ $first = false }}"properties": {{ template "toolPropertiesJSON" .Properties }}{{ end }}{{ if .Required }}{{ if not $first }}, {{ end }}{{ $first = false }}"required": {{ template "jsonSlice" .Required }}{{ end }}{{ if .Type }}{{ if not $first }}, {{ end }}{{ $first = false }}"type": {{ json .Type }}{{ end -}} }
{{- end -}}
{{- define "toolPropertiesJSON" -}}
{{- if . -}}{ {{- $first := true -}}{{ range $key, $value := . }}{{ if not $first }}, {{ end }}{{ $first = false }}{{ json $key }}: {{ template "toolPropertyJSON" $value }}{{ end -}} }{{- else -}}{}{{- end -}}
{{- end -}}
{{- define "toolPropertyJSON" -}}
{ {{- $first := true -}}{{ if .AnyOf }}{{ $first = false }}"anyOf": {{ json .AnyOf }}{{ end }}{{ if .Description }}{{ if not $first }}, {{ end }}{{ $first = false }}"description": {{ json .Description }}{{ end }}{{ if .Enum }}{{ if not $first }}, {{ end }}{{ $first = false }}"enum": {{ template "jsonSlice" .Enum }}{{ end }}{{ if .Items }}{{ if not $first }}, {{ end }}{{ $first = false }}"items": {{ template "jsonValue" .Items }}{{ end }}{{ if .Properties }}{{ if not $first }}, {{ end }}{{ $first = false }}"properties": {{ json .Properties }}{{ end }}{{ if .Required }}{{ if not $first }}, {{ end }}{{ $first = false }}"required": {{ template "jsonSlice" .Required }}{{ end }}{{ if .Type }}{{ if not $first }}, {{ end }}{{ $first = false }}"type": {{ json .Type }}{{ end -}} }
{{- end -}}
<s>{{- $toolsAndSettingsEmitted := false }}
{{- $reasoningEffort := "none" }}
{{- if eq .ThinkLevel "high" }}{{ $reasoningEffort = "high" }}{{ end }}
{{- range $index, $_ := .Messages }}
{{- if eq .Role "system" }}[SYSTEM_PROMPT]{{ .Content }}[/SYSTEM_PROMPT]
{{- else if eq .Role "user" }}
{{- if not $toolsAndSettingsEmitted }}{{ if $.Tools }}[AVAILABLE_TOOLS]{{ template "toolsJSON" $.Tools }}[/AVAILABLE_TOOLS]{{ end }}[MODEL_SETTINGS]{"reasoning_effort": "{{ $reasoningEffort }}"}[/MODEL_SETTINGS]{{ $toolsAndSettingsEmitted = true }}{{ end }}[INST]{{ .Content }}[/INST]
{{- else if eq .Role "assistant" }}
{{- if .Thinking }}[THINK]{{ .Thinking }}[/THINK]{{ end }}{{ if .Content }}{{ .Content }}{{ end }}{{ if .ToolCalls }}{{ range .ToolCalls }}[TOOL_CALLS]{{ .Function.Name }}[ARGS]{{ template "jsonValue" .Function.Arguments }}{{ end }}{{ end }}</s>
{{- else if eq .Role "tool" }}[TOOL_RESULTS]{{ .Content }}[/TOOL_RESULTS]
{{- end }}
{{- end -}}