2024-03-22 20:13:11 +00:00
|
|
|
name: gpt-4
|
2024-03-21 00:12:20 +00:00
|
|
|
mmap: true
|
|
|
|
parameters:
|
2024-05-02 22:41:45 +00:00
|
|
|
model: huggingface://NousResearch/Hermes-2-Pro-Llama-3-8B-GGUF/Hermes-2-Pro-Llama-3-8B-Q4_K_M.gguf
|
2024-05-23 17:16:08 +00:00
|
|
|
context_size: 8192
|
2024-03-21 00:12:20 +00:00
|
|
|
|
2024-05-21 22:14:16 +00:00
|
|
|
stopwords:
|
|
|
|
- "<|im_end|>"
|
|
|
|
- "<dummy32000>"
|
|
|
|
- "</tool_call>"
|
|
|
|
- "<|eot_id|>"
|
|
|
|
- "<|end_of_text|>"
|
|
|
|
|
|
|
|
function:
|
|
|
|
# disable injecting the "answer" tool
|
|
|
|
disable_no_action: true
|
|
|
|
|
|
|
|
grammar:
|
|
|
|
# This allows the grammar to also return messages
|
|
|
|
mixed_mode: true
|
|
|
|
# Suffix to add to the grammar
|
|
|
|
#prefix: '<tool_call>\n'
|
|
|
|
# Force parallel calls in the grammar
|
|
|
|
# parallel_calls: true
|
|
|
|
|
|
|
|
return_name_in_function_response: true
|
|
|
|
# Without grammar uncomment the lines below
|
|
|
|
# Warning: this is relying only on the capability of the
|
|
|
|
# LLM model to generate the correct function call.
|
|
|
|
json_regex_match:
|
|
|
|
- "(?s)<tool_call>(.*?)</tool_call>"
|
|
|
|
- "(?s)<tool_call>(.*?)"
|
|
|
|
replace_llm_results:
|
|
|
|
# Drop the scratchpad content from responses
|
|
|
|
- key: "(?s)<scratchpad>.*</scratchpad>"
|
|
|
|
value: ""
|
|
|
|
replace_function_results:
|
|
|
|
# Replace everything that is not JSON array or object
|
|
|
|
#
|
|
|
|
- key: '(?s)^[^{\[]*'
|
|
|
|
value: ""
|
|
|
|
- key: '(?s)[^}\]]*$'
|
|
|
|
value: ""
|
|
|
|
- key: "'([^']*?)'"
|
|
|
|
value: "_DQUOTE_${1}_DQUOTE_"
|
|
|
|
- key: '\\"'
|
|
|
|
value: "__TEMP_QUOTE__"
|
|
|
|
- key: "\'"
|
|
|
|
value: "'"
|
|
|
|
- key: "_DQUOTE_"
|
|
|
|
value: '"'
|
|
|
|
- key: "__TEMP_QUOTE__"
|
|
|
|
value: '"'
|
|
|
|
# Drop the scratchpad content from responses
|
|
|
|
- key: "(?s)<scratchpad>.*</scratchpad>"
|
|
|
|
value: ""
|
|
|
|
|
2024-03-21 00:12:20 +00:00
|
|
|
template:
|
2024-05-21 22:14:16 +00:00
|
|
|
chat: |
|
|
|
|
{{.Input -}}
|
|
|
|
<|im_start|>assistant
|
2024-03-22 20:13:11 +00:00
|
|
|
chat_message: |
|
2024-03-31 11:04:09 +00:00
|
|
|
<|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}}
|
2024-04-19 16:23:44 +00:00
|
|
|
{{- if .FunctionCall }}
|
|
|
|
<tool_call>
|
|
|
|
{{- else if eq .RoleName "tool" }}
|
|
|
|
<tool_response>
|
|
|
|
{{- end }}
|
2024-04-07 16:23:47 +00:00
|
|
|
{{- if .Content}}
|
2024-04-19 16:23:44 +00:00
|
|
|
{{.Content }}
|
|
|
|
{{- end }}
|
|
|
|
{{- if .FunctionCall}}
|
|
|
|
{{toJson .FunctionCall}}
|
|
|
|
{{- end }}
|
|
|
|
{{- if .FunctionCall }}
|
|
|
|
</tool_call>
|
|
|
|
{{- else if eq .RoleName "tool" }}
|
|
|
|
</tool_response>
|
2024-04-24 23:28:02 +00:00
|
|
|
{{- end }}<|im_end|>
|
2024-05-21 22:14:16 +00:00
|
|
|
completion: |
|
|
|
|
{{.Input}}
|
|
|
|
function: |-
|
2024-03-31 11:04:09 +00:00
|
|
|
<|im_start|>system
|
2024-05-21 22:14:16 +00:00
|
|
|
You are a function calling AI model.
|
|
|
|
Here are the available tools:
|
2024-03-31 11:04:09 +00:00
|
|
|
<tools>
|
|
|
|
{{range .Functions}}
|
|
|
|
{'type': 'function', 'function': {'name': '{{.Name}}', 'description': '{{.Description}}', 'parameters': {{toJson .Parameters}} }}
|
|
|
|
{{end}}
|
|
|
|
</tools>
|
2024-05-21 22:14:16 +00:00
|
|
|
You should call the tools provided to you sequentially
|
|
|
|
Please use <scratchpad> XML tags to record your reasoning and planning before you call the functions as follows:
|
|
|
|
<scratchpad>
|
|
|
|
{step-by-step reasoning and plan in bullet points}
|
|
|
|
</scratchpad>
|
|
|
|
For each function call return a json object with function name and arguments within <tool_call> XML tags as follows:
|
2024-03-31 11:04:09 +00:00
|
|
|
<tool_call>
|
2024-05-21 22:14:16 +00:00
|
|
|
{"arguments": <args-dict>, "name": <function-name>}
|
2024-04-24 23:28:02 +00:00
|
|
|
</tool_call><|im_end|>
|
2024-04-07 16:23:47 +00:00
|
|
|
{{.Input -}}
|
2024-03-31 11:04:09 +00:00
|
|
|
<|im_start|>assistant
|