-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(grammar): respect JSONmode and grammar from user input (#1935)
* fix(grammar): Fix JSON mode and custom grammar * tests(aio): add jsonmode test * tests(aio): add functioncall test * fix(aio): use hermes-2-pro-mistral as llm for CPU profile * add phi-2-orange
- Loading branch information
Showing
5 changed files
with
139 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,48 @@ | ||
name: gpt-4 | ||
mmap: true | ||
parameters: | ||
model: huggingface://l3utterfly/phi-2-layla-v1-chatml-gguf/phi-2-layla-v1-chatml-Q8_0.gguf | ||
model: huggingface://NousResearch/Hermes-2-Pro-Mistral-7B-GGUF/Hermes-2-Pro-Mistral-7B.Q2_K.gguf | ||
|
||
template: | ||
chat_message: | | ||
<|im_start|>{{if eq .RoleName "assistant"}}assistant{{else if eq .RoleName "system"}}system{{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 eq .RoleName "tool" }}<tool_result>{{end}} | ||
{{if .Content}}{{.Content}}{{end}} | ||
{{if .FunctionCall}}{{toJson .FunctionCall}}{{end}} | ||
{{ if .FunctionCall }}</tool_call>{{end}} | ||
{{ if eq .RoleName "tool" }}</tool_result>{{end}} | ||
<|im_end|> | ||
# https://huggingface.co/NousResearch/Hermes-2-Pro-Mistral-7B-GGUF#prompt-format-for-function-calling | ||
function: | | ||
<|im_start|>system | ||
You are a function calling AI model. You are provided with function signatures within <tools></tools> XML tags. You may call one or more functions to assist with the user query. Don't make assumptions about what values to plug into functions. Here are the available tools: | ||
<tools> | ||
{{range .Functions}} | ||
{'type': 'function', 'function': {'name': '{{.Name}}', 'description': '{{.Description}}', 'parameters': {{toJson .Parameters}} }} | ||
{{end}} | ||
</tools> | ||
Use the following pydantic model json schema for each tool call you will make: | ||
{'title': 'FunctionCall', 'type': 'object', 'properties': {'arguments': {'title': 'Arguments', 'type': 'object'}, 'name': {'title': 'Name', 'type': 'string'}}, 'required': ['arguments', 'name']} | ||
For each function call return a json object with function name and arguments within <tool_call></tool_call> XML tags as follows: | ||
<tool_call> | ||
{'arguments': <args-dict>, 'name': <function-name>} | ||
</tool_call><|im_end|> | ||
{{.Input}} | ||
<|im_start|>assistant | ||
<tool_call> | ||
chat: | | ||
{{.Input}} | ||
<|im_start|>assistant | ||
completion: | | ||
{{.Input}} | ||
context_size: 2048 | ||
context_size: 4096 | ||
f16: true | ||
stopwords: | ||
- <|im_end|> | ||
- <dummy32000> | ||
usage: | | ||
curl http://localhost:8080/v1/chat/completions -H "Content-Type: application/json" -d '{ | ||
"model": "phi-2-chat", | ||
"model": "gpt-4", | ||
"messages": [{"role": "user", "content": "How are you doing?", "temperature": 0.1}] | ||
}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: phi-2-chat | ||
mmap: true | ||
parameters: | ||
model: huggingface://l3utterfly/phi-2-orange-GGUF/phi-2-orange.Q6_K.gguf | ||
|
||
template: | ||
chat_message: | | ||
<|im_start|>{{if eq .RoleName "assistant"}}assistant{{else if eq .RoleName "system"}}system{{else if eq .RoleName "user"}}user{{end}} | ||
{{if .Content}}{{.Content}}{{end}} | ||
<|im_end|> | ||
chat: | | ||
{{.Input}} | ||
<|im_start|>assistant | ||
completion: | | ||
{{.Input}} | ||
context_size: 4096 | ||
f16: true | ||
stopwords: | ||
- <|im_end|> | ||
- <dummy32000> | ||
|
||
description: | | ||
This model is a chatbot that can be used for general conversation. | ||
[Model card](https://huggingface.co/TheBloke/phi-2-orange-GGUF) | ||
usage: | | ||
curl http://localhost:8080/v1/chat/completions -H "Content-Type: application/json" -d '{ | ||
"model": "phi-2-chat", | ||
"messages": [{"role": "user", "content": "How are you doing?", "temperature": 0.1}] | ||
}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters