Add chat_template.jinja and chat_template_original.jinja

#3
by dkalinow - opened
chat_template.jinja ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- if messages and messages[0]['role'] == 'system' %}
2
+ {%- set system_message = messages[0]['content']|trim %}
3
+ {%- set messages = messages[1:] %}
4
+ {%- else %}
5
+ {%- set system_message = "You are a helpful assistant." %}
6
+ {%- endif %}
7
+
8
+ {%- if messages %}
9
+ <|system|>
10
+ {{ system_message }}
11
+ {%- if tools %}
12
+ In addition to plain text responses, you can chose to call one or more of the provided functions.
13
+
14
+ Use the following rule to decide when to call a function:
15
+ * if the response can be generated from your internal knowledge (e.g., as in the case of queries like "What is the capital of Poland?"), do so
16
+ * if you need external information that can be obtained by calling one or more of the provided functions, generate a function calls
17
+ * if you receive the tool response, interpret the response and try to answer user's question or command
18
+
19
+ If you decide to call functions:
20
+ * prefix function calls with functools marker (no closing marker required)
21
+ * all function calls should be generated in a single JSON list formatted as functools[{"name": [function name], "arguments": [function arguments as JSON]}, ...]
22
+ * follow the provided JSON schema. Do not hallucinate arguments or values. Do to blindly copy values from the provided samples
23
+ * respect the argument type formatting. E.g., if the type if number and format is float, write value 7 as 7.0
24
+ * make sure you pick the right functions that match the user intent
25
+
26
+
27
+ {%- for t in tools %}
28
+ {{- t | tojson(indent=4) }}
29
+ {{- "\n\n" }}
30
+ {%- endfor %}
31
+ {%- endif %}<|end|>
32
+
33
+ {%- for message in messages %}
34
+ {%- if message.role != "system" %}
35
+ <|{{ message.role }}|>
36
+ {%- if message.content and message.role == "tools" %}
37
+ {"result": {{ message.content }}}
38
+ {%- elif message.content %}
39
+ {{ message.content }}
40
+ {%- elif message.tool_calls %}
41
+ {%- for call in message.tool_calls %}
42
+ {"name": "{{ call.function.name }}", "arguments": {{ call.function.arguments }}}
43
+ {%- if not loop.last %},{% endif %}
44
+ {%- endfor %}
45
+ {%- endif %}<|end|>
46
+ {%- endif %}
47
+ {%- endfor %}<|assistant|>
48
+
49
+ {%- else %}
50
+ {%- if system_message %}
51
+ <|system|>
52
+
53
+ {{ system_message }}<|end|>
54
+ {%- endif %}
55
+ {%- if prompt %}
56
+ <|user|>
57
+
58
+ {{ prompt }}<|end|>
59
+ {%- endif %}<|assistant|>
60
+
61
+ {%- endif %}
62
+ {{ response }}
63
+ {%- if response %}<|user|>{% endif %}
chat_template_original.jinja ADDED
@@ -0,0 +1 @@
 
 
1
+ {% for message in messages %}{% if message['role'] == 'system' and 'tools' in message and message['tools'] is not none %}{{ '<|' + message['role'] + '|>' + message['content'] + '<|tool|>' + message['tools'] + '<|/tool|>' + '<|end|>' }}{% else %}{{ '<|' + message['role'] + '|>' + message['content'] + '<|end|>' }}{% endif %}{% endfor %}{% if add_generation_prompt %}{{ '<|assistant|>' }}{% else %}{{ eos_token }}{% endif %}