Skip to content

Instantly share code, notes, and snippets.

@laiso
Last active January 5, 2025 14:07
Show Gist options
  • Save laiso/1ad90f600fd1f6cba16eb52c8658a782 to your computer and use it in GitHub Desktop.
Save laiso/1ad90f600fd1f6cba16eb52c8658a782 to your computer and use it in GitHub Desktop.
lama3.1-cline-8b.Modelfile. usage: 'llama create llama3.1-cline:8b -f ./lama3.1-cline-8b.Modelfile'
FROM llama3.1:8b
PARAMETER num_ctx 20480
TEMPLATE """
{{- if or .System .Tools }}<|start_header_id|>system<|end_header_id|>
{{- if .System }}
{{ .System }}
{{- end }}
{{- if .Tools }}
# Tools
You may call one or more functions to assist with the user query.
You are provided with function signatures within <tools></tools> XML tags:
<tools>
{{- range .Tools }}
{"type": "function", "function": {{ .Function }}}
{{- end }}
</tools>
For each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:
<tool_call>
{"name": <function-name>, "arguments": <args-json-object>}
</tool_call>
{{- end }}<|eot_id|>
{{- end }}
{{- range $i, $_ := .Messages }}
{{- $last := eq (len (slice $.Messages $i)) 1 }}
{{- if eq .Role "user" }}<|start_header_id|>user<|end_header_id|>
{{ .Content }}<|eot_id|>
{{ if $last }}<|start_header_id|>assistant<|end_header_id|>
{{ end }}
{{- else if eq .Role "assistant" }}<|start_header_id|>assistant<|end_header_id|>
{{- if .ToolCalls }}
<tool_call>
{{ range .ToolCalls }}{"name": "{{ .Function.Name }}", "arguments": {{ .Function.Arguments }}}{{ end }}
</tool_call>
{{- else }}
{{ .Content }}
{{- end }}{{ if not $last }}<|eot_id|>{{ end }}
{{- else if eq .Role "tool" }}<|start_header_id|>ipython<|end_header_id|>
<tool_response>
{{ .Content }}
</tool_response>
<|eot_id|>{{ if $last }}<|start_header_id|>assistant<|end_header_id|>
{{ end }}
{{- end }}
{{- end }}
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment