tokenizer.chat_template.systemone
{%- macro cj(v) -%}{%- if v is string -%}{{ '"' }}{{ v | replace("\\", "\\\\") | replace("\"", "\\\"") | replace("\n", "\\n") | replace("\r", "\\r") | replace("\t", "\\t") | replace("\b", "\\b") | replace("\f", "\\f") | replace("", "\\u0001") | replace("", "\\u0002") | replace("", "\\u0003") | replace("", "\\u0004") | replace("", "\\u0005") | replace("", "\\u0006") | replace("", "\\u0007") | replace("", "\\u000b") | replace("", "\\u000e") | replace("", "\\u000f") | replace("", "\\u0010") | replace("", "\\u0011") | replace("", "\\u0012") | replace("", "\\u0013") | replace("", "\\u0014") | replace("", "\\u0015") | replace("", "\\u0016") | replace("", "\\u0017") | replace("", "\\u0018") | replace("", "\\u0019") | replace("", "\\u001a") | replace("", "\\u001b") | replace("", "\\u001c") | replace("", "\\u001d") | replace("", "\\u001e") | replace("", "\\u001f") }}{{ '"' }}{%- elif v is none -%}null{%- elif v is sameas true -%}true{%- elif v is sameas false -%}false{%- elif v is mapping -%}{{ '{' }}{%- for k, x in v.items() -%}{{ cj(k) }}:{{ cj(x) }}{%- if not loop.last -%},{%- endif -%}{%- endfor -%}{{ '}' }}{%- elif v is iterable -%}[{%- for x in v -%}{{ cj(x) }}{%- if not loop.last -%},{%- endif -%}{%- endfor -%}]{%- else -%}{{ v }}{%- endif -%}{%- endmacro -%}{%- macro txt(v) -%}{%- if v is string -%}{{ v }}{%- elif v is none -%}{%- else -%}{{ cj(v) }}{%- endif -%}{%- endmacro -%}{%- macro pyrepr(v) -%}{%- if v is string -%}{%- if "'" in v and '"' not in v -%}{{ '"' }}{{ v | replace("\\", "\\\\") | replace("\n", "\\n") | replace("\r", "\\r") | replace("\t", "\\t") | replace("\b", "\\x08") | replace("\f", "\\x0c") | replace("", "\\x01") | replace("", "\\x02") | replace("", "\\x03") | replace("", "\\x04") | replace("", "\\x05") | replace("", "\\x06") | replace("", "\\x07") | replace("", "\\x0b") | replace("", "\\x0e") | replace("", "\\x0f") | replace("", "\\x10") | replace("", "\\x11") | replace("", "\\x12") | replace("", "\\x13") | replace("", "\\x14") | replace("", "\\x15") | replace("", "\\x16") | replace("", "\\x17") | replace("", "\\x18") | replace("", "\\x19") | replace("", "\\x1a") | replace("", "\\x1b") | replace("", "\\x1c") | replace("", "\\x1d") | replace("", "\\x1e") | replace("", "\\x1f") | replace("", "\\x7f") }}{{ '"' }}{%- else -%}{{ "'" }}{{ v | replace("\\", "\\\\") | replace("\n", "\\n") | replace("\r", "\\r") | replace("\t", "\\t") | replace("\b", "\\x08") | replace("\f", "\\x0c") | replace("", "\\x01") | replace("", "\\x02") | replace("", "\\x03") | replace("", "\\x04") | replace("", "\\x05") | replace("", "\\x06") | replace("", "\\x07") | replace("", "\\x0b") | replace("", "\\x0e") | replace("", "\\x0f") | replace("", "\\x10") | replace("", "\\x11") | replace("", "\\x12") | replace("", "\\x13") | replace("", "\\x14") | replace("", "\\x15") | replace("", "\\x16") | replace("", "\\x17") | replace("", "\\x18") | replace("", "\\x19") | replace("", "\\x1a") | replace("", "\\x1b") | replace("", "\\x1c") | replace("", "\\x1d") | replace("", "\\x1e") | replace("", "\\x1f") | replace("", "\\x7f") | replace("'", "\\'") }}{{ "'" }}{%- endif -%}{%- elif v is none -%}None{%- elif v is sameas true -%}True{%- elif v is sameas false -%}False{%- elif v is mapping -%}{{ '{' }}{%- for k, x in v.items() -%}{{ pyrepr(k) }}: {{ pyrepr(x) }}{%- if not loop.last -%}, {% endif -%}{%- endfor -%}{{ '}' }}{%- elif v is iterable -%}[{%- for x in v -%}{{ pyrepr(x) }}{%- if not loop.last -%}, {% endif -%}{%- endfor -%}]{%- else -%}{{ v }}{%- endif -%}{%- endmacro -%}{%- macro pystr(v) -%}{%- if v is string -%}{{ v }}{%- else -%}{{ pyrepr(v) }}{%- endif -%}{%- endmacro -%}{%- macro instr(t, x) -%}{%- set s = txt(x) | trim -%}{%- if s -%}{{ s }}{%- elif t == "noul" -%}{{ 'Is this true?' }}{%- elif t == "choice" -%}{{ 'Which option applies?' }}{%- elif t == "score" -%}{{ 'Which level applies?' }}{%- endif -%}{%- endmacro -%}{%- macro desnake(k) -%}{%- if '_' in k and not k.startswith('_') and not k.endswith('_') and '__' not in k and (k | replace("a", "") | replace("b", "") | replace("c", "") | replace("d", "") | replace("e", "") | replace("f", "") | replace("g", "") | replace("h", "") | replace("i", "") | replace("j", "") | replace("k", "") | replace("l", "") | replace("m", "") | replace("n", "") | replace("o", "") | replace("p", "") | replace("q", "") | replace("r", "") | replace("s", "") | replace("t", "") | replace("u", "") | replace("v", "") | replace("w", "") | replace("x", "") | replace("y", "") | replace("z", "") | replace("_", "")) == '' -%}{{ k | replace('_', ' ') }}{%- else -%}{{ k }}{%- endif -%}{%- endmacro -%}{%- macro stem_ok(s) -%}{%- set b = s[:-1] if (s.endswith('_') or s.endswith('-') or s.endswith(' ')) else s -%}{%- if s == '' or (b != '' and (b | replace("a", "") | replace("b", "") | replace("c", "") | replace("d", "") | replace("e", "") | replace("f", "") | replace("g", "") | replace("h", "") | replace("i", "") | replace("j", "") | replace("k", "") | replace("l", "") | replace("m", "") | replace("n", "") | replace("o", "") | replace("p", "") | replace("q", "") | replace("r", "") | replace("s", "") | replace("t", "") | replace("u", "") | replace("v", "") | replace("w", "") | replace("x", "") | replace("y", "") | replace("z", "") | replace("A", "") | replace("B", "") | replace("C", "") | replace("D", "") | replace("E", "") | replace("F", "") | replace("G", "") | replace("H", "") | replace("I", "") | replace("J", "") | replace("K", "") | replace("L", "") | replace("M", "") | replace("N", "") | replace("O", "") | replace("P", "") | replace("Q", "") | replace("R", "") | replace("S", "") | replace("T", "") | replace("U", "") | replace("V", "") | replace("W", "") | replace("X", "") | replace("Y", "") | replace("Z", "")) == '') -%}1{%- endif -%}{%- endmacro -%}{%- macro stem_of(k, n) -%}{%- set ns = namespace(out='') -%}{%- for d in [n | string, '0' ~ (n | string), '00' ~ (n | string)] -%}{%- if ns.out == '' and k.endswith(d) and stem_ok(k[:(k | length) - (d | length)]) == '1' -%}{%- set ns.out = '=' ~ (k[:(k | length) - (d | length)] | lower) -%}{%- endif -%}{%- endfor -%}{{ ns.out }}{%- endmacro -%}{%- macro is_index(opts) -%}{%- set n = opts | length -%}{%- set r = namespace(ok=false) -%}{%- if n >= 2 -%}{%- for base in [0, 1] -%}{%- set ns = namespace(ok=true, stem=none, seen='|') -%}{%- for o in opts -%}{%- set f = namespace(stem='', num=-1) -%}{%- for i in range(base, base + n) -%}{%- if f.stem == '' -%}{%- set s = stem_of(o.key, i) -%}{%- if s != '' -%}{%- set f.stem = s -%}{%- set f.num = i -%}{%- endif -%}{%- endif -%}{%- endfor -%}{%- if f.stem == '' or ('|' ~ f.num ~ '|') in ns.seen or (ns.stem is not none and ns.stem != f.stem) or (txt(o.description) | trim) == '' -%}{%- set ns.ok = false -%}{%- else -%}{%- set ns.stem = f.stem -%}{%- set ns.seen = ns.seen ~ f.num ~ '|' -%}{%- endif -%}{%- endfor -%}{%- if ns.ok -%}{%- set r.ok = true -%}{%- endif -%}{%- endfor -%}{%- endif -%}{%- if r.ok -%}1{%- endif -%}{%- endmacro -%}{%- macro described(o) -%}{%- set d = txt(o.description) -%}{%- if d != '' -%}{{ d }}{%- else -%}{{ desnake(o.key) }}{%- endif -%}{%- endmacro -%}{%- macro choice_mode(opts) -%}{%- set e = namespace(empty=true, dup=false) -%}{%- for o in opts -%}{%- if txt(o.description) != '' -%}{%- set e.empty = false -%}{%- endif -%}{%- endfor -%}{%- if is_index(opts) == '1' -%}index{%- elif e.empty -%}bare{%- else -%}{%- for a in opts -%}{%- set i = loop.index0 -%}{%- for b in opts -%}{%- if loop.index0 > i and not e.dup and described(a) == described(b) -%}{%- set e.dup = true -%}{%- endif -%}{%- endfor -%}{%- endfor -%}{%- if e.dup -%}full{%- else -%}described{%- endif -%}{%- endif -%}{%- endmacro -%}{{ '<bos><|turn>system\nYou are a calibration engine. You never answer in prose. You are given a state, a question and a numbered set of options, and you choose exactly one option. You reply with that option\'s LETTER and nothing else — a single character, no words, no punctuation, no explanation.<turn|>\n<|turn>user\nQuestions that will be asked about the context:\n' }}{{ '- ' }}{{ instr(type, instructions) }}{{ '\n' }}{{ '\n' }}{%- for m in images -%}{{ m }}{%- endfor -%}{%- if state is string -%}{{ state }}{%- elif state is mapping -%}{%- set ns = namespace(first=true) -%}{%- for k, v in state.items() -%}{%- if not k.startswith('_') -%}{%- if not ns.first -%}{{ '\n' }}{%- endif -%}{%- set ns.first = false -%}{{ k }}: {{ pystr(v) }}{%- endif -%}{%- endfor -%}{%- else -%}{{ pystr(state) }}{%- endif -%}{{ '\n\n' }}{{ instr(type, instructions) }}{{ '\n\nOptions:\n' }}{%- set mode = choice_mode(options) if type == 'choice' else '' -%}{%- for o in options -%}{{ o.label }}{{ '. ' }}{%- if type == 'noul' -%}{%- set d = txt(o.description) | trim -%}{%- if d -%}{{ d }}{%- elif o.key == 'true' -%}Yes{%- else -%}No{%- endif -%}{%- elif type == 'score' -%}{{ txt(o.description) }}{%- else -%}{%- if mode == 'index' -%}{{ desnake(txt(o.description)) }}{%- elif mode == 'bare' -%}{{ desnake(o.key) }}{%- elif mode == 'described' -%}{{ described(o) }}{%- else -%}{%- set d = txt(o.description) -%}{%- if d != '' -%}{{ o.key }}: {{ d }}{%- else -%}{{ o.key }}{%- endif -%}{%- endif -%}{%- endif -%}{{ '\n' }}{%- endfor -%}{{ '\nAnswer with the letter of exactly one option, and nothing else:<turn|>\n<|turn>model\n<|channel>thought\n<channel|>' }}
{%- macro cj(v) -%}{%- if v is string -%}{{ '"' }}{{ v | replace("\\", "\\\\") | replace("\"", "\\\"") | replace("\n", "\\n") | replace("\r", "\\r") | replace("\t", "\\t") | replace("\b", "\\b") | replace("\f", "\\f") | replace("", "\\u0001") | replace("", "\\u0002") | replace("", "\\u0003") | replace("", "\\u0004") | replace("", "\\u0005") | replace("", "\\u0006") | replace("", "\\u0007") | replace("", "\\u000b") | replace("", "\\u000e") | replace("", "\\u000f") | replace("", "\\u0010") | replace("", "\\u0011") | replace("", "\\u0012") | replace("", "\\u0013") | replace("", "\\u0014") | replace("", "\\u0015") | replace("", "\\u0016") | replace("", "\\u0017") | replace("", "\\u0018") | replace("", "\\u0019") | replace("", "\\u001a") | replace("", "\\u001b") | replace("", "\\u001c") | replace("", "\\u001d") | replace("", "\\u001e") | replace("", "\\u001f") }}{{ '"' }}{%- elif v is none -%}null{%- elif v is sameas true -%}true{%- elif v is sameas false -%}false{%- elif v is mapping -%}{{ '{' }}{%- for k, x in v.items() -%}{{ cj(k) }}:{{ cj(x) }}{%- if not loop.last -%},{%- endif -%}{%- endfor -%}{{ '}' }}{%- elif v is iterable -%}[{%- for x in v -%}{{ cj(x) }}{%- if not loop.last -%},{%- endif -%}{%- endfor -%}]{%- else -%}{{ v }}{%- endif -%}{%- endmacro -%}{%- macro txt(v) -%}{%- if v is string -%}{{ v }}{%- elif v is none -%}{%- else -%}{{ cj(v) }}{%- endif -%}{%- endmacro -%}{%- macro pyrepr(v) -%}{%- if v is string -%}{%- if "'" in v and '"' not in v -%}{{ '"' }}{{ v | replace("\\", "\\\\") | replace("\n", "\\n") | replace("\r", "\\r") | replace("\t", "\\t") | replace("\b", "\\x08") | replace("\f", "\\x0c") | replace("", "\\x01") | replace("", "\\x02") | replace("", "\\x03") | replace("", "\\x04") | replace("", "\\x05") | replace("", "\\x06") | replace("", "\\x07") | replace("", "\\x0b") | replace("", "\\x0e") | replace("", "\\x0f") | replace("", "\\x10") | replace("", "\\x11") | replace("", "\\x12") | replace("", "\\x13") | replace("", "\\x14") | replace("", "\\x15") | replace("", "\\x16") | replace("", "\\x17") | replace("", "\\x18") | replace("", "\\x19") | replace("", "\\x1a") | replace("", "\\x1b") | replace("", "\\x1c") | replace("", "\\x1d") | replace("", "\\x1e") | replace("", "\\x1f") | replace("", "\\x7f") }}{{ '"' }}{%- else -%}{{ "'" }}{{ v | replace("\\", "\\\\") | replace("\n", "\\n") | replace("\r", "\\r") | replace("\t", "\\t") | replace("\b", "\\x08") | replace("\f", "\\x0c") | replace("", "\\x01") | replace("", "\\x02") | replace("", "\\x03") | replace("", "\\x04") | replace("", "\\x05") | replace("", "\\x06") | replace("", "\\x07") | replace("", "\\x0b") | replace("", "\\x0e") | replace("", "\\x0f") | replace("", "\\x10") | replace("", "\\x11") | replace("", "\\x12") | replace("", "\\x13") | replace("", "\\x14") | replace("", "\\x15") | replace("", "\\x16") | replace("", "\\x17") | replace("", "\\x18") | replace("", "\\x19") | replace("", "\\x1a") | replace("", "\\x1b") | replace("", "\\x1c") | replace("", "\\x1d") | replace("", "\\x1e") | replace("", "\\x1f") | replace("", "\\x7f") | replace("'", "\\'") }}{{ "'" }}{%- endif -%}{%- elif v is none -%}None{%- elif v is sameas true -%}True{%- elif v is sameas false -%}False{%- elif v is mapping -%}{{ '{' }}{%- for k, x in v.items() -%}{{ pyrepr(k) }}: {{ pyrepr(x) }}{%- if not loop.last -%}, {% endif -%}{%- endfor -%}{{ '}' }}{%- elif v is iterable -%}[{%- for x in v -%}{{ pyrepr(x) }}{%- if not loop.last -%}, {% endif -%}{%- endfor -%}]{%- else -%}{{ v }}{%- endif -%}{%- endmacro -%}{%- macro pystr(v) -%}{%- if v is string -%}{{ v }}{%- else -%}{{ pyrepr(v) }}{%- endif -%}{%- endmacro -%}{%- macro instr(t, x) -%}{%- set s = txt(x) | trim -%}{%- if s -%}{{ s }}{%- elif t == "noul" -%}{{ 'Is this true?' }}{%- elif t == "choice" -%}{{ 'Which option applies?' }}{%- elif t == "score" -%}{{ 'Which level applies?' }}{%- endif -%}{%- endmacro -%}{%- macro desnake(k) -%}{%- if '_' in k and not k.startswith('_') and not k.endswith('_') and '__' not in k and (k | replace("a", "") | replace("b", "") | replace("c", "") | replace("d", "") | replace("e", "") | replace("f", "") | replace("g", "") | replace("h", "") | replace("i", "") | replace("j", "") | replace("k", "") | replace("l", "") | replace("m", "") | replace("n", "") | replace("o", "") | replace("p", "") | replace("q", "") | replace("r", "") | replace("s", "") | replace("t", "") | replace("u", "") | replace("v", "") | replace("w", "") | replace("x", "") | replace("y", "") | replace("z", "") | replace("_", "")) == '' -%}{{ k | replace('_', ' ') }}{%- else -%}{{ k }}{%- endif -%}{%- endmacro -%}{%- macro stem_ok(s) -%}{%- set b = s[:-1] if (s.endswith('_') or s.endswith('-') or s.endswith(' ')) else s -%}{%- if s == '' or (b != '' and (b | replace("a", "") | replace("b", "") | replace("c", "") | replace("d", "") | replace("e", "") | replace("f", "") | replace("g", "") | replace("h", "") | replace("i", "") | replace("j", "") | replace("k", "") | replace("l", "") | replace("m", "") | replace("n", "") | replace("o", "") | replace("p", "") | replace("q", "") | replace("r", "") | replace("s", "") | replace("t", "") | replace("u", "") | replace("v", "") | replace("w", "") | replace("x", "") | replace("y", "") | replace("z", "") | replace("A", "") | replace("B", "") | replace("C", "") | replace("D", "") | replace("E", "") | replace("F", "") | replace("G", "") | replace("H", "") | replace("I", "") | replace("J", "") | replace("K", "") | replace("L", "") | replace("M", "") | replace("N", "") | replace("O", "") | replace("P", "") | replace("Q", "") | replace("R", "") | replace("S", "") | replace("T", "") | replace("U", "") | replace("V", "") | replace("W", "") | replace("X", "") | replace("Y", "") | replace("Z", "")) == '') -%}1{%- endif -%}{%- endmacro -%}{%- macro stem_of(k, n) -%}{%- set ns = namespace(out='') -%}{%- for d in [n | string, '0' ~ (n | string), '00' ~ (n | string)] -%}{%- if ns.out == '' and k.endswith(d) and stem_ok(k[:(k | length) - (d | length)]) == '1' -%}{%- set ns.out = '=' ~ (k[:(k | length) - (d | length)] | lower) -%}{%- endif -%}{%- endfor -%}{{ ns.out }}{%- endmacro -%}{%- macro is_index(opts) -%}{%- set n = opts | length -%}{%- set r = namespace(ok=false) -%}{%- if n >= 2 -%}{%- for base in [0, 1] -%}{%- set ns = namespace(ok=true, stem=none, seen='|') -%}{%- for o in opts -%}{%- set f = namespace(stem='', num=-1) -%}{%- for i in range(base, base + n) -%}{%- if f.stem == '' -%}{%- set s = stem_of(o.key, i) -%}{%- if s != '' -%}{%- set f.stem = s -%}{%- set f.num = i -%}{%- endif -%}{%- endif -%}{%- endfor -%}{%- if f.stem == '' or ('|' ~ f.num ~ '|') in ns.seen or (ns.stem is not none and ns.stem != f.stem) or (txt(o.description) | trim) == '' -%}{%- set ns.ok = false -%}{%- else -%}{%- set ns.stem = f.stem -%}{%- set ns.seen = ns.seen ~ f.num ~ '|' -%}{%- endif -%}{%- endfor -%}{%- if ns.ok -%}{%- set r.ok = true -%}{%- endif -%}{%- endfor -%}{%- endif -%}{%- if r.ok -%}1{%- endif -%}{%- endmacro -%}{%- macro described(o) -%}{%- set d = txt(o.description) -%}{%- if d != '' -%}{{ d }}{%- else -%}{{ desnake(o.key) }}{%- endif -%}{%- endmacro -%}{%- macro choice_mode(opts) -%}{%- set e = namespace(empty=true, dup=false) -%}{%- for o in opts -%}{%- if txt(o.description) != '' -%}{%- set e.empty = false -%}{%- endif -%}{%- endfor -%}{%- if is_index(opts) == '1' -%}index{%- elif e.empty -%}bare{%- else -%}{%- for a in opts -%}{%- set i = loop.index0 -%}{%- for b in opts -%}{%- if loop.index0 > i and not e.dup and described(a) == described(b) -%}{%- set e.dup = true -%}{%- endif -%}{%- endfor -%}{%- endfor -%}{%- if e.dup -%}full{%- else -%}described{%- endif -%}{%- endif -%}{%- endmacro -%}{{ '<bos><|turn>system\nYou are a calibration engine. You never answer in prose. You are given a state, a question and a numbered set of options, and you choose exactly one option. You reply with that option\'s LETTER and nothing else — a single character, no words, no punctuation, no explanation.<turn|>\n<|turn>user\nQuestions that will be asked about the context:\n' }}{{ '- ' }}{{ instr(type, instructions) }}{{ '\n' }}{{ '\n' }}{%- for m in images -%}{{ m }}{%- endfor -%}{%- if state is string -%}{{ state }}{%- elif state is mapping -%}{%- set ns = namespace(first=true) -%}{%- for k, v in state.items() -%}{%- if not k.startswith('_') -%}{%- if not ns.first -%}{{ '\n' }}{%- endif -%}{%- set ns.first = false -%}{{ k }}: {{ pystr(v) }}{%- endif -%}{%- endfor -%}{%- else -%}{{ pystr(state) }}{%- endif -%}{{ '\n\n' }}{{ instr(type, instructions) }}{{ '\n\nOptions:\n' }}{%- set mode = choice_mode(options) if type == 'choice' else '' -%}{%- for o in options -%}{{ o.label }}{{ '. ' }}{%- if type == 'noul' -%}{%- set d = txt(o.description) | trim -%}{%- if d -%}{{ d }}{%- elif o.key == 'true' -%}Yes{%- else -%}No{%- endif -%}{%- elif type == 'score' -%}{{ txt(o.description) }}{%- else -%}{%- if mode == 'index' -%}{{ desnake(txt(o.description)) }}{%- elif mode == 'bare' -%}{{ desnake(o.key) }}{%- elif mode == 'described' -%}{{ described(o) }}{%- else -%}{%- set d = txt(o.description) -%}{%- if d != '' -%}{{ o.key }}: {{ d }}{%- else -%}{{ o.key }}{%- endif -%}{%- endif -%}{%- endif -%}{{ '\n' }}{%- endfor -%}{{ '\nAnswer with the letter of exactly one option, and nothing else:<turn|>\n<|turn>model\n<|channel>thought\n<channel|>' }}