File size: 8,059 Bytes
7729ae4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a135965
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{
  "backend": "tokenizers",
  "bos_token": "<|startoftext|>",
  "clean_up_tokenization_spaces": false,
  "eos_token": "<|endoftext|>",
  "is_local": false,
  "model_input_names": [
    "input_ids",
    "attention_mask"
  ],
  "model_max_length": 1000000000000000019884624838656,
  "pad_token": "<|endoftext|>",
  "padding_side": "left",
  "split_special_tokens": false,
  "tokenizer_class": "TokenizersBackend",
  "unk_token": "<unk>",
  "chat_template": "{#- ======== Template Parameters ========  #}\n{%- set add_generation_prompt = add_generation_prompt if add_generation_prompt is defined else true %}\n{%- set default_system_prompt = default_system_prompt if default_system_prompt is defined else true %}\n{%- set reasoning_effort = reasoning_effort if reasoning_effort is defined else \"high\" %}\n{%- set think_render_option = think_render_option if think_render_option is defined else \"lastthink\" %}\n\n{#- ======== System Block State ========  #}\n{%- set sys_ns = namespace(is_first_block=true) -%}\n\n{#- ======== Find last user message index ========  #}\n{%- set last_user_idx = namespace(value=-1) -%}\n{%- for message in messages -%}\n    {%- if message.role == 'user' -%}\n        {%- set last_user_idx.value = loop.index0 -%}\n    {%- endif -%}\n{%- endfor -%}\n\n{#- ======== System messages renderers ========  #}\n{%- macro render_system_message(user_system_messages) %}\n    {%- if default_system_prompt %}\n        {%- if not sys_ns.is_first_block %}{{- \"\\n\\n\" }}{%- endif %}\n        {%- set sys_ns.is_first_block = false %}\n        {{- \"## Provider System Prompt\\n\\nYou are Solar Open 100B, a large language model trained by Upstage AI, a Korean startup. Your knowledge cutoff is 2025-07. The current date is \" + strftime_now(\"%Y-%m-%d\") + \".\" }}\n    {%- endif -%}\n    {%- if user_system_messages %}\n        {%- if not sys_ns.is_first_block %}{{- \"\\n\\n\" }}{%- endif %}\n        {%- set sys_ns.is_first_block = false %}\n        {{- \"## System Prompt\" }}\n        {%- for system_message in user_system_messages %}\n            {{- \"\\n\\n\" }}\n            {{- system_message }}\n        {%- endfor %}\n    {%- endif -%}\n{%- endmacro %}\n\n{%- macro render_tool_instruction(tools) %}\n    {%- if not sys_ns.is_first_block %}{{- \"\\n\\n\" }}{%- endif %}\n    {%- set sys_ns.is_first_block = false %}\n    {{- \"## Tools\\n\\n### Tool Call Instruction\" }}\n    {{- \"\\nYou may invoke one or more tools to assist with the user's query. Available tools are provided in JSON Schema format: <|tools:begin|><|tool:begin|><tools-json-object><|tool:end|>...<|tools:end|>\\n\" }}\n    {{- \"\\n### Available Tools\\n\" }}\n    {{- \"<|tools:begin|>\" }}\n    {%- for tool in tools %}\n        {{- \"<|tool:begin|>\" }}\n        {{- tool.function | tojson }}\n        {{- \"<|tool:end|>\" }}\n    {%- endfor %}\n    {{- \"<|tools:end|>\\n\" }}\n    {{- \"\\n### Tool Call Format\\n\" }}\n    {{- \"For each tool call, return a JSON object with the following structure, enclosed within <|tool_call:begin|> and <|tool_call:end|> tags: \\n<|tool_call:begin|><tool-call-id><|tool_call:name|><tool-name><|tool_call:args|><args-json-object><|tool_call:end|>\\n\" }}\n    {{- \"- The <tool-call-id> must be a randomly generated string consisting of 10 lowercase letters (a-z) and/or digits (0-9) (e.g., a1b2c3d4e5)\\n\" }}\n    {{- \"\\n### Tool Response Format\\n\" }}\n    {{- \"Each tool is responded by `tool` with the following structure:\\n<|tool_response:id|><tool-call-id><|tool_response:name|><tool-name><|tool_response:result|><results><|tool_response:end|>\\n\" }}\n    {{- \"- Ensure the <tool-call-id> matches the corresponding tool call\" -}}\n{%- endmacro %}\n\n{%- macro render_json_response_format_instruction(response_format) %}\n    {%- if not sys_ns.is_first_block %}{{- \"\\n\\n\" }}{%- endif %}\n    {%- set sys_ns.is_first_block = false %}\n    {{- \"## Output Format Constraint\" }}\n    {{- \"\\n\\nYour final response should follow the JSON schema: \\n[Start of schema]\" }}\n    {{- response_format }}\n    {{- \"\\n[End of schema]\\nPlease ensure your answers adhere to this format and do not contain any unnecessary text.\" }}\n{%- endmacro %}\n\n{%- macro get_tool_name(messages, tool_call_id) %}\n    {%- for msg in messages -%}\n        {%- if msg.role == 'assistant' and msg.tool_calls -%}\n            {%- for tool_call in msg.tool_calls -%}\n                {%- if tool_call.id == tool_call_id -%}\n                    {{- tool_call.function.name }}\n                {%- endif -%}\n            {%- endfor -%}\n        {%- endif -%}\n    {%- endfor -%}\n{%- endmacro %}\n\n{%- macro render_tool_arguments(tool_arguments) %}\n    {%- if tool_arguments is mapping -%}\n        {{- tool_arguments | tojson }}\n    {%- else -%}\n        {{- tool_arguments }}\n    {%- endif -%}\n{%- endmacro %}\n\n{#- ======== Render system message ========  #}\n{%- set ns = namespace(system_messages=[]) -%}\n{%- for message in messages -%}\n    {%- if message.role == 'system' -%}\n        {%- set ns.system_messages = ns.system_messages + [message.content] -%}\n    {%- endif -%}\n{%- endfor -%}\n\n{%- if ns.system_messages or default_system_prompt or tools or response_format -%}\n    {{- \"<|begin|>system<|content|>\" }}\n        {{- render_system_message(ns.system_messages) }}\n        {%- if tools -%}\n            {{- render_tool_instruction(tools) }}\n        {%- endif %}\n        {%- if response_format -%}\n            {{- render_json_response_format_instruction(response_format) }}\n        {%- endif %}\n    {{- \"<|end|>\" }}\n{%- endif -%}\n\n{#- ======== Render main messages ========  #}\n{%- for message in messages -%}\n    {%- if message.role == 'user' -%}\n         {{- \"<|begin|>user<|content|>\" + message.content + \"<|end|>\" }}\n    {%- elif message.role == 'tool' -%}\n        {%- set prev_is_tool = loop.index0 > 0 and messages[loop.index0 - 1].role == 'tool' -%}\n        {%- set next_is_tool = loop.index0 < (messages | length - 1) and messages[loop.index0 + 1].role == 'tool' -%}\n        {%- if not prev_is_tool -%}\n            {{- \"<|begin|>tool<|tool_response|>\" }}\n        {%- endif -%}\n        {{- \"<|tool_response:begin|>\" + message.tool_call_id + \"<|tool_response:name|>\" }}\n        {{- get_tool_name(messages, message.tool_call_id) }}\n        {{- \"<|tool_response:result|>\" }}\n        {{- message.content }}\n        {{- \"<|tool_response:end|>\" }}\n        {%- if not next_is_tool -%}\n            {{- \"<|end|>\" }}\n        {%- endif -%}\n    {%- elif message.role == 'assistant' -%}\n        {#- ======== Assistant Thinking ========  #}\n        {%- if think_render_option == \"all\" -%}\n            {%- if message.reasoning -%}\n                {{- \"<|begin|>assistant<|think|>\" + message.reasoning + \"<|end|>\" }}\n            {%- endif -%}\n        {%- elif think_render_option == \"lastthink\" -%}\n            {%- if message.reasoning and loop.index0 > last_user_idx.value -%}\n                {{- \"<|begin|>assistant<|think|>\" + message.reasoning + \"<|end|>\" }}\n            {%- endif -%}\n        {%- endif -%}\n\n        {#- ======== Assistant Messages ========  #}\n        {%- if message.tool_calls -%}\n            {{- \"<|begin|>assistant<|tool_calls|>\" }}\n            {%- for tool_call in message.tool_calls -%}\n                {{- \"<|tool_call:begin|>\" + tool_call.id +\"<|tool_call:name|>\" + tool_call.function.name + \"<|tool_call:args|>\" }}\n                {{- render_tool_arguments(tool_call.function.arguments) }}\n                {{- \"<|tool_call:end|>\" }}\n            {%- endfor -%}\n            {{- \"<|calls|>\" }}\n        {%- else -%}\n            {{- \"<|begin|>assistant<|content|>\" + message.content + \"<|end|>\" }}\n        {%- endif -%}\n    {%- endif -%}\n{%- endfor -%}\n\n{%- if add_generation_prompt -%}\n    {%- if reasoning_effort in [\"low\", \"minimal\"] -%}\n        {{- \"<|begin|>assistant<|think|><|end|>\" }}\n    {%- endif -%}\n    {{- \"<|begin|>assistant\" }}\n{%- endif -%}\n"
}