Skip to content

Get up and running with Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.

update embedded templates

Michael Yang19753c18c011
diff --git a/template/alfred.gotmpl b/template/alfred.gotmpl
index 44284f04c..71bc6706f 100644
--- a/template/alfred.gotmpl
+++ b/template/alfred.gotmpl
@@ -3,6 +3,6 @@
{{- end }}
{{- range .Messages }}<start_{{ .Role }}>{{ .Content }}<end_message>
{{- end }}<start_assistant>
-{{- else }}
+{{- else -}}
{{ if .System }}<start_system>{{ .System }}<end_message>{{ end }}{{ if .Prompt }}<start_user>{{ .Prompt }}<end_message>{{ end }}<start_assistant>{{ .Response }}<end_message>
-{{- end }}
\ No newline at end of file
+{{- end -}}
\ No newline at end of file
diff --git a/template/alpaca.gotmpl b/template/alpaca.gotmpl
index c1f69dc92..e9becb3d4 100644
--- a/template/alpaca.gotmpl
+++ b/template/alpaca.gotmpl
@@ -1,6 +1,7 @@
{{- if .Messages }}
{{- if .System }}{{ .System }}
-{{- end }}
+
+{{ end }}
{{- range .Messages }}
{{- if eq .Role "user" }}### Instruction:
{{- else if eq .Role "assistant" }}### Response:
@@ -8,7 +9,7 @@
{{ .Content }}
{{ end }}### Response:
-{{ else }}
+{{ else -}}
{{ if .System }}{{ .System }}
{{ end }}{{ if .Prompt }}### Instruction:
@@ -16,4 +17,5 @@
{{ end }}### Response:
{{ .Response }}
-{{- end }}
\ No newline at end of file
+
+{{ end -}}
\ No newline at end of file
diff --git a/template/chatml.gotmpl b/template/chatml.gotmpl
index d945547c7..eb8ab0dcd 100644
--- a/template/chatml.gotmpl
+++ b/template/chatml.gotmpl
@@ -5,11 +5,11 @@
{{- range .Messages }}<|im_start|>{{ .Role }}
{{ .Content }}<|im_end|>
{{ end }}<|im_start|>assistant
-{{ else }}
+{{ 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 }}
\ No newline at end of file
+{{ end -}}
\ No newline at end of file
diff --git a/template/chatqa.gotmpl b/template/chatqa.gotmpl
index 7022c4790..41c6ced59 100644
--- a/template/chatqa.gotmpl
+++ b/template/chatqa.gotmpl
@@ -8,10 +8,11 @@
{{- end }} {{ .Content }}
{{ end }}Assistant:
-{{- else }}
+{{- else -}}
{{ if .System }}System: {{ .System }}
{{ end }}{{ if .Prompt }}User: {{ .Prompt }}
-{{ end }}Assistant: <|begin_of_text|>{{ .Response }}
-{{- end }}
\ No newline at end of file
+{{ end }}Assistant: {{ .Response }}
+
+{{ end -}}
\ No newline at end of file
diff --git a/template/codellama-70b-instruct.gotmpl b/template/codellama-70b-instruct.gotmpl
index 392d839eb..0a313d389 100644
--- a/template/codellama-70b-instruct.gotmpl
+++ b/template/codellama-70b-instruct.gotmpl
@@ -7,13 +7,13 @@
{{ .Content }} <step> {{ end }}Source: assistant
Destination: user
-{{ else }}
-{{ if .System }} Source: system
+ {{ else -}}
+{{ if .System }}Source: system
- {{ .System }} <step>{{ end }} Source: user
+ {{ .System }} <step> {{ end }}Source: user
{{ .Prompt }} <step> Source: assistant
Destination: user
- {{ .Response }}<step>
-{{- end }}
\ No newline at end of file
+ {{ .Response }} <step>
+{{- end -}}
\ No newline at end of file
diff --git a/template/falcon-instruct.gotmpl b/template/falcon-instruct.gotmpl
index 99d67f93c..3a403007e 100644
--- a/template/falcon-instruct.gotmpl
+++ b/template/falcon-instruct.gotmpl
@@ -6,8 +6,10 @@
{{ else if eq .Role "assistant" }}Falcon:
{{ end }}{{ .Content }}
{{ end }}Falcon:
-{{ else }}
-{{ if .System }}{{ .System }}
-{{ end }}{{ if .Prompt }}User: {{ .Prompt }}
-{{ end }}Assistant: {{ .Response }}
-{{- end }}
\ No newline at end of file
+{{ else -}}
+{{ if .System }}System: {{ .System }}
+{{ end }}{{ if .Prompt }}User:
+{{ .Prompt }}
+{{ end }}Falcon:
+{{ .Response }}
+{{ end -}}
\ No newline at end of file
diff --git a/template/gemma-instruct.gotmpl b/template/gemma-instruct.gotmpl
index 870a8f2e2..6d778a70f 100644
--- a/template/gemma-instruct.gotmpl
+++ b/template/gemma-instruct.gotmpl
@@ -8,9 +8,10 @@
{{- end }}
{{ .Content }}<end_of_turn>
{{ end }}<start_of_turn>model
-{{ else }}
+{{ else -}}
<start_of_turn>user
-{{ if .System }}{{ .System }} {{ end }}{{ .Prompt }}<end_of_turn>
+{{ if .System }}{{ .System }}
+{{ end }}{{ .Prompt }}<end_of_turn>
<start_of_turn>model
{{ .Response }}<end_of_turn>
-{{- end }}
\ No newline at end of file
+{{ end -}}
\ No newline at end of file
diff --git a/template/granite-instruct.gotmpl b/template/granite-instruct.gotmpl
index 327ff3eef..4a85a97be 100644
--- a/template/granite-instruct.gotmpl
+++ b/template/granite-instruct.gotmpl
@@ -10,9 +10,8 @@
{{ .Content }}
{{ end }}Answer:
-{{ else }}
-{{ if .System }}
-System:
+{{ else -}}
+{{ if .System }}System:
{{ .System }}
{{ end }}{{ if .Prompt }}Question:
@@ -20,4 +19,5 @@ System:
{{ end }}Answer:
{{ .Response }}
-{{- end }}
\ No newline at end of file
+
+{{ end -}}
\ No newline at end of file
diff --git a/template/llama2-chat.gotmpl b/template/llama2-chat.gotmpl
index 6327d5812..1816fefd8 100644
--- a/template/llama2-chat.gotmpl
+++ b/template/llama2-chat.gotmpl
@@ -9,8 +9,8 @@
{{- else }} [/INST] {{ .Content }}</s><s>
{{- end }}
{{- end }} [/INST]
-{{- else }}
-[INST] <<SYS>>{{ .System }}<</SYS>>
+{{- else -}}
+[INST] <<SYS>>{{ if .System }}{{ .System }}{{ end }}<</SYS>>
-{{ .Prompt }} [/INST] {{ .Response }}
-{{- end }}
\ No newline at end of file
+{{ .Prompt }} [/INST] {{ .Response }}</s>
+{{- end -}}
\ No newline at end of file
diff --git a/template/llama3-instruct.gotmpl b/template/llama3-instruct.gotmpl
index 9c81a9535..7947b8da5 100644
--- a/template/llama3-instruct.gotmpl
+++ b/template/llama3-instruct.gotmpl
@@ -8,7 +8,7 @@
{{ .Content }}<|eot_id|>
{{- end }}<|start_header_id|>assistant<|end_header_id|>
-{{ else }}
+{{ else -}}
{{ if .System }}<|start_header_id|>system<|end_header_id|>
{{ .System }}<|eot_id|>{{ end }}{{ if .Prompt }}<|start_header_id|>user<|end_header_id|>
@@ -16,4 +16,4 @@
{{ .Prompt }}<|eot_id|>{{ end }}<|start_header_id|>assistant<|end_header_id|>
{{ .Response }}<|eot_id|>
-{{- end }}
\ No newline at end of file
+{{- end -}}
\ No newline at end of file
diff --git a/template/magicoder.gotmpl b/template/magicoder.gotmpl
index 73a58127c..9227b6661 100644
--- a/template/magicoder.gotmpl
+++ b/template/magicoder.gotmpl
@@ -9,7 +9,7 @@
{{ .Content }}
{{ end }}@@ Response
-{{ else }}
+{{ else -}}
{{ if .System }}{{ .System }}
{{ end }}{{ if .Prompt }}@@ Instruction
@@ -17,4 +17,5 @@
{{ end }}@@ Response
{{ .Response }}
-{{- end }}
\ No newline at end of file
+
+{{ end -}}
\ No newline at end of file
diff --git a/template/mistral-instruct.gotmpl b/template/mistral-instruct.gotmpl
index eb3d5ced2..1d746dfd2 100644
--- a/template/mistral-instruct.gotmpl
+++ b/template/mistral-instruct.gotmpl
@@ -5,5 +5,6 @@
{{- else if eq .Role "assistant" }}[/INST] {{ .Content }}</s>
{{- end }}
{{- end }}[/INST]
-{{- else }}[INST] {{ if .System }}{{ .System }} {{ end }}{{ .Prompt }} [/INST] {{ .Response }}
-{{- end }}
\ No newline at end of file
+{{- else -}}
+[INST] {{ if .System }}{{ .System }} {{ end }}{{ .Prompt }}[/INST] {{ .Response }}</s>
+{{- end -}}
\ No newline at end of file
diff --git a/template/openchat.gotmpl b/template/openchat.gotmpl
index d5e1cbb0d..649f0509c 100644
--- a/template/openchat.gotmpl
+++ b/template/openchat.gotmpl
@@ -1,11 +1,11 @@
{{- if .Messages }}
-{{- if .System }}GPT Correct System: {{ .System }}<|end_of_turn|>
+{{- if .System }}GPT4 Correct System: {{ .System }}<|end_of_turn|>
{{- end }}
-{{- range .Messages }}GPT Correct
+{{- range .Messages }}GPT4 Correct
{{- if eq .Role "user" }} User:
{{- else if eq .Role "assistant" }} Assistant:
{{- end }} {{ .Content }}<|end_of_turn|>
-{{- end }}GPT Correct Assistant:
-{{- else }}
-{{ .System }}<|end_of_turn|>GPT4 Correct User: {{ .Prompt }}<|end_of_turn|>GPT4 Correct Assistant: {{ .Response }}<|end_of_turn|>
-{{- end }}
\ No newline at end of file
+{{- end }}GPT4 Correct Assistant:
+{{- else -}}
+{{ if .System }}GPT4 Correct System: {{ .System }}<|end_of_turn|>{{ end }}GPT4 Correct User: {{ .Prompt }}<|end_of_turn|>GPT4 Correct Assistant: {{ .Response }}<|end_of_turn|>
+{{- end -}}
\ No newline at end of file
diff --git a/template/phi-3.gotmpl b/template/phi-3.gotmpl
index a3558d2b7..4ca56e952 100644
--- a/template/phi-3.gotmpl
+++ b/template/phi-3.gotmpl
@@ -5,11 +5,11 @@
{{- range .Messages }}<|{{ .Role }}|>
{{ .Content }}<|end|>
{{ end }}<|assistant|>
-{{ else }}
+{{ else -}}
{{ if .System }}<|system|>
{{ .System }}<|end|>
{{ end }}{{ if .Prompt }}<|user|>
{{ .Prompt }}<|end|>
{{ end }}<|assistant|>
{{ .Response }}<|end|>
-{{- end }}
\ No newline at end of file
+{{ end -}}
\ No newline at end of file
diff --git a/template/solar-instruct.gotmpl b/template/solar-instruct.gotmpl
index caa6e8e77..8a8331ca4 100644
--- a/template/solar-instruct.gotmpl
+++ b/template/solar-instruct.gotmpl
@@ -10,7 +10,7 @@
{{ .Content }}</s>
{{ end }}
{{ end }}### Assistant:
-{{ else }}
+{{ else -}}
{{ if .System }}### System:
{{ .System }}
@@ -18,5 +18,6 @@
{{ .Prompt }}
{{ end }}### Assistant:
-{{ .Response }}
-{{- end }}
\ No newline at end of file
+{{ .Response }}</s>
+
+{{ end -}}
\ No newline at end of file
diff --git a/template/starcoder2-instruct.gotmpl b/template/starcoder2-instruct.gotmpl
index 7d7ff9326..17c6ad755 100644
--- a/template/starcoder2-instruct.gotmpl
+++ b/template/starcoder2-instruct.gotmpl
@@ -11,14 +11,13 @@
{{ end }}
{{- end }}### Response
-{{ else }}
+{{ else -}}
{{ if .System }}{{ .System }}
{{ end }}{{ if .Prompt }}### Instruction
{{ .Prompt }}
-
{{ end }}### Response
{{ .Response }}<|endoftext|>
-{{- end }}
\ No newline at end of file
+{{ end -}}
\ No newline at end of file
diff --git a/template/testdata/alpaca.gotmpl/system-user-assistant-user b/template/testdata/alpaca.gotmpl/system-user-assistant-user
index 20182d829..4caa81788 100644
--- a/template/testdata/alpaca.gotmpl/system-user-assistant-user
+++ b/template/testdata/alpaca.gotmpl/system-user-assistant-user
@@ -1,4 +1,6 @@
-You are a helpful assistant.### Instruction:
+You are a helpful assistant.
+
+### Instruction:
Hello, how are you?
### Response:
diff --git a/template/testdata/codellama-70b-instruct.gotmpl/system-user-assistant-user b/template/testdata/codellama-70b-instruct.gotmpl/system-user-assistant-user
index fdd0fc8b4..d7528f80c 100644
--- a/template/testdata/codellama-70b-instruct.gotmpl/system-user-assistant-user
+++ b/template/testdata/codellama-70b-instruct.gotmpl/system-user-assistant-user
@@ -9,3 +9,4 @@ Source: system
I'd like to show off how chat templating works! <step> Source: assistant
Destination: user
+
\ No newline at end of file
diff --git a/template/testdata/codellama-70b-instruct.gotmpl/user b/template/testdata/codellama-70b-instruct.gotmpl/user
index 9e7174a84..8e07853ca 100644
--- a/template/testdata/codellama-70b-instruct.gotmpl/user
+++ b/template/testdata/codellama-70b-instruct.gotmpl/user
@@ -3,3 +3,4 @@ Source: user
Hello, how are you? <step> Source: assistant
Destination: user
+
\ No newline at end of file
diff --git a/template/testdata/codellama-70b-instruct.gotmpl/user-assistant-user b/template/testdata/codellama-70b-instruct.gotmpl/user-assistant-user
index b4ba1736b..f732cc746 100644
--- a/template/testdata/codellama-70b-instruct.gotmpl/user-assistant-user
+++ b/template/testdata/codellama-70b-instruct.gotmpl/user-assistant-user
@@ -7,3 +7,4 @@ Source: user
I'd like to show off how chat templating works! <step> Source: assistant
Destination: user
+
\ No newline at end of file
diff --git a/template/testdata/openchat.gotmpl/system-user-assistant-user b/template/testdata/openchat.gotmpl/system-user-assistant-user
index 1214c1264..404b071aa 100644
--- a/template/testdata/openchat.gotmpl/system-user-assistant-user
+++ b/template/testdata/openchat.gotmpl/system-user-assistant-user
@@ -1 +1 @@
-GPT Correct System: You are a helpful assistant.<|end_of_turn|>GPT Correct User: Hello, how are you?<|end_of_turn|>GPT Correct Assistant: I'm doing great. How can I help you today?<|end_of_turn|>GPT Correct User: I'd like to show off how chat templating works!<|end_of_turn|>GPT Correct Assistant:
\ No newline at end of file
+GPT4 Correct System: You are a helpful assistant.<|end_of_turn|>GPT4 Correct User: Hello, how are you?<|end_of_turn|>GPT4 Correct Assistant: I'm doing great. How can I help you today?<|end_of_turn|>GPT4 Correct User: I'd like to show off how chat templating works!<|end_of_turn|>GPT4 Correct Assistant:
\ No newline at end of file
diff --git a/template/testdata/openchat.gotmpl/user b/template/testdata/openchat.gotmpl/user
index 611daa83e..48229cb0e 100644
--- a/template/testdata/openchat.gotmpl/user
+++ b/template/testdata/openchat.gotmpl/user
@@ -1 +1 @@
-GPT Correct User: Hello, how are you?<|end_of_turn|>GPT Correct Assistant:
\ No newline at end of file
+GPT4 Correct User: Hello, how are you?<|end_of_turn|>GPT4 Correct Assistant:
\ No newline at end of file
diff --git a/template/testdata/openchat.gotmpl/user-assistant-user b/template/testdata/openchat.gotmpl/user-assistant-user
index f97b02b9c..4719abb2d 100644
--- a/template/testdata/openchat.gotmpl/user-assistant-user
+++ b/template/testdata/openchat.gotmpl/user-assistant-user
@@ -1 +1 @@
-GPT Correct User: Hello, how are you?<|end_of_turn|>GPT Correct Assistant: I'm doing great. How can I help you today?<|end_of_turn|>GPT Correct User: I'd like to show off how chat templating works!<|end_of_turn|>GPT Correct Assistant:
\ No newline at end of file
+GPT4 Correct User: Hello, how are you?<|end_of_turn|>GPT4 Correct Assistant: I'm doing great. How can I help you today?<|end_of_turn|>GPT4 Correct User: I'd like to show off how chat templating works!<|end_of_turn|>GPT4 Correct Assistant:
\ No newline at end of file
diff --git a/template/vicuna.gotmpl b/template/vicuna.gotmpl
index 2e13e990d..01465b997 100644
--- a/template/vicuna.gotmpl
+++ b/template/vicuna.gotmpl
@@ -7,8 +7,9 @@
{{ else if eq .Role "assistant" }}ASSISTANT: {{ .Content }}</s>
{{ end }}
{{- end }}ASSISTANT:
-{{- else }}
+{{- else -}}
{{ if .System }}{{ .System }}
+
{{ end }}{{ if .Prompt }}USER: {{ .Prompt }}
-{{ end }}ASSISTANT: {{ .Response }}
-{{- end }}
\ No newline at end of file
+{{ end }}ASSISTANT: {{ .Response }}</s>
+{{ end -}}
\ No newline at end of file
diff --git a/template/zephyr.gotmpl b/template/zephyr.gotmpl
index e66688480..3ca1d1a1c 100644
--- a/template/zephyr.gotmpl
+++ b/template/zephyr.gotmpl
@@ -5,11 +5,11 @@
{{- range .Messages }}<|{{ .Role }}|>
{{ .Content }}</s>
{{ end }}<|assistant|>
-{{ else }}
+{{ else -}}
{{ if .System }}<|system|>
{{ .System }}</s>
{{ end }}{{ if .Prompt }}<|user|>
{{ .Prompt }}</s>
{{ end }}<|assistant|>
{{ .Response }}</s>
-{{- end }}
\ No newline at end of file
+{{ end -}}
\ No newline at end of file