Add Harmony template (#4431)
* Add Harmony template * Add Thinking instruct variant and reasoning template * Specify template hash from unsloth * Add ggml-org template hash
This commit is contained in:
@@ -838,5 +838,21 @@
|
||||
{
|
||||
"filename": "presets/context/Moonshot AI.json",
|
||||
"type": "context"
|
||||
},
|
||||
{
|
||||
"filename": "presets/context/OpenAI Harmony.json",
|
||||
"type": "context"
|
||||
},
|
||||
{
|
||||
"filename": "presets/instruct/OpenAI Harmony.json",
|
||||
"type": "instruct"
|
||||
},
|
||||
{
|
||||
"filename": "presets/instruct/OpenAI Harmony (Thinking).json",
|
||||
"type": "instruct"
|
||||
},
|
||||
{
|
||||
"filename": "presets/reasoning/OpenAI Harmony.json",
|
||||
"type": "reasoning"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"story_string": "{{#if anchorBefore}}{{anchorBefore}}\n{{/if}}{{#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}}{{#if anchorAfter}}{{anchorAfter}}\n{{/if}}{{trim}}",
|
||||
"example_separator": "",
|
||||
"chat_start": "",
|
||||
"use_stop_strings": false,
|
||||
"names_as_stop_strings": true,
|
||||
"story_string_position": 0,
|
||||
"story_string_depth": 1,
|
||||
"story_string_role": 0,
|
||||
"always_force_name2": true,
|
||||
"trim_sentences": false,
|
||||
"single_line": false,
|
||||
"name": "OpenAI Harmony"
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"input_sequence": "<|start|>user<|message|>",
|
||||
"output_sequence": "<|start|>assistant<|channel|>final<|message|>",
|
||||
"last_output_sequence": "{{noop}}",
|
||||
"system_sequence": "<|start|>developer<|message|>",
|
||||
"stop_sequence": "",
|
||||
"wrap": false,
|
||||
"macro": true,
|
||||
"activation_regex": "",
|
||||
"first_output_sequence": "",
|
||||
"skip_examples": false,
|
||||
"output_suffix": "<|end|>",
|
||||
"input_suffix": "<|end|>",
|
||||
"system_suffix": "<|end|>",
|
||||
"user_alignment_message": "",
|
||||
"system_same_as_user": false,
|
||||
"last_system_sequence": "",
|
||||
"first_input_sequence": "",
|
||||
"last_input_sequence": "",
|
||||
"names_behavior": "force",
|
||||
"sequences_as_stop_strings": false,
|
||||
"story_string_prefix": "<|start|>system<|message|>",
|
||||
"story_string_suffix": "<|end|>",
|
||||
"name": "OpenAI Harmony (Thinking)"
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"input_sequence": "<|start|>user<|message|>",
|
||||
"output_sequence": "<|start|>assistant<|channel|>final<|message|>",
|
||||
"last_output_sequence": "",
|
||||
"system_sequence": "<|start|>developer<|message|>",
|
||||
"stop_sequence": "",
|
||||
"wrap": false,
|
||||
"macro": true,
|
||||
"activation_regex": "",
|
||||
"first_output_sequence": "",
|
||||
"skip_examples": false,
|
||||
"output_suffix": "<|end|>",
|
||||
"input_suffix": "<|end|>",
|
||||
"system_suffix": "<|end|>",
|
||||
"user_alignment_message": "",
|
||||
"system_same_as_user": false,
|
||||
"last_system_sequence": "",
|
||||
"first_input_sequence": "",
|
||||
"last_input_sequence": "",
|
||||
"names_behavior": "force",
|
||||
"sequences_as_stop_strings": true,
|
||||
"story_string_prefix": "<|start|>system<|message|>",
|
||||
"story_string_suffix": "<|end|>",
|
||||
"name": "OpenAI Harmony"
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"prefix": "<|start|>assistant<|channel|>analysis<|message|>",
|
||||
"suffix": "<|start|>assistant<|channel|>final<|message|>",
|
||||
"separator": "",
|
||||
"name": "OpenAI Harmony"
|
||||
}
|
||||
+12
-23
@@ -5522,30 +5522,19 @@ export function cleanUpMessage({ getMessage, isImpersonate, isContinue, displayI
|
||||
getMessage = getMessage.substring(0, getMessage.indexOf(power_user.instruct.input_sequence));
|
||||
}
|
||||
}
|
||||
if (isInstruct && power_user.instruct.input_sequence && isImpersonate) {
|
||||
//getMessage = getMessage.replaceAll(power_user.instruct.input_sequence, '');
|
||||
power_user.instruct.input_sequence.split('\n')
|
||||
.filter(line => line.trim() !== '')
|
||||
.forEach(line => {
|
||||
getMessage = getMessage.replaceAll(line, '');
|
||||
});
|
||||
}
|
||||
if (isInstruct && power_user.instruct.output_sequence && !isImpersonate) {
|
||||
//getMessage = getMessage.replaceAll(power_user.instruct.output_sequence, '');
|
||||
power_user.instruct.output_sequence.split('\n')
|
||||
.filter(line => line.trim() !== '')
|
||||
.forEach(line => {
|
||||
getMessage = getMessage.replaceAll(line, '');
|
||||
});
|
||||
}
|
||||
if (isInstruct && power_user.instruct.last_output_sequence && !isImpersonate) {
|
||||
//getMessage = getMessage.replaceAll(power_user.instruct.last_output_sequence, '');
|
||||
power_user.instruct.last_output_sequence.split('\n')
|
||||
.filter(line => line.trim() !== '')
|
||||
.forEach(line => {
|
||||
getMessage = getMessage.replaceAll(line, '');
|
||||
});
|
||||
|
||||
// Remove instruct sequences leaking to the output
|
||||
if (isInstruct && power_user.instruct.sequences_as_stop_strings) {
|
||||
const sequences = [
|
||||
{ value: power_user.instruct.input_sequence, apply: isImpersonate && isNotEmpty(power_user.instruct.input_sequence) },
|
||||
{ value: power_user.instruct.output_sequence, apply: !isImpersonate && isNotEmpty(power_user.instruct.output_sequence) },
|
||||
{ value: power_user.instruct.last_output_sequence, apply: !isImpersonate && isNotEmpty(power_user.instruct.last_output_sequence) },
|
||||
];
|
||||
for (const seq of sequences.filter(s => s.apply)) {
|
||||
seq.value.split('\n').filter(line => line.trim() !== '').forEach(line => { getMessage = getMessage.replaceAll(line, ''); });
|
||||
}
|
||||
}
|
||||
|
||||
// clean-up group message from excessive generations
|
||||
if (selected_group) {
|
||||
getMessage = cleanGroupMessage(getMessage);
|
||||
|
||||
@@ -90,10 +90,21 @@ const hash_derivations = {
|
||||
'aab20feb9bc6881f941ea649356130ffbc4943b3c2577c0991e1fba90de5a0fc':
|
||||
'Moonshot AI'
|
||||
,
|
||||
|
||||
// gpt-oss (unsloth)
|
||||
'70da0d2348e40aaf8dad05f04a316835fd10547bd7e3392ce337e4c79ba91c01':
|
||||
'OpenAI Harmony'
|
||||
,
|
||||
|
||||
// gpt-oss (ggml-org)
|
||||
'a4c9919cbbd4acdd51ccffe22da049264b1b73e59055fa58811a99efbd7c8146':
|
||||
'OpenAI Harmony'
|
||||
,
|
||||
};
|
||||
|
||||
const substr_derivations = [
|
||||
['Moonshot AI', ['<|im_user|>user<|im_middle|>', '<|im_assistant|>assistant<|im_middle|>', '<|im_end|>']],
|
||||
['OpenAI Harmony', ['<|start|>user<|message|>', '<|start|>assistant<|channel|>final<|message|>', '<|end|>']],
|
||||
|
||||
// Generic cases
|
||||
['ChatML', ['<|im_start|>user', '<|im_start|>assistant', '<|im_end|>']],
|
||||
|
||||
Reference in New Issue
Block a user