58.4K 1 year ago

Llama 3.1 customized by NVIDIA into a reasoning model that is post trained for reasoning, human chat preferences, and tasks, such as RAG and tool calling. Significantly improved performance over base Llama model.

tools thinking 8b
da785cad5986 ยท 1.7kB
<|start_header_id|>system<|end_header_id|>
{{- if $.IsThinkSet -}}
detailed thinking on
{{- else -}}
detailed thinking off
{{- end -}}<|eot_id|>
{{- if .Tools }}
You have access to the following functions. To call a function, please respond with JSON for a function call. Respond in the format {"name": function name, "parameters": dictionary of argument name and its value}. Do not use variables.
{{- range .Tools }}
{{ . }}
{{- end }}
{{- end }}
{{- range $i, $_ := .Messages }}
{{- $isLast := eq (len (slice $.Messages $i)) 1 }}
{{- if eq .Role "system" }}
{{/* skip, our system block is above */}}
{{- else if eq .Role "assistant" }}
<|start_header_id|>assistant<|end_header_id|>
{{- /* if thinking-off, always pre-fill an empty think block: */}}
{{- if not $.IsThinkSet }}
<think>
</think>
{{- end }}
{{- /* if thinking-on and this response has .Thinking, render it: */}}
{{- if and $.IsThinkSet .Thinking }}
<think>
{{ .Thinking }}
</think>
{{- end }}
{{- /* then the actual content or tool call */}}
{{- if .Content }}
{{ .Content }}
{{- else if .ToolCalls }}
{{- range .ToolCalls }}
{"name": "{{ .Function.Name }}", "parameters": {{ .Function.Arguments }} }
{{- end }}
{{- end }}
{{- if not $isLast }}<|eot_id|>{{ end }}
{{- else if eq .Role "tool" }}
<|start_header_id|>ipython<|end_header_id|>
{{ .Content }}<|eot_id|>
{{- if $isLast }}<|start_header_id|>assistant<|end_header_id|>{{ end }}
{{- else }}
<|start_header_id|>{{ .Role }}<|end_header_id|>
{{ .Content }}<|eot_id|>
{{- if $isLast }}<|start_header_id|>assistant<|end_header_id|>{{ end }}
{{- end }}
{{- end }}