kovsbo commited on
Commit
5338d6d
·
verified ·
1 Parent(s): 732397b

Delete openpipe_dual_chat_template.jinja

Browse files
Files changed (1) hide show
  1. openpipe_dual_chat_template.jinja +0 -167
openpipe_dual_chat_template.jinja DELETED
@@ -1,167 +0,0 @@
1
- {{- bos_token }}
2
- {%- set template_variant = template_variant | default("official") %}
3
-
4
- {%- if template_variant == "llama31instruct" %}
5
- {%- if not tools is defined %}
6
- {%- set tools = none %}
7
- {%- endif %}
8
- {%- if messages[0]['role'] in ['system', 'developer'] %}
9
- {%- set system_message = messages[0]['content']|trim %}
10
- {%- set messages = messages[1:] %}
11
- {%- else %}
12
- {%- set system_message = "" %}
13
- {%- endif %}
14
- {{- "<|start_header_id|>system<|end_header_id|>\n\n" }}
15
- {%- if tools is not none and tools|length > 0 %}
16
- {{- "Environment: ipython\n" }}
17
- {{- "You have access to the following functions. To call a function, please respond with JSON for a function call." }}
18
- {{- 'Respond in the format {"name": function name, "parameters": dictionary of argument name and its value}.' }}
19
- {{- "Do not use variables.\n\n" }}
20
- {%- for t in tools %}
21
- {{- t | tojson }}
22
- {{- "\n\n" }}
23
- {%- endfor %}
24
- {%- endif %}
25
- {{- system_message }}
26
- {{- "<|eot_id|>" }}
27
- {%- for message in messages %}
28
- {%- if not (message.role == 'tool' or 'tool_calls' in message) %}
29
- {{- '<|start_header_id|>' + message['role'] + '<|end_header_id|>\n\n' + message['content'] | trim + '<|eot_id|>' }}
30
- {%- elif 'tool_calls' in message %}
31
- {{- '<|start_header_id|>assistant<|end_header_id|>\n\n' -}}
32
- {%- for tool_call in message.tool_calls -%}
33
- {{- '<|start_tool_call|>' }}
34
- {{- '{"name": "' + tool_call.function.name + '", ' }}
35
- {{- '"parameters": ' }}
36
- {{- tool_call.function.arguments | tojson }}
37
- {{- "}" }}
38
- {{- '<|end_tool_call|>' }}
39
- {%- if not loop.last %}, {% endif %}
40
- {%- endfor -%}
41
- {{- "<|eot_id|>" }}
42
- {%- elif message.role == "tool" %}
43
- {{- "<|start_header_id|>ipython<|end_header_id|>\n\n" }}
44
- {%- if message.content is mapping or message.content is iterable %}
45
- {{- message.content | tojson }}
46
- {%- else %}
47
- {{- message.content }}
48
- {%- endif %}
49
- {{- "<|eot_id|>" }}
50
- {%- endif %}
51
- {%- endfor %}
52
- {%- if add_generation_prompt %}
53
- {{- '<|start_header_id|>assistant<|end_header_id|>\n\n' }}
54
- {%- endif %}
55
- {%- elif template_variant == "pipeline3" %}
56
- {%- if not tools is defined %}
57
- {%- set tools = none %}
58
- {%- endif %}
59
- {%- set functions = tools | map(attribute="function") | map(attribute="name") | list if tools is not none else none %}
60
- {{- "### Instruction:\n" }}
61
- {%- if functions is not none %}
62
- {{- {"messages": messages, "functions": functions} | tojson }}
63
- {%- else %}
64
- {{- {"messages": messages} | tojson }}
65
- {%- endif %}
66
- {{- "\n\n### Response:\n" }}
67
- {%- else %}
68
- {%- if custom_tools is defined %}
69
- {%- set tools = custom_tools %}
70
- {%- endif %}
71
- {%- if not tools_in_user_message is defined %}
72
- {%- set tools_in_user_message = true %}
73
- {%- endif %}
74
- {%- if not date_string is defined %}
75
- {%- set date_string = "26 Jul 2024" %}
76
- {%- endif %}
77
- {%- if not tools is defined %}
78
- {%- set tools = none %}
79
- {%- endif %}
80
- {%- if messages[0]['role'] == 'system' %}
81
- {%- set system_message = messages[0]['content']|trim %}
82
- {%- set messages = messages[1:] %}
83
- {%- else %}
84
- {%- set system_message = "" %}
85
- {%- endif %}
86
- {{- "<|start_header_id|>system<|end_header_id|>\n\n" }}
87
- {%- if builtin_tools is defined or tools is not none %}
88
- {{- "Environment: ipython\n" }}
89
- {%- endif %}
90
- {%- if builtin_tools is defined %}
91
- {{- "Tools: " + builtin_tools | reject('equalto', 'code_interpreter') | join(", ") + "\n\n" }}
92
- {%- endif %}
93
- {{- "Cutting Knowledge Date: December 2023\n" }}
94
- {{- "Today Date: " + date_string + "\n\n" }}
95
- {%- if tools is not none and not tools_in_user_message %}
96
- {{- "You have access to the following functions. To call a function, please respond with JSON for a function call." }}
97
- {{- 'Respond in the format {"name": function name, "parameters": dictionary of argument name and its value}.' }}
98
- {{- "Do not use variables.\n\n" }}
99
- {%- for t in tools %}
100
- {{- t | tojson(indent=4) }}
101
- {{- "\n\n" }}
102
- {%- endfor %}
103
- {%- endif %}
104
- {{- system_message }}
105
- {{- "<|eot_id|>" }}
106
- {%- if tools_in_user_message and not tools is none %}
107
- {%- if messages | length != 0 %}
108
- {%- set first_user_message = messages[0]['content']|trim %}
109
- {%- set messages = messages[1:] %}
110
- {%- else %}
111
- {{- raise_exception("Cannot put tools in the first user message when there's no first user message!") }}
112
- {%- endif %}
113
- {{- '<|start_header_id|>user<|end_header_id|>\n\n' -}}
114
- {{- "Given the following functions, please respond with a JSON for a function call " }}
115
- {{- "with its proper arguments that best answers the given prompt.\n\n" }}
116
- {{- 'Respond in the format {"name": function name, "parameters": dictionary of argument name and its value}.' }}
117
- {{- "Do not use variables.\n\n" }}
118
- {%- for t in tools %}
119
- {{- t | tojson(indent=4) }}
120
- {{- "\n\n" }}
121
- {%- endfor %}
122
- {{- first_user_message + "<|eot_id|>" }}
123
- {%- endif %}
124
- {%- for message in messages %}
125
- {%- if not (message.role == 'ipython' or message.role == 'tool' or 'tool_calls' in message) %}
126
- {{- '<|start_header_id|>' + message['role'] + '<|end_header_id|>\n\n' + message['content'] | trim + '<|eot_id|>' }}
127
- {%- elif 'tool_calls' in message %}
128
- {%- if not message.tool_calls|length == 1 %}
129
- {{- raise_exception("This model only supports single tool-calls at once!") }}
130
- {%- endif %}
131
- {%- set tool_call = message.tool_calls[0].function %}
132
- {%- if builtin_tools is defined and tool_call.name in builtin_tools %}
133
- {{- '<|start_header_id|>assistant<|end_header_id|>\n\n' -}}
134
- {{- "<|python_tag|>" + tool_call.name + ".call(" }}
135
- {%- for arg_name, arg_val in tool_call.arguments | items %}
136
- {{- arg_name + '="' + arg_val + '"' }}
137
- {%- if not loop.last %}
138
- {{- ", " }}
139
- {%- endif %}
140
- {%- endfor %}
141
- {{- ")" }}
142
- {%- else %}
143
- {{- '<|start_header_id|>assistant<|end_header_id|>\n\n' -}}
144
- {{- '{"name": "' + tool_call.name + '", ' }}
145
- {{- '"parameters": ' }}
146
- {{- tool_call.arguments | tojson }}
147
- {{- "}" }}
148
- {%- endif %}
149
- {%- if builtin_tools is defined %}
150
- {{- "<|eom_id|>" }}
151
- {%- else %}
152
- {{- "<|eot_id|>" }}
153
- {%- endif %}
154
- {%- elif message.role == "tool" or message.role == "ipython" %}
155
- {{- "<|start_header_id|>ipython<|end_header_id|>\n\n" }}
156
- {%- if message.content is mapping or message.content is iterable %}
157
- {{- message.content | tojson }}
158
- {%- else %}
159
- {{- message.content }}
160
- {%- endif %}
161
- {{- "<|eot_id|>" }}
162
- {%- endif %}
163
- {%- endfor %}
164
- {%- if add_generation_prompt %}
165
- {{- '<|start_header_id|>assistant<|end_header_id|>\n\n' }}
166
- {%- endif %}
167
- {%- endif %}