mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Fixing Mistral Templates (#2883)
* Update Mistral.json * Rename Mistral.json to Mistral V1.json * Create Mistral V2 & V3.json * Create Mistral V3-Tekken.json * Update and rename Mistral.json to Mistral V1.json * Update Mistral V1.json * Update Mistral V2 & V3.json * Update Mistral V2 & V3.json * Update Mistral V3-Tekken.json * Update Mistral V1.json * Create Mistral V2 & V3.json * Create Mistral V3-Tekken.json * Update Mistral V1.json * Update Mistral V2 & V3.json * Update Mistral V3-Tekken.json * Update Mistral V1.json * Update Mistral V2 & V3.json * Update Mistral V3-Tekken.json * Update Mistral V1.json * Update Mistral V2 & V3.json * Update Mistral V1.json * Update Mistral V3-Tekken.json * Update Mistral V1.json * Update Mistral V2 & V3.json * Update Mistral V3-Tekken.json * Add to content index * Remove example separators * Simplify context fillers * Add a hack for proper V1 format with names * Readability --------- Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
This commit is contained in:
@@ -511,10 +511,6 @@
|
|||||||
"filename": "presets/context/Minimalist.json",
|
"filename": "presets/context/Minimalist.json",
|
||||||
"type": "context"
|
"type": "context"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"filename": "presets/context/Mistral.json",
|
|
||||||
"type": "context"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"filename": "presets/context/NovelAI.json",
|
"filename": "presets/context/NovelAI.json",
|
||||||
"type": "context"
|
"type": "context"
|
||||||
@@ -599,10 +595,6 @@
|
|||||||
"filename": "presets/instruct/Metharme.json",
|
"filename": "presets/instruct/Metharme.json",
|
||||||
"type": "instruct"
|
"type": "instruct"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"filename": "presets/instruct/Mistral.json",
|
|
||||||
"type": "instruct"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"filename": "presets/instruct/OpenOrca-OpenChat.json",
|
"filename": "presets/instruct/OpenOrca-OpenChat.json",
|
||||||
"type": "instruct"
|
"type": "instruct"
|
||||||
@@ -686,5 +678,29 @@
|
|||||||
{
|
{
|
||||||
"filename": "presets/instruct/Gemma 2.json",
|
"filename": "presets/instruct/Gemma 2.json",
|
||||||
"type": "instruct"
|
"type": "instruct"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "presets/instruct/Mistral V1.json",
|
||||||
|
"type": "instruct"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "presets/context/Mistral V1.json",
|
||||||
|
"type": "context"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "presets/instruct/Mistral V2 & V3.json",
|
||||||
|
"type": "instruct"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "presets/context/Mistral V2 & V3.json",
|
||||||
|
"type": "context"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "presets/instruct/Mistral V3-Tekken.json",
|
||||||
|
"type": "instruct"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "presets/context/Mistral V3-Tekken.json",
|
||||||
|
"type": "context"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
12
default/content/presets/context/Mistral V1.json
Normal file
12
default/content/presets/context/Mistral V1.json
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"story_string": " [INST] {{#if system}}{{system}}\n{{/if}}{{#if wiBefore}}{{wiBefore}}\n{{/if}}{{#if description}}{{description}}\n{{/if}}{{#if personality}}{{personality}}\n{{/if}}{{#if scenario}}{{scenario}}\n{{/if}}{{#if wiAfter}}{{wiAfter}}\n{{/if}}{{#if persona}}{{persona}}\n{{/if}}{{trim}} [/INST] Understood.</s>",
|
||||||
|
"example_separator": "",
|
||||||
|
"chat_start": "",
|
||||||
|
"use_stop_strings": false,
|
||||||
|
"allow_jailbreak": false,
|
||||||
|
"always_force_name2": true,
|
||||||
|
"trim_sentences": false,
|
||||||
|
"include_newline": false,
|
||||||
|
"single_line": false,
|
||||||
|
"name": "Mistral V1"
|
||||||
|
}
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"story_string": "[INST] {{#if system}}{{system}}\n{{/if}}{{#if wiBefore}}{{wiBefore}}\n{{/if}}{{#if description}}{{description}}\n{{/if}}{{#if personality}}{{char}}'s personality: {{personality}}\n{{/if}}{{#if scenario}}Scenario: {{scenario}}\n{{/if}}{{#if wiAfter}}{{wiAfter}}\n{{/if}}{{#if persona}}{{persona}}\n{{/if}}{{trim}} [/INST]",
|
"story_string": "[INST] {{#if system}}{{system}}\n{{/if}}{{#if wiBefore}}{{wiBefore}}\n{{/if}}{{#if description}}{{description}}\n{{/if}}{{#if personality}}{{personality}}\n{{/if}}{{#if scenario}}{{scenario}}\n{{/if}}{{#if wiAfter}}{{wiAfter}}\n{{/if}}{{#if persona}}{{persona}}\n{{/if}}{{trim}}[/INST] Understood.</s>",
|
||||||
"example_separator": "Examples:",
|
"example_separator": "",
|
||||||
"chat_start": "",
|
"chat_start": "",
|
||||||
"use_stop_strings": false,
|
"use_stop_strings": false,
|
||||||
"allow_jailbreak": false,
|
"allow_jailbreak": false,
|
||||||
@@ -8,5 +8,5 @@
|
|||||||
"trim_sentences": false,
|
"trim_sentences": false,
|
||||||
"include_newline": false,
|
"include_newline": false,
|
||||||
"single_line": false,
|
"single_line": false,
|
||||||
"name": "Mistral"
|
"name": "Mistral V2 & V3"
|
||||||
}
|
}
|
12
default/content/presets/context/Mistral V3-Tekken.json
Normal file
12
default/content/presets/context/Mistral V3-Tekken.json
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"story_string": "[INST]{{#if system}}{{system}}\n{{/if}}{{#if wiBefore}}{{wiBefore}}\n{{/if}}{{#if description}}{{description}}\n{{/if}}{{#if personality}}{{personality}}\n{{/if}}{{#if scenario}}{{scenario}}\n{{/if}}{{#if wiAfter}}{{wiAfter}}\n{{/if}}{{#if persona}}{{persona}}\n{{/if}}{{trim}}[/INST]Understood.</s>",
|
||||||
|
"example_separator": "",
|
||||||
|
"chat_start": "",
|
||||||
|
"use_stop_strings": false,
|
||||||
|
"allow_jailbreak": false,
|
||||||
|
"always_force_name2": true,
|
||||||
|
"trim_sentences": false,
|
||||||
|
"include_newline": false,
|
||||||
|
"single_line": false,
|
||||||
|
"name": "Mistral V3-Tekken"
|
||||||
|
}
|
23
default/content/presets/instruct/Mistral V1.json
Normal file
23
default/content/presets/instruct/Mistral V1.json
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"system_prompt": "Write {{char}}'s next reply in this fictional roleplay with {{user}}.",
|
||||||
|
"input_sequence": " [INST] ",
|
||||||
|
"output_sequence": " [/INST] ",
|
||||||
|
"last_output_sequence": " [/INST]",
|
||||||
|
"system_sequence": "",
|
||||||
|
"stop_sequence": "",
|
||||||
|
"wrap": false,
|
||||||
|
"macro": true,
|
||||||
|
"names_behavior": "always",
|
||||||
|
"activation_regex": "",
|
||||||
|
"system_sequence_prefix": "",
|
||||||
|
"system_sequence_suffix": "",
|
||||||
|
"first_output_sequence": "",
|
||||||
|
"skip_examples": false,
|
||||||
|
"output_suffix": "</s>",
|
||||||
|
"input_suffix": "",
|
||||||
|
"system_suffix": "",
|
||||||
|
"user_alignment_message": "Let's get started. Please respond based on the information and instructions provided above.",
|
||||||
|
"system_same_as_user": true,
|
||||||
|
"last_system_sequence": "",
|
||||||
|
"name": "Mistral V1"
|
||||||
|
}
|
23
default/content/presets/instruct/Mistral V2 & V3.json
Normal file
23
default/content/presets/instruct/Mistral V2 & V3.json
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"system_prompt": "Write {{char}}'s next reply in this fictional roleplay with {{user}}.",
|
||||||
|
"input_sequence": "[INST] ",
|
||||||
|
"output_sequence": "[/INST] ",
|
||||||
|
"last_output_sequence": "[/INST]",
|
||||||
|
"system_sequence": "",
|
||||||
|
"stop_sequence": "",
|
||||||
|
"wrap": false,
|
||||||
|
"macro": true,
|
||||||
|
"names_behavior": "always",
|
||||||
|
"activation_regex": "",
|
||||||
|
"system_sequence_prefix": "",
|
||||||
|
"system_sequence_suffix": "",
|
||||||
|
"first_output_sequence": "",
|
||||||
|
"skip_examples": false,
|
||||||
|
"output_suffix": "</s>",
|
||||||
|
"input_suffix": "",
|
||||||
|
"system_suffix": "",
|
||||||
|
"user_alignment_message": "Let's get started. Please respond based on the information and instructions provided above.",
|
||||||
|
"system_same_as_user": true,
|
||||||
|
"last_system_sequence": "",
|
||||||
|
"name": "Mistral V2 & V3"
|
||||||
|
}
|
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"system_prompt": "Write {{char}}'s next reply in this fictional roleplay with {{user}}.",
|
"system_prompt": "Write {{char}}'s next reply in this fictional roleplay with {{user}}.",
|
||||||
"input_sequence": "[INST]",
|
"input_sequence": "[INST]",
|
||||||
"output_sequence": "",
|
"output_sequence": "[/INST]",
|
||||||
"last_output_sequence": "",
|
"last_output_sequence": "",
|
||||||
"system_sequence": "",
|
"system_sequence": "",
|
||||||
"stop_sequence": "",
|
"stop_sequence": "",
|
||||||
@@ -13,11 +13,11 @@
|
|||||||
"system_sequence_suffix": "",
|
"system_sequence_suffix": "",
|
||||||
"first_output_sequence": "",
|
"first_output_sequence": "",
|
||||||
"skip_examples": false,
|
"skip_examples": false,
|
||||||
"output_suffix": "\n",
|
"output_suffix": "</s>",
|
||||||
"input_suffix": " [/INST]\n",
|
"input_suffix": "",
|
||||||
"system_suffix": "",
|
"system_suffix": "",
|
||||||
"user_alignment_message": "Let's get started. Please respond based on the information and instructions provided above.",
|
"user_alignment_message": "Let's get started. Please respond based on the information and instructions provided above.",
|
||||||
"system_same_as_user": true,
|
"system_same_as_user": true,
|
||||||
"last_system_sequence": "",
|
"last_system_sequence": "",
|
||||||
"name": "Mistral"
|
"name": "Mistral V3-Tekken"
|
||||||
}
|
}
|
@@ -532,6 +532,19 @@ export function formatInstructModePrompt(name, isImpersonate, promptBias, name1,
|
|||||||
}
|
}
|
||||||
|
|
||||||
let sequence = getSequence() || '';
|
let sequence = getSequence() || '';
|
||||||
|
let nameFiller = '';
|
||||||
|
|
||||||
|
// A hack for Mistral's formatting that has a normal output sequence ending with a space
|
||||||
|
if (
|
||||||
|
includeNames &&
|
||||||
|
power_user.instruct.last_output_sequence &&
|
||||||
|
power_user.instruct.output_sequence &&
|
||||||
|
sequence === power_user.instruct.last_output_sequence &&
|
||||||
|
/\s$/.test(power_user.instruct.output_sequence) &&
|
||||||
|
!/\s$/.test(power_user.instruct.last_output_sequence)
|
||||||
|
) {
|
||||||
|
nameFiller = power_user.instruct.output_sequence.slice(-1);
|
||||||
|
}
|
||||||
|
|
||||||
if (power_user.instruct.macro) {
|
if (power_user.instruct.macro) {
|
||||||
sequence = substituteParams(sequence, name1, name2);
|
sequence = substituteParams(sequence, name1, name2);
|
||||||
@@ -539,7 +552,7 @@ export function formatInstructModePrompt(name, isImpersonate, promptBias, name1,
|
|||||||
}
|
}
|
||||||
|
|
||||||
const separator = power_user.instruct.wrap ? '\n' : '';
|
const separator = power_user.instruct.wrap ? '\n' : '';
|
||||||
let text = includeNames ? (separator + sequence + separator + `${name}:`) : (separator + sequence);
|
let text = includeNames ? (separator + sequence + separator + nameFiller + `${name}:`) : (separator + sequence);
|
||||||
|
|
||||||
// Quiet prompt already has a newline at the end
|
// Quiet prompt already has a newline at the end
|
||||||
if (isQuiet && separator) {
|
if (isQuiet && separator) {
|
||||||
|
Reference in New Issue
Block a user