Zack Saadioui
4/25/2025
1 2 3{{- range .Messages }} {{ .Role }}: {{ .Content }} {{- end }}
1
Messages1
Role1
Content1
my_template.go1
2
3
4
5
6
7
8
go
TEMPLATE """
{{- .System }}<|start_header_id|>system<|end_header_id|>
{{ .System }}<|eot_id|>
{{- end }}
{{- range .Messages }}<|start_header_id|>{{ .Role }}<|end_header_id|>
{{ .Content }}<|eot_id|>
{{- end }}<|start_header_id|>assistant<|end_header_id|>"1
Modelfile1
Modelfile1
2
bash
TEMPLATE my_template1
2
bash
ollama run your_model_name1
2
go
SYSTEM """You are a personal AI assistant here to help users understand programming concepts."""1
Prompt1
2
go
{{ .Prompt }}1
Response1
2
3
4
5
6
go
{{- if .SomeCondition }}
This condition is true.
{{- else }}
Default response.
{{- end }}1
2
3
4
5
6
go
{{- if eq .Role "admin" }}
Admin access granted.
{{- else }}
User access only.
{{- end }}1
2
3
4
go
{{- range .Messages }}
{{ .Role }}: {{ .Content }}
{{- end }}1
2
3
4
5
6
7
8
9
10
bash
TEMPLATE """
{{- if eq .Role "admin" }}
Welcome, Admin! How can I assist you today?
{{- else if eq .Role "user" }}
Hello, User! What questions do you have?
{{- else }}
Hi there! How can I help you?
{{- end }}
"""1
2
bash
SYSTEM "Your role is to assist users in their programming queries."1
2
bash
ollama run your_chatbot_modelCopyright © Arsturn 2025