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:
pandora
2024-09-21 00:56:02 +02:00
committed by GitHub
parent 8c3a895ff4
commit 125498cfd5
8 changed files with 116 additions and 17 deletions

View File

@ -532,6 +532,19 @@ export function formatInstructModePrompt(name, isImpersonate, promptBias, name1,
}
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) {
sequence = substituteParams(sequence, name1, name2);
@ -539,7 +552,7 @@ export function formatInstructModePrompt(name, isImpersonate, promptBias, name1,
}
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
if (isQuiet && separator) {