fix(hermes-2-pro-mistral): correct dashes in template to suppress newlines (#1966)

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
Ettore Di Giacinto 2024-04-07 18:23:47 +02:00 committed by GitHub
parent 74492a81c7
commit f36d86ba6d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 48 additions and 36 deletions

View File

@ -6,12 +6,14 @@ parameters:
template: template:
chat_message: | chat_message: |
<|im_start|>{{if eq .RoleName "assistant"}}assistant{{else if eq .RoleName "system"}}system{{else if eq .RoleName "tool"}}tool{{else if eq .RoleName "user"}}user{{end}} <|im_start|>{{if eq .RoleName "assistant"}}assistant{{else if eq .RoleName "system"}}system{{else if eq .RoleName "tool"}}tool{{else if eq .RoleName "user"}}user{{end}}
{{ if .FunctionCall }}<tool_call>{{end}} {{- if .FunctionCall }}<tool_call>{{end}}
{{ if eq .RoleName "tool" }}<tool_result>{{end}} {{- if eq .RoleName "tool" }}<tool_result>{{end }}
{{if .Content}}{{.Content}}{{end}} {{- if .Content}}
{{if .FunctionCall}}{{toJson .FunctionCall}}{{end}} {{.Content}}
{{ if .FunctionCall }}</tool_call>{{end}} {{- end }}
{{ if eq .RoleName "tool" }}</tool_result>{{end}} {{- if .FunctionCall}}{{toJson .FunctionCall}}{{end }}
{{- if .FunctionCall }}</tool_call>{{end }}
{{- if eq .RoleName "tool" }}</tool_result>{{end }}
<|im_end|> <|im_end|>
# https://huggingface.co/NousResearch/Hermes-2-Pro-Mistral-7B-GGUF#prompt-format-for-function-calling # https://huggingface.co/NousResearch/Hermes-2-Pro-Mistral-7B-GGUF#prompt-format-for-function-calling
function: | function: |
@ -27,12 +29,13 @@ template:
For each function call return a json object with function name and arguments within <tool_call></tool_call> XML tags as follows: For each function call return a json object with function name and arguments within <tool_call></tool_call> XML tags as follows:
<tool_call> <tool_call>
{'arguments': <args-dict>, 'name': <function-name>} {'arguments': <args-dict>, 'name': <function-name>}
</tool_call><|im_end|> </tool_call>
{{.Input}} <|im_end|>
{{.Input -}}
<|im_start|>assistant <|im_start|>assistant
<tool_call> <tool_call>
chat: | chat: |
{{.Input}} {{.Input -}}
<|im_start|>assistant <|im_start|>assistant
completion: | completion: |
{{.Input}} {{.Input}}

View File

@ -6,12 +6,14 @@ parameters:
template: template:
chat_message: | chat_message: |
<|im_start|>{{if eq .RoleName "assistant"}}assistant{{else if eq .RoleName "system"}}system{{else if eq .RoleName "tool"}}tool{{else if eq .RoleName "user"}}user{{end}} <|im_start|>{{if eq .RoleName "assistant"}}assistant{{else if eq .RoleName "system"}}system{{else if eq .RoleName "tool"}}tool{{else if eq .RoleName "user"}}user{{end}}
{{ if .FunctionCall }}<tool_call>{{end}} {{- if .FunctionCall }}<tool_call>{{end}}
{{ if eq .RoleName "tool" }}<tool_result>{{end}} {{- if eq .RoleName "tool" }}<tool_result>{{end }}
{{if .Content}}{{.Content}}{{end}} {{- if .Content}}
{{if .FunctionCall}}{{toJson .FunctionCall}}{{end}} {{.Content}}
{{ if .FunctionCall }}</tool_call>{{end}} {{- end }}
{{ if eq .RoleName "tool" }}</tool_result>{{end}} {{- if .FunctionCall}}{{toJson .FunctionCall}}{{end }}
{{- if .FunctionCall }}</tool_call>{{end }}
{{- if eq .RoleName "tool" }}</tool_result>{{end }}
<|im_end|> <|im_end|>
# https://huggingface.co/NousResearch/Hermes-2-Pro-Mistral-7B-GGUF#prompt-format-for-function-calling # https://huggingface.co/NousResearch/Hermes-2-Pro-Mistral-7B-GGUF#prompt-format-for-function-calling
function: | function: |
@ -27,12 +29,13 @@ template:
For each function call return a json object with function name and arguments within <tool_call></tool_call> XML tags as follows: For each function call return a json object with function name and arguments within <tool_call></tool_call> XML tags as follows:
<tool_call> <tool_call>
{'arguments': <args-dict>, 'name': <function-name>} {'arguments': <args-dict>, 'name': <function-name>}
</tool_call><|im_end|> </tool_call>
{{.Input}} <|im_end|>
{{.Input -}}
<|im_start|>assistant <|im_start|>assistant
<tool_call> <tool_call>
chat: | chat: |
{{.Input}} {{.Input -}}
<|im_start|>assistant <|im_start|>assistant
completion: | completion: |
{{.Input}} {{.Input}}

View File

@ -7,12 +7,14 @@ parameters:
template: template:
chat_message: | chat_message: |
<|im_start|>{{if eq .RoleName "assistant"}}assistant{{else if eq .RoleName "system"}}system{{else if eq .RoleName "tool"}}tool{{else if eq .RoleName "user"}}user{{end}} <|im_start|>{{if eq .RoleName "assistant"}}assistant{{else if eq .RoleName "system"}}system{{else if eq .RoleName "tool"}}tool{{else if eq .RoleName "user"}}user{{end}}
{{ if .FunctionCall }}<tool_call>{{end}} {{- if .FunctionCall }}<tool_call>{{end}}
{{ if eq .RoleName "tool" }}<tool_result>{{end}} {{- if eq .RoleName "tool" }}<tool_result>{{end }}
{{if .Content}}{{.Content}}{{end}} {{- if .Content}}
{{if .FunctionCall}}{{toJson .FunctionCall}}{{end}} {{.Content}}
{{ if .FunctionCall }}</tool_call>{{end}} {{- end }}
{{ if eq .RoleName "tool" }}</tool_result>{{end}} {{- if .FunctionCall}}{{toJson .FunctionCall}}{{end }}
{{- if .FunctionCall }}</tool_call>{{end }}
{{- if eq .RoleName "tool" }}</tool_result>{{end }}
<|im_end|> <|im_end|>
# https://huggingface.co/NousResearch/Hermes-2-Pro-Mistral-7B-GGUF#prompt-format-for-function-calling # https://huggingface.co/NousResearch/Hermes-2-Pro-Mistral-7B-GGUF#prompt-format-for-function-calling
function: | function: |
@ -28,12 +30,13 @@ template:
For each function call return a json object with function name and arguments within <tool_call></tool_call> XML tags as follows: For each function call return a json object with function name and arguments within <tool_call></tool_call> XML tags as follows:
<tool_call> <tool_call>
{'arguments': <args-dict>, 'name': <function-name>} {'arguments': <args-dict>, 'name': <function-name>}
</tool_call><|im_end|> </tool_call>
{{.Input}} <|im_end|>
{{.Input -}}
<|im_start|>assistant <|im_start|>assistant
<tool_call> <tool_call>
chat: | chat: |
{{.Input}} {{.Input -}}
<|im_start|>assistant <|im_start|>assistant
completion: | completion: |
{{.Input}} {{.Input}}

View File

@ -6,12 +6,14 @@ parameters:
template: template:
chat_message: | chat_message: |
<|im_start|>{{if eq .RoleName "assistant"}}assistant{{else if eq .RoleName "system"}}system{{else if eq .RoleName "tool"}}tool{{else if eq .RoleName "user"}}user{{end}} <|im_start|>{{if eq .RoleName "assistant"}}assistant{{else if eq .RoleName "system"}}system{{else if eq .RoleName "tool"}}tool{{else if eq .RoleName "user"}}user{{end}}
{{ if .FunctionCall }}<tool_call>{{end}} {{- if .FunctionCall }}<tool_call>{{end}}
{{ if eq .RoleName "tool" }}<tool_result>{{end}} {{- if eq .RoleName "tool" }}<tool_result>{{end }}
{{if .Content}}{{.Content}}{{end}} {{- if .Content}}
{{if .FunctionCall}}{{toJson .FunctionCall}}{{end}} {{.Content}}
{{ if .FunctionCall }}</tool_call>{{end}} {{- end }}
{{ if eq .RoleName "tool" }}</tool_result>{{end}} {{- if .FunctionCall}}{{toJson .FunctionCall}}{{end }}
{{- if .FunctionCall }}</tool_call>{{end }}
{{- if eq .RoleName "tool" }}</tool_result>{{end }}
<|im_end|> <|im_end|>
# https://huggingface.co/NousResearch/Hermes-2-Pro-Mistral-7B-GGUF#prompt-format-for-function-calling # https://huggingface.co/NousResearch/Hermes-2-Pro-Mistral-7B-GGUF#prompt-format-for-function-calling
function: | function: |
@ -27,12 +29,13 @@ template:
For each function call return a json object with function name and arguments within <tool_call></tool_call> XML tags as follows: For each function call return a json object with function name and arguments within <tool_call></tool_call> XML tags as follows:
<tool_call> <tool_call>
{'arguments': <args-dict>, 'name': <function-name>} {'arguments': <args-dict>, 'name': <function-name>}
</tool_call><|im_end|> </tool_call>
{{.Input}} <|im_end|>
{{.Input -}}
<|im_start|>assistant <|im_start|>assistant
<tool_call> <tool_call>
chat: | chat: |
{{.Input}} {{.Input -}}
<|im_start|>assistant <|im_start|>assistant
completion: | completion: |
{{.Input}} {{.Input}}