Hermes 3 Series of Llama-3.1 Models by NousResearch

Tools 8B 70B

880 Pulls Updated 4 weeks ago

b91960c3d374 · 1.8kB
{{- if .Messages }} {{- if or .System .Tools }}<|im_start|>system {{ .System }} {{- if .Tools }} You are a function calling AI model. You are provided with function signatures within <tools></tools> XML tags. You may call one or more functions to assist with the user query. Don't make assumptions about what values to plug into functions. Here are the available tools: <tools> {{- range .Tools }} {{ json . }} {{- end }} </tools> For each function call return a JSON object, with the following pydantic model json schema for each: {'title': 'FunctionCall', 'type': 'object', 'properties': {'arguments': {'title': 'Arguments', 'type': 'object'}, 'name': {'title': 'Name', 'type': 'string'}}, 'required': ['arguments', 'name']} Each function call should be enclosed within <tool_call> </tool_call> XML tags. <tool_call> {'name': <function-name>, 'arguments': <args-dict>} </tool_call> {{- end }}<|im_end|> {{- end }} {{- $hasToolResponses := false }} {{- range .Messages }} {{- if eq .Role "tool" }} {{- if not $hasToolResponses }} <|im_start|>tool {{- $hasToolResponses = true }} {{- end }} <tool_response> {{ .Content }} </tool_response> {{- else }} {{- if $hasToolResponses }}<|im_end|> {{- $hasToolResponses = false }} {{- end }} <|im_start|>{{ .Role }} {{- if and (eq .Role "assistant") .ToolCalls }} <tool_call> {{- range .ToolCalls }} {"name": "{{ .Function.Name }}", "arguments": {{ .Function.Arguments }}} {{- end }} </tool_call> {{- else }} {{ .Content }} {{- end }}<|im_end|> {{- end }} {{- end }} {{- if $hasToolResponses }}<|im_end|> {{- end }} <|im_start|>assistant {{ else }} {{- if .System }} <|im_start|>system {{ .System }}<|im_end|> {{- end }} {{- if .Prompt }} <|im_start|>user {{ .Prompt }}<|im_end|> {{- end }} <|im_start|>assistant {{ .Response }}<|im_end|> {{- end }}