modprompt 0.9.3 → 0.9.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +33 -54
- package/dist/main.min.js +1 -1
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// Autogenerated code: do not edit
|
|
1
2
|
const templates = {
|
|
2
3
|
"alpaca": {
|
|
3
4
|
"assistant": "### Response:",
|
|
@@ -13,23 +14,6 @@ const templates = {
|
|
|
13
14
|
},
|
|
14
15
|
"user": "### Instruction:\n{prompt}"
|
|
15
16
|
},
|
|
16
|
-
"cerebrum": {
|
|
17
|
-
"assistant": "Ai:",
|
|
18
|
-
"id": "cerebrum",
|
|
19
|
-
"linebreaks": {
|
|
20
|
-
"user": 1
|
|
21
|
-
},
|
|
22
|
-
"name": "Cerebrum",
|
|
23
|
-
"prefix": "<s>",
|
|
24
|
-
"stop": [
|
|
25
|
-
"</s>"
|
|
26
|
-
],
|
|
27
|
-
"system": {
|
|
28
|
-
"message": "A chat between a user and a thinking artificial intelligence assistant. The assistant describes its thought process and gives helpful and detailed answers to the user's questions.",
|
|
29
|
-
"schema": "{system}"
|
|
30
|
-
},
|
|
31
|
-
"user": "User: {prompt}"
|
|
32
|
-
},
|
|
33
17
|
"chatml": {
|
|
34
18
|
"afterShot": " <|im_end|>\n",
|
|
35
19
|
"assistant": "<|im_start|>assistant",
|
|
@@ -106,7 +90,7 @@ const templates = {
|
|
|
106
90
|
"system": 2,
|
|
107
91
|
"user": 2
|
|
108
92
|
},
|
|
109
|
-
"name": "Deepseek
|
|
93
|
+
"name": "Deepseek 2",
|
|
110
94
|
"stop": [
|
|
111
95
|
"<|end▁of▁sentence|>",
|
|
112
96
|
"<|tool▁calls▁end|>"
|
|
@@ -116,6 +100,24 @@ const templates = {
|
|
|
116
100
|
},
|
|
117
101
|
"user": "User: {prompt}"
|
|
118
102
|
},
|
|
103
|
+
"deepseek3": {
|
|
104
|
+
"afterShot": "<|end▁of▁sentence|>",
|
|
105
|
+
"assistant": "<|Assistant|>",
|
|
106
|
+
"id": "deepseek3",
|
|
107
|
+
"linebreaks": {
|
|
108
|
+
"system": 2,
|
|
109
|
+
"user": 2
|
|
110
|
+
},
|
|
111
|
+
"name": "Deepseek 3",
|
|
112
|
+
"stop": [
|
|
113
|
+
"<|end▁of▁sentence|>",
|
|
114
|
+
"<|tool▁calls▁end|>"
|
|
115
|
+
],
|
|
116
|
+
"system": {
|
|
117
|
+
"schema": "<|begin▁of▁sentence|>{system}"
|
|
118
|
+
},
|
|
119
|
+
"user": "<|User|>{prompt}"
|
|
120
|
+
},
|
|
119
121
|
"gemma": {
|
|
120
122
|
"afterShot": "\n",
|
|
121
123
|
"assistant": "<end_of_turn>\n<start_of_turn>model",
|
|
@@ -126,15 +128,6 @@ const templates = {
|
|
|
126
128
|
],
|
|
127
129
|
"user": "<start_of_turn>user\n{prompt}"
|
|
128
130
|
},
|
|
129
|
-
"guanaco": {
|
|
130
|
-
"assistant": "### Assistant:",
|
|
131
|
-
"id": "guanaco",
|
|
132
|
-
"linebreaks": {
|
|
133
|
-
"user": 1
|
|
134
|
-
},
|
|
135
|
-
"name": "Guanaco",
|
|
136
|
-
"user": "### Human: {prompt}"
|
|
137
|
-
},
|
|
138
131
|
"human_response": {
|
|
139
132
|
"assistant": "### RESPONSE:",
|
|
140
133
|
"id": "human_response",
|
|
@@ -208,6 +201,19 @@ const templates = {
|
|
|
208
201
|
],
|
|
209
202
|
"user": "[INST] {prompt}"
|
|
210
203
|
},
|
|
204
|
+
"mistral-system": {
|
|
205
|
+
"afterShot": "\n",
|
|
206
|
+
"assistant": "[/INST]",
|
|
207
|
+
"id": "mistral-system",
|
|
208
|
+
"name": "Mistral system",
|
|
209
|
+
"stop": [
|
|
210
|
+
"</s>"
|
|
211
|
+
],
|
|
212
|
+
"system": {
|
|
213
|
+
"schema": "[SYSTEM_PROMPT]{system_prompt}[/SYSTEM_PROMPT]"
|
|
214
|
+
},
|
|
215
|
+
"user": "[INST]{prompt}"
|
|
216
|
+
},
|
|
211
217
|
"nemotron": {
|
|
212
218
|
"afterShot": "\n\n",
|
|
213
219
|
"assistant": "<extra_id_1>Assistant",
|
|
@@ -287,19 +293,6 @@ const templates = {
|
|
|
287
293
|
},
|
|
288
294
|
"user": "### User:\n{prompt}"
|
|
289
295
|
},
|
|
290
|
-
"phi": {
|
|
291
|
-
"assistant": "Output:",
|
|
292
|
-
"id": "phi",
|
|
293
|
-
"linebreaks": {
|
|
294
|
-
"user": 1
|
|
295
|
-
},
|
|
296
|
-
"name": "Phi",
|
|
297
|
-
"stop": [
|
|
298
|
-
"</s>",
|
|
299
|
-
"Instruct:"
|
|
300
|
-
],
|
|
301
|
-
"user": "Instruct: {prompt}"
|
|
302
|
-
},
|
|
303
296
|
"phi3": {
|
|
304
297
|
"afterShot": "<|end|>\n",
|
|
305
298
|
"assistant": "<|assistant|>",
|
|
@@ -328,20 +321,6 @@ const templates = {
|
|
|
328
321
|
},
|
|
329
322
|
"user": "<|im_start|>user<|im_sep|>{prompt}<|im_end|>"
|
|
330
323
|
},
|
|
331
|
-
"synthia-cot": {
|
|
332
|
-
"assistant": "ASSISTANT:",
|
|
333
|
-
"id": "synthia-cot",
|
|
334
|
-
"linebreaks": {
|
|
335
|
-
"system": 1,
|
|
336
|
-
"user": 1
|
|
337
|
-
},
|
|
338
|
-
"name": "Synthia CoT",
|
|
339
|
-
"system": {
|
|
340
|
-
"message": "Elaborate on the topic using a Tree of Thoughts and backtrack when necessary to construct a clear, cohesive Chain of Thought reasoning. Always answer without hesitation.",
|
|
341
|
-
"schema": "SYSTEM: {system}"
|
|
342
|
-
},
|
|
343
|
-
"user": "USER: {prompt}"
|
|
344
|
-
},
|
|
345
324
|
"vicuna": {
|
|
346
325
|
"assistant": "### ASSISTANT:",
|
|
347
326
|
"id": "vicuna",
|
package/dist/main.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var $tpl=function(s){"use strict";const e={alpaca:{assistant:"### Response:",id:"alpaca",linebreaks:{system:2,user:2},name:"Alpaca",system:{message:"Below is an instruction that describes a task. Write a response that appropriately completes the request.",schema:"{system}"},user:"### Instruction:\n{prompt}"},
|
|
1
|
+
var $tpl=function(s){"use strict";const e={alpaca:{assistant:"### Response:",id:"alpaca",linebreaks:{system:2,user:2},name:"Alpaca",system:{message:"Below is an instruction that describes a task. Write a response that appropriately completes the request.",schema:"{system}"},user:"### Instruction:\n{prompt}"},chatml:{afterShot:" <|im_end|>\n",assistant:"<|im_start|>assistant",id:"chatml",linebreaks:{assistant:1,system:1,user:1},name:"ChatMl",stop:["<|im_end|>"],system:{schema:"<|im_start|>system\n{system}<|im_end|>"},user:"<|im_start|>user\n{prompt}<|im_end|>"},codestral:{afterShot:"\n",assistant:" [/INST]",id:"codestral",linebreaks:{system:2},name:"Codestral",stop:["</s>"],system:{schema:"<<SYS>>\n{system}\n<</SYS>>"},user:"[INST] {prompt}"},"command-r":{assistant:"<|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>",id:"command-r",linebreaks:{user:1},name:"Command-R",prefix:"<BOS_TOKEN>",stop:["<|END_OF_TURN_TOKEN|>"],system:{schema:"<|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|>{system}<|END_OF_TURN_TOKEN|>"},user:"<|START_OF_TURN_TOKEN|><|USER_TOKEN|>{prompt}<|END_OF_TURN_TOKEN|>"},deepseek:{afterShot:"\n",assistant:"### Response:",id:"deepseek",linebreaks:{system:1,user:1},name:"Deepseek",stop:["<|EOT|>","### Instruction:"],system:{message:"You are an AI programming assistant, utilizing the DeepSeek Coder model, developed by DeepSeek Company, and you only answer questions related to computer science. For politically sensitive questions, security and privacy issues, and other non-computer science questions, you will refuse to answer.",schema:"{system}"},user:"### Instruction:\n{prompt}"},deepseek2:{assistant:"Assistant:",id:"deepseek2",linebreaks:{system:2,user:2},name:"Deepseek 2",stop:["<|end▁of▁sentence|>","<|tool▁calls▁end|>"],system:{schema:"<|begin▁of▁sentence|>{system}"},user:"User: {prompt}"},deepseek3:{afterShot:"<|end▁of▁sentence|>",assistant:"<|Assistant|>",id:"deepseek3",linebreaks:{system:2,user:2},name:"Deepseek 3",stop:["<|end▁of▁sentence|>","<|tool▁calls▁end|>"],system:{schema:"<|begin▁of▁sentence|>{system}"},user:"<|User|>{prompt}"},gemma:{afterShot:"\n",assistant:"<end_of_turn>\n<start_of_turn>model",id:"gemma",name:"Gemma",stop:["<end_of_turn>"],user:"<start_of_turn>user\n{prompt}"},human_response:{assistant:"### RESPONSE:",id:"human_response",linebreaks:{assistant:1,user:2},name:"Human response",user:"### HUMAN:\n{prompt}"},llama:{assistant:" [/INST] ",id:"llama",linebreaks:{system:2,user:0},name:"Llama",prefix:"<s>",stop:["</s>"],system:{message:"You are a helpful, respectful and honest assistant. Always answer as helpfully as possible\n\nIf a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information.",schema:"[INST] <<SYS>>\n{system}\n<</SYS>>"},user:"{prompt}"},llama3:{afterShot:"<|eot_id|>\n\n",assistant:"<|start_header_id|>assistant<|end_header_id|>",id:"llama3",name:"Llama 3",stop:["<|eot_id|>","<|end_of_text|>"],system:{schema:"<|start_header_id|>system<|end_header_id|>\n\n{system}<|eot_id|>"},user:"<|start_header_id|>user<|end_header_id|>\n\n{prompt}<|eot_id|>"},llava:{assistant:"ASSISTANT:",id:"llava",linebreaks:{user:1},name:"Llava",user:"USER: {prompt}"},minichat:{afterShot:"\n",assistant:"[|Assistant|]",id:"minichat",name:"Minichat",prefix:"<s> ",stop:["</s>","[|User|]"],user:"[|User|] {prompt} </s>"},mistral:{afterShot:"\n",assistant:" [/INST]",id:"mistral",name:"Mistral",stop:["</s>"],user:"[INST] {prompt}"},"mistral-system":{afterShot:"\n",assistant:"[/INST]",id:"mistral-system",name:"Mistral system",stop:["</s>"],system:{schema:"[SYSTEM_PROMPT]{system_prompt}[/SYSTEM_PROMPT]"},user:"[INST]{prompt}"},nemotron:{afterShot:"\n\n",assistant:"<extra_id_1>Assistant",id:"nemotron",linebreaks:{system:2,user:1},name:"Nemotron",system:{schema:"<extra_id_0>System\n{system}"},user:"<extra_id_1>User\n{prompt}"},none:{assistant:"",id:"none",name:"No template",user:"{prompt}"},octopus:{afterShot:"\n",assistant:"<|assistant|>",id:"octopus",name:"Octopus",stop:["<|end|>"],system:{message:"You are a router. Below is the query from the users, please call the correct function and generate the parameters to call the function.",schema:"<|system|>{system}<|end|>"},user:"<|user|>{prompt}<|end|>"},openchat:{assistant:"GPT4 Assistant:",id:"openchat",name:"OpenChat",stop:["<|end_of_turn|>"],user:"GPT4 User: {prompt}<|end_of_turn|>"},"openchat-correct":{assistant:"GPT4 Correct Assistant:",id:"openchat-correct",name:"OpenChat correct",stop:["<|end_of_turn|>"],user:"GPT4 Correct User: {prompt}<|end_of_turn|>"},opencodeinterpreter:{assistant:"<|Assistant|>",id:"opencodeinterpreter",linebreaks:{user:2},name:"Open code interpreter",stop:["<|EOT|>","<|User|>"],user:"<|User|>\n{prompt}"},orca:{assistant:"### Response:",id:"orca",linebreaks:{system:2,user:2},name:"Orca",system:{message:"You are an AI assistant that follows instruction extremely well. Help as much as you can.",schema:"### System:\n{system}"},user:"### User:\n{prompt}"},phi3:{afterShot:"<|end|>\n",assistant:"<|assistant|>",id:"phi3",name:"Phi 3",stop:["<|end|>","<|user|>"],system:{schema:"<|system|> {system}<|end|>"},user:"<|user|> {prompt}<|end|>"},phi4:{afterShot:"<|im_end|>\n",assistant:"<|im_start|>assistant<|im_sep|>",id:"phi4",name:"Phi 4",stop:["<|im_end|>","<|im_sep|>"],system:{schema:"<|im_start|>system<|im_sep|>{system}<|im_end|>"},user:"<|im_start|>user<|im_sep|>{prompt}<|im_end|>"},vicuna:{assistant:"### ASSISTANT:",id:"vicuna",linebreaks:{user:2},name:"Vicuna",user:"USER: {prompt}"},vicuna_system:{assistant:"### ASSISTANT:",id:"vicuna_system",linebreaks:{system:2,user:2},name:"Vicuna system",system:{schema:"SYSTEM: {system}"},user:"USER: {prompt}"},wizard_vicuna:{assistant:"### ASSISTANT:",id:"wizard_vicuna",linebreaks:{user:2},name:"Wizard Vicuna",stop:["<|endoftext|>"],user:"### Human:\n{prompt}"},wizardlm:{assistant:"ASSISTANT:",id:"wizardlm",linebreaks:{user:1},name:"WizardLM",system:{message:"You are a helpful AI assistant.",schema:"{system}"},user:"USER: {prompt}"},zephyr:{afterShot:"\n",assistant:"<|assistant|>",id:"zephyr",linebreaks:{assistant:1,system:1,user:1},name:"Zephyr",stop:["<|endoftext|>"],system:{schema:"<|system|>\n{system}<|endoftext|>"},user:"<|user|>\n{prompt}<|endoftext|>"}};class t{id;name;user;assistant;history=[];system;shots;stop;linebreaks;afterShot;prefix;_extraSystem="";_extraAssistant="";_replacePrompt="";_replaceSystem="";constructor(s){let e;e="string"==typeof s?this._load(s):s,this.id=e.id,this.name=e.name,this.user=e.user,this.assistant=e.assistant,this.system=e.system,this.shots=e.shots,this.stop=e.stop,this.linebreaks=e.linebreaks,this.afterShot=e.afterShot,this.prefix=e.prefix}cloneTo(s,e=!0){const a=new t(s);return e&&this?.shots&&this.shots.forEach((s=>{a.addShot(s.user,s.assistant)})),this._extraSystem.length>0&&a.afterSystem(this._extraSystem),this._replaceSystem.length>0&&a.replaceSystem(this._replaceSystem),this._extraAssistant.length>0&&a.afterAssistant(this._extraAssistant),this._replacePrompt.length>0&&a.replacePrompt(this._replacePrompt),a}toJson(){const s={id:this.id,name:this.name,user:this.user,assistant:this.assistant};return this?.prefix&&(s.prefix=this.prefix),this?.system&&(s.system=this.system),this?.shots&&(s.shots=this.shots),this?.afterShot&&(s.afterShot=this.afterShot),this?.stop&&(s.stop=this.stop),this?.linebreaks&&(s.linebreaks=this.linebreaks),s}replaceSystem(s){return this.system?(this._replaceSystem=s,this):this}afterSystem(s){return this.system?(this._extraSystem=s,this):this}afterAssistant(s){return this._extraAssistant=s,this}replacePrompt(s){return this._replacePrompt=s,this}addShot(s,e){this?.shots||(this.shots=[]);let t=e;return this.shots.push({user:s,assistant:t}),this}addShots(s){return s.forEach((s=>this.addShot(s.user,s.assistant))),this}renderShot(s){const e=[];e.push(this._buildUserBlock(s.user));let t=s.assistant;return this.afterShot&&(t+=this.afterShot),e.push(this._buildAssistantBlock(t)),e.join("")}render(s=!1){const e=new Array;this.prefix&&e.push(this.prefix);const t=this._buildSystemBlock(s);if(t.length>0&&(e.push(t),this?.linebreaks?.system&&e.push("\n".repeat(this.linebreaks.system))),this?.shots)for(const s of this.shots)e.push(this.renderShot(s));for(const s of this.history)e.push(this.renderShot(s));return e.push(this._buildUserBlock()),e.push(this._buildAssistantBlock()),e.join("")}prompt(s){return this.render().replace("{prompt}",s)}pushToHistory(s){return this.history.push(s),this}_buildSystemBlock(s){let e="";return this?.system?(this._replaceSystem&&(this.system.message=this._replaceSystem),this.system?.message?(e=this.system.schema.replace("{system}",this.system.message),this._extraSystem&&(e+=this._extraSystem)):s||(e=this.system.schema),e):""}_buildUserBlock(s){let e=[],t=this.user;return this._replacePrompt.length>0&&(t=t.replace("{prompt}",this._replacePrompt)),e.push(t),this?.linebreaks?.user&&e.push("\n".repeat(this.linebreaks.user)),s&&(e[0]=this.user.replace("{prompt}",s)),e.join("")}_buildAssistantBlock(s){let e=[],t=this.assistant;return this?.linebreaks?.assistant&&(t+="\n".repeat(this.linebreaks.assistant)),this._extraAssistant.length>0&&(t+=this._extraAssistant),e.push(t),s&&e.push(s),e.join("")}_load(s){try{if(s in e)return e[s];throw new Error(`Template ${s} not found`)}catch(e){throw new Error(`Error loading template ${s}: ${e}`)}}}return s.PromptTemplate=t,s.templates=e,s}({});
|