1// extended list
  2export const promptFormats = {
  3  "alpaca": {
  4  template: `{{prompt}}\n\n{{history}}\n\n{{char}}:`,
  5
  6  historyTemplate: `### {{name}}:\n{{message}}`,
  7
  8  char: "Response",
  9  charMsgPrefix: "",
 10  charMsgSuffix: "",
 11
 12  user: "Instruction",
 13  userMsgPrefix: "",
 14  userMsgSuffix: "",
 15
 16  stops: ""
 17  },
 18
 19  // ----------------------------
 20
 21  "chatml": {
 22  template: `<|im_start|>system\n{{prompt}}<|im_end|>\n{{history}}{{char}}`,
 23
 24  historyTemplate: `<|im_start|>{{name}}\n{{message}}`,
 25
 26  char: "assistant",
 27  charMsgPrefix: "",
 28  charMsgSuffix: "",
 29
 30  user: "user",
 31  userMsgPrefix: "",
 32  userMsgSuffix: "<|im_end|>\n",
 33
 34  stops: ""
 35  },
 36
 37  // ----------------------------
 38
 39  "commandr": {
 40  template: `<BOS_TOKEN><|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|>{{prompt}}\n<|END_OF_TURN_TOKEN|>{{history}}{{char}}`,
 41
 42  historyTemplate: `<|START_OF_TURN_TOKEN|><|{{name}}|> {{message}}`,
 43
 44  char: "CHATBOT_TOKEN",
 45  charMsgPrefix: "",
 46  charMsgSuffix: "",
 47
 48  user: "USER_TOKEN",
 49  userMsgPrefix: "",
 50  userMsgSuffix: "<|END_OF_TURN_TOKEN|>",
 51
 52  stops: ""
 53  },
 54  // ref: https://docs.cohere.com/docs/prompting-command-r
 55
 56  // ----------------------------
 57
 58  "llama2": {
 59  template: `<s>[INST] <<SYS>>\n{{prompt}}\n<</SYS>>\n\nTest Message [/INST] Test Successfull </s>{{history}}{{char}}`,
 60
 61  historyTemplate: `{{name}}: {{message}}`,
 62
 63  char: "Assistant",
 64  charMsgPrefix: "",
 65  charMsgSuffix: "</s>",
 66
 67  user: "User",
 68  userMsgPrefix: "<s>[INST] ",
 69  userMsgSuffix: " [/INST]",
 70
 71  stops: ""
 72  },
 73  // ref: https://huggingface.co/blog/llama2#how-to-prompt-llama-2
 74
 75  // ----------------------------
 76
 77  "llama3": {
 78  template: `<|begin_of_text|><|start_header_id|>system<|end_header_id|>\n\n{{prompt}}{{history}}{{char}}`,
 79
 80  historyTemplate: `<|start_header_id|>{{name}}<|end_header_id|>\n\n{{message}}<|eot_id|>`,
 81
 82  char: "assistant",
 83  charMsgPrefix: "",
 84  charMsgSuffix: "",
 85
 86  user: "user",
 87  userMsgPrefix: "",
 88  userMsgSuffix: "",
 89
 90  stops: "<|eot_id|>"
 91  },
 92  // ref: https://llama.meta.com/docs/model-cards-and-prompt-formats/meta-llama-3/#special-tokens-used-with-meta-llama-3
 93
 94  // ----------------------------
 95
 96  "openchat": {
 97  template: `{{history}}{{char}}`,
 98
 99  historyTemplate: `GPT4 Correct {{name}}: {{message}}<|end_of_turn|>`,
100
101  char: "Assistant",
102  charMsgPrefix: "",
103  charMsgSuffix: "",
104
105  user: "User",
106  userMsgPrefix: "",
107  userMsgSuffix: "",
108
109  stops: ""
110  },
111
112  // ----------------------------
113
114  "phi3": {
115  template: `{{history}}{{char}}`,
116
117  historyTemplate: `<|{{name}}|>\n{{message}}<|end|>\n`,
118
119  char: "assistant",
120  charMsgPrefix: "",
121  charMsgSuffix: "",
122
123  user: "user",
124  userMsgPrefix: "",
125  userMsgSuffix: "",
126
127  stops: "<|end|>"
128  },
129  // ref: https://huggingface.co/microsoft/Phi-3-mini-4k-instruct#chat-format
130
131  // ----------------------------
132
133  "vicuna": {
134  template: `{{prompt}}\n{{history}}{{char}}`,
135
136  historyTemplate: `{{name}}: {{message}}\n`,
137
138  char: "ASSISTANT",
139  charMsgPrefix: "",
140  charMsgSuffix: "",
141
142  user: "USER",
143  userMsgPrefix: "",
144  userMsgSuffix: "",
145
146  stops: ""
147  },
148  // ref: https://huggingface.co/lmsys/vicuna-33b-v1.3/discussions/1
149
150  // ----------------------------
151
152  "deepseekCoder": {
153  template: `{{prompt}}{{history}}{{char}}:`,
154
155  historyTemplate: `### {{name}}:\n{{message}}`,
156
157  char: "Response",
158  charMsgPrefix: "",
159  charMsgSuffix: "",
160
161  user: "Instruction",
162  userMsgPrefix: "",
163  userMsgSuffix: "",
164
165  stops: "<|EOT|>"
166  },
167
168  // ----------------------------
169
170  "med42": {
171  template: `<|system|>: {{prompt}}\n{{history}}{{char}}`,
172
173  historyTemplate: `<|{{name}}|>: {{message}}\n`,
174
175  char: "assistant",
176  charMsgPrefix: "",
177  charMsgSuffix: "",
178
179  user: "prompter",
180  userMsgPrefix: "",
181  userMsgSuffix: "",
182
183  stops: ""
184  },
185
186  // ----------------------------
187
188  "neuralchat": {
189  template: `### System:\n{{prompt}}\n{{history}}{{char}}:`,
190
191  historyTemplate: `### {{name}}:\n{{message}}\n`,
192
193  char: "Assistant",
194  charMsgPrefix: "",
195  charMsgSuffix: "",
196
197  user: "User",
198  userMsgPrefix: "",
199  userMsgSuffix: "",
200
201  stops: ""
202  },
203
204  // ----------------------------
205
206  "nousHermes": {
207  template: `### Instruction: {{prompt}}\n\n{{history}}\n\n{{char}}:`,
208
209  historyTemplate: `### {{name}}:\n{{message}}`,
210
211  char: "Response",
212  charMsgPrefix: "",
213  charMsgSuffix: "",
214
215  user: "Input",
216  userMsgPrefix: "",
217  userMsgSuffix: "",
218
219  stops: ""
220  },
221
222  // ----------------------------
223
224  "openchatMath": {
225  template: `{{history}}{{char}}`,
226
227  historyTemplate: `Math Correct {{name}}: {{message}}<|end_of_turn|>`,
228
229  char: "Assistant",
230  charMsgPrefix: "",
231  charMsgSuffix: "",
232
233
234  user: "User",
235  userMsgPrefix: "",
236  userMsgSuffix: "",
237
238  stops: ""
239  },
240
241  // ----------------------------
242
243  "orion": {
244  template: `<s>Human: Test Message\n\nAssistant: </s>Test Successful</s>{{history}}{{char}}:`,
245
246  historyTemplate: `{{name}}: {{message}}`,
247
248  char: "Assistant </s>",
249  charMsgPrefix: "",
250  charMsgSuffix: "",
251
252  user: "Human",
253  userMsgPrefix: "",
254  userMsgSuffix: "\n\n",
255
256  stops: ""
257  },
258
259  // ----------------------------
260
261  "sauerkraut": {
262  template: `{{prompt}}\n{{history}}{{char}}`,
263
264  historyTemplate: `
265  {{name}}: {{message}}\n`,
266
267  char: "Assistant",
268  charMsgPrefix: "",
269  charMsgSuffix: "",
270
271  user: "User",
272  userMsgPrefix: "",
273  userMsgSuffix: "",
274
275  stops: ""
276  },
277
278  // ----------------------------
279
280  "starlingCode": {
281  template: `{{history}}{{char}}`,
282
283  historyTemplate: `Code {{name}}: {{message}}<|end_of_turn|>`,
284
285  char: "Assistant",
286  charMsgPrefix: "",
287  charMsgSuffix: "",
288
289  user: "User",
290  userMsgPrefix: "",
291  userMsgSuffix: "",
292
293  stops: ""
294  },
295
296  // ----------------------------
297
298  "yi34b": {
299  template: `{{history}} {{char}}`,
300
301  historyTemplate: `{{name}}: {{message}}`,
302
303  char: "Assistant",
304  charMsgPrefix: "",
305  charMsgSuffix: "",
306
307  user: "Human",
308  userMsgPrefix: "",
309  userMsgSuffix: "",
310
311  stops: ""
312  },
313
314  // ----------------------------
315
316  "zephyr": {
317  template: `<|system|>\n{{prompt}}</s>\n{{history}}{{char}}`,
318
319  historyTemplate: `<|{{name}}|>\n{{message}}</s>\n`,
320
321  char: "assistant",
322  charMsgPrefix: "",
323  charMsgSuffix: "",
324
325  user: "user",
326  userMsgPrefix: "",
327  userMsgSuffix: "",
328
329  stops: ""
330  }
331  };