Get up and running with Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.
update templates to use messages
Michael Yang413ae39f3c94
diff --git a/server/routes_create_test.go b/server/routes_create_test.goindex 4de07b252..2f577eb4c 100644--- a/server/routes_create_test.go+++ b/server/routes_create_test.go@@ -593,9 +593,9 @@ func TestCreateDetectTemplate(t *testing.T) {checkFileExists(t, filepath.Join(p, "blobs", "*"), []string{filepath.Join(p, "blobs", "sha256-0d79f567714c62c048378f2107fb332dabee0135d080c302d884317da9433cc5"),+ filepath.Join(p, "blobs", "sha256-35360843d0c84fb1506952a131bbef13cd2bb4a541251f22535170c05b56e672"),filepath.Join(p, "blobs", "sha256-553c4a3f747b3d22a4946875f1cc8ed011c2930d83f864a0c7265f9ec0a20413"),- filepath.Join(p, "blobs", "sha256-c608dc615584cd20d9d830363dabf8a4783ae5d34245c3d8c115edb3bc7b28e4"),- filepath.Join(p, "blobs", "sha256-ea34c57ba5b78b740aafe2aeb74dc6507fc3ad14170b64c26a04fb9e36c88d75"),+ filepath.Join(p, "blobs", "sha256-de3959f841e9ef6b4b6255fa41cb9e0a45da89c3066aa72bdd07a4747f848990"),})})diff --git a/template/alfred.gotmpl b/template/alfred.gotmplindex cecb9d2c8..86dba48f2 100644--- a/template/alfred.gotmpl+++ b/template/alfred.gotmpl@@ -1 +1,2 @@-{{ if .System }}<start_system>{{ .System }}<end_message>{{ end }}{{ if .Prompt }}<start_user>{{ .Prompt }}<end_message>{{ end }}<start_assistant>{{ .Response }}<end_message>\ No newline at end of file+{{- range .Messages }}<start_{{ .Role }}>{{ .Content }}<end_message>+{{- end }}<start_assistant>\ No newline at end of filediff --git a/template/alpaca.gotmpl b/template/alpaca.gotmplindex ec7a8edcb..004397367 100644--- a/template/alpaca.gotmpl+++ b/template/alpaca.gotmpl@@ -1,8 +1,18 @@-{{ if .System }}{{ .System }}+{{- $system := "" }}+{{- range .Messages }}+{{- if eq .Role "system" }}+{{- if not $system }}{{ $system = .Content }}+{{- else }}{{ $system = printf "%s\n\n%s" $system .Content }}+{{- end }}+{{- else if eq .Role "user" }}+{{- if $system }}{{ $system }}-{{ end }}{{ if .Prompt }}### Instruction:-{{ .Prompt }}+{{ $system = "" }}+{{- end }}### Instruction:+{{ .Content }}-{{ end }}### Response:-{{ .Response }}+{{ else if eq .Role "assistant" }}### Response:+{{ .Content }}+{{ end }}+{{- end }}### Response:diff --git a/template/chatml.gotmpl b/template/chatml.gotmplindex fb672601a..43207ab14 100644--- a/template/chatml.gotmpl+++ b/template/chatml.gotmpl@@ -1,6 +1,3 @@-{{ if .System }}<|im_start|>system-{{ .System }}<|im_end|>-{{ end }}{{ if .Prompt }}<|im_start|>user-{{ .Prompt }}<|im_end|>+{{- range .Messages }}<|im_start|>{{ .Role }}+{{ .Content }}<|im_end|>{{ end }}<|im_start|>assistant-{{ .Response }}<|im_end|>diff --git a/template/chatqa.gotmpl b/template/chatqa.gotmplindex 91679a72d..0f91e0f01 100644--- a/template/chatqa.gotmpl+++ b/template/chatqa.gotmpl@@ -1,6 +1,7 @@-{{ if .System }}System: {{ .System }}--{{ end }}{{ if .Prompt }}User: {{ .Prompt }}--{{ end }}Assistant: {{ .Response }}+{{- range .Messages }}+{{- if eq .Role "system" }}System:+{{- else if eq .Role "user" }}User:+{{- else if eq .Role "assistant" }}Assistant:+{{- end }} {{ .Content }}+{{ end }}Assistant:\ No newline at end of filediff --git a/template/codellama-70b-instruct.gotmpl b/template/codellama-70b-instruct.gotmplindex e5856042c..189315205 100644--- a/template/codellama-70b-instruct.gotmpl+++ b/template/codellama-70b-instruct.gotmpl@@ -1,10 +1,10 @@-{{ if .System }}Source: system-- {{ .System }} <step> {{ end }}Source: user+{{- range .Messages }}Source:+{{- if eq .Role "system" }} system+{{- else if eq .Role "user" }} user+{{- else if eq .Role "assistant" }} assistant+{{- end }}- {{ .Prompt }} <step> Source: assistant-{{- if not .Response }}+ {{ .Content }} <step> {{ end }}Source: assistantDestination: user-{{- end }}- {{ .Response }} <step>\ No newline at end of file+\ No newline at end of filediff --git a/template/falcon-instruct.gotmpl b/template/falcon-instruct.gotmplindex 0a5fe48e8..b9b51d2c6 100644--- a/template/falcon-instruct.gotmpl+++ b/template/falcon-instruct.gotmpl@@ -1,5 +1,8 @@-{{ if .System }}System: {{ .System }}-{{ end }}{{ if .Prompt }}User:-{{ .Prompt }}+{{- range .Messages }}+{{- if eq .Role "system" }}System: {{ .Content }}+{{ continue }}+{{- else if eq .Role "user" }}User:+{{- else if eq .Role "assistant" }}Falcon:+{{- end }}+{{ .Content }}{{ end }}Falcon:-{{ .Response }}diff --git a/template/gemma-instruct.gotmpl b/template/gemma-instruct.gotmplindex 3c3a84256..cce257192 100644--- a/template/gemma-instruct.gotmpl+++ b/template/gemma-instruct.gotmpl@@ -1,5 +1,16 @@-<start_of_turn>user-{{ if .System }}{{ .System }}-{{ end }}{{ .Prompt }}<end_of_turn>-<start_of_turn>model-{{ .Response }}<end_of_turn>+{{- $system := "" }}+{{- range .Messages }}+{{- if eq .Role "system" }}+{{- if not $system }}{{ $system = .Content }}+{{- else }}{{ $system = printf "%s\n\n%s" $system .Content }}+{{- end }}+{{- continue }}+{{- else if eq .Role "user" }}<start_of_turn>user+{{- if $system }}+{{ $system }}+{{- $system = "" }}+{{- end }}+{{- else if eq .Role "assistant" }}<start_of_turn>model+{{- end }}+{{ .Content }}<end_of_turn>+{{ end }}<start_of_turn>modeldiff --git a/template/granite-instruct.gotmpl b/template/granite-instruct.gotmplindex 56690fce6..83634990e 100644--- a/template/granite-instruct.gotmpl+++ b/template/granite-instruct.gotmpl@@ -1,9 +1,8 @@-{{ if .System }}System:-{{ .System }}--{{ end }}{{ if .Prompt }}Question:-{{ .Prompt }}+{{- range .Messages }}+{{- if eq .Role "system" }}System:+{{- else if eq .Role "user" }}Question:+{{- else if eq .Role "assistant" }}Answer:+{{- end }}+{{ .Content }}{{ end }}Answer:-{{ .Response }}-diff --git a/template/llama2-chat.gotmpl b/template/llama2-chat.gotmplindex 013b414e2..5634a0720 100644--- a/template/llama2-chat.gotmpl+++ b/template/llama2-chat.gotmpl@@ -1,6 +1,14 @@-[INST] <<SYS>>-{{- if .System }}-{{ .System }}-{{ end }}<</SYS>>+{{- $system := "" }}[INST] {{ range .Messages }}+{{- if eq .Role "system" }}+{{- if not $system }}{{ $system = .Content }}+{{- else }}{{ $system = printf "%s\n\n%s" $system .Content }}+{{- end }}+{{- else if eq .Role "user" }}<<SYS>>+{{- if $system }}+{{ $system }}+{{ $system = "" }}+{{- end }}<</SYS>>-{{ .Prompt }} [/INST] {{ .Response }}</s><s>\ No newline at end of file+{{ .Content }} [/INST]+{{- else if eq .Role "assistant" }} {{ .Content }}</s><s>[INST] {{ end }}+{{- end }}\ No newline at end of filediff --git a/template/llama3-instruct.gotmpl b/template/llama3-instruct.gotmplindex 36d0218b6..305ae403b 100644--- a/template/llama3-instruct.gotmpl+++ b/template/llama3-instruct.gotmpl@@ -1,7 +1,5 @@-{{ if .System }}<|start_header_id|>system<|end_header_id|>+{{- range .Messages }}<|start_header_id|>{{ .Role }}<|end_header_id|>-{{ .System }}<|eot_id|>{{ end }}{{ if .Prompt }}<|start_header_id|>user<|end_header_id|>+{{ .Content }}<|eot_id|>+{{- end }}<|start_header_id|>assistant<|end_header_id|>-{{ .Prompt }}<|eot_id|>{{ end }}<|start_header_id|>assistant<|end_header_id|>--{{ .Response }}<|eot_id|>\ No newline at end of filediff --git a/template/magicoder.gotmpl b/template/magicoder.gotmplindex 52abc01aa..e5ee0e470 100644--- a/template/magicoder.gotmpl+++ b/template/magicoder.gotmpl@@ -1,8 +1,17 @@-{{ if .System }}{{ .System }}+{{- $system := "" }}+{{- range .Messages }}+{{- if eq .Role "system" }}+{{- if not $system }}{{ $system = .Content }}+{{- else }}{{ $system = printf "%s\n\n%s" $system .Content }}+{{- end }}+{{- continue }}+{{- else if eq .Role "user" }}+{{- if $system }}{{ $system }}-{{ end }}{{ if .Prompt }}@@ Instruction-{{ .Prompt }}+{{ $system = "" }}+{{- end }}@@ Instruction+{{- else if eq .Role "assistant" }}@@ Response+{{- end }}+{{ .Content }}{{ end }}@@ Response-{{ .Response }}-diff --git a/template/mistral-instruct.gotmpl b/template/mistral-instruct.gotmplindex e489bd4c5..7a6ecdfd8 100644--- a/template/mistral-instruct.gotmpl+++ b/template/mistral-instruct.gotmpl@@ -1,3 +1,6 @@-[INST] {{ if .System }}{{ .System }}+[INST] {{ range $index, $_ := .Messages }}+{{- if eq .Role "system" }}{{ .Content }}-{{ end }}{{ .Prompt }}[/INST] {{ .Response }}</s>\ No newline at end of file+{{ else if eq .Role "user" }}{{ .Content }}[/INST]+{{- else if eq .Role "assistant" }} {{ .Content }}</s>[INST] {{ end }}+{{- end }}\ No newline at end of filediff --git a/template/openchat.gotmpl b/template/openchat.gotmplindex 9c1838343..66a4d687b 100644--- a/template/openchat.gotmpl+++ b/template/openchat.gotmpl@@ -1 +1,6 @@-{{ if .System }}GPT4 Correct System: {{ .System }}<|end_of_turn|>{{ end }}GPT4 Correct User: {{ .Prompt }}<|end_of_turn|>GPT4 Correct Assistant: {{ .Response }}<|end_of_turn|>\ No newline at end of file+{{- range .Messages }}GPT4 Correct+{{- if eq .Role "system" }} System:+{{- else if eq .Role "user" }} User:+{{- else if eq .Role "assistant" }} Assistant:+{{- end }} {{ .Content }}<|end_of_turn|>+{{- end }}GPT4 Correct Assistant:\ No newline at end of filediff --git a/template/phi-3.gotmpl b/template/phi-3.gotmplindex 6c3610dda..abec2137d 100644--- a/template/phi-3.gotmpl+++ b/template/phi-3.gotmpl@@ -1,6 +1,3 @@-{{ if .System }}<|system|>-{{ .System }}<|end|>-{{ end }}{{ if .Prompt }}<|user|>-{{ .Prompt }}<|end|>+{{- range .Messages }}<|{{ .Role }}|>+{{ .Content }}<|end|>{{ end }}<|assistant|>-{{ .Response }}<|end|>diff --git a/template/solar-instruct.gotmpl b/template/solar-instruct.gotmplindex 1c14960d4..263bde804 100644--- a/template/solar-instruct.gotmpl+++ b/template/solar-instruct.gotmpl@@ -1,9 +1,11 @@-{{ if .System }}### System:-{{ .System }}+{{- range .Messages }}+{{- if eq .Role "system" }}### System:+{{- else if eq .Role "user" }}### User:+{{- else if eq .Role "assistant" }}### Assistant:+{{ .Content }}</s>-{{ end }}{{ if .Prompt }}### User:-{{ .Prompt }}+{{ continue }}+{{- end }}+{{ .Content }}{{ end }}### Assistant:-{{ .Response }}</s>-diff --git a/template/starcoder2-instruct.gotmpl b/template/starcoder2-instruct.gotmplindex 6c93a7abc..7963b4f9a 100644--- a/template/starcoder2-instruct.gotmpl+++ b/template/starcoder2-instruct.gotmpl@@ -1,8 +1,18 @@-{{ if .System }}{{ .System }}+{{- $system := "" }}+{{- range .Messages }}+{{- if eq .Role "system" }}+{{- if not $system }}{{ $system = .Content }}+{{- else }}{{ $system = printf "%s\n\n%s" $system .Content }}+{{- end }}+{{- else if eq .Role "user" }}+{{- if $system }}{{ $system }}-{{ end }}{{ if .Prompt }}### Instruction-{{ .Prompt }}+{{ $system = "" }}+{{- end }}### Instruction+{{ .Content }}-{{ end }}### Response-{{ .Response }}<|endoftext|>+{{ else if eq .Role "assistant" }}### Response+{{ .Content }}<|endoftext|>+{{ end }}+{{- end }}### Responsediff --git a/template/vicuna.gotmpl b/template/vicuna.gotmplindex 515b2fe94..c27f39c52 100644--- a/template/vicuna.gotmpl+++ b/template/vicuna.gotmpl@@ -1,4 +1,14 @@-{{ if .System }}{{ .System }}+{{- $system := "" }}+{{- range .Messages }}+{{- if eq .Role "system" }}+{{- if not $system }}{{ $system = .Content }}+{{- else }}{{ $system = printf "%s\n\n%s" $system .Content }}+{{- end }}+{{- else if eq .Role "user" }}+{{- if $system }}{{ $system }}-{{ end }}{{ if .Prompt }}USER: {{ .Prompt }}-{{ end }}ASSISTANT: {{ .Response }}</s>+{{ $system = "" }}+{{- end }}USER: {{ .Content }}+{{ else if eq .Role "assistant" }}ASSISTANT: {{ .Content }}</s>+{{ end }}+{{- end }}ASSISTANT:\ No newline at end of filediff --git a/template/zephyr.gotmpl b/template/zephyr.gotmplindex 1f889f267..25da148a0 100644--- a/template/zephyr.gotmpl+++ b/template/zephyr.gotmpl@@ -1,6 +1,3 @@-{{ if .System }}<|system|>-{{ .System }}</s>-{{ end }}{{ if .Prompt }}<|user|>-{{ .Prompt }}</s>+{{- range .Messages }}<|{{ .Role }}|>+{{ .Content }}</s>{{ end }}<|assistant|>-{{ .Response }}</s>