Ling 3.0 Flash goes openweight

nateb20221 pts0 comments

inclusionAI/Ling-3.0-flash · Hugging Face

Log In<br>Sign Up

","cls_token":"[CLS]","eos_token":"","pad_token":""},"chat_template_jinja":"{#- Bailing V3 chat template -#}\n{#- Supports: thinking option, tool calling -#}\n\n{#- ==================== thinking option normalization ==================== -#}\n{%- if enable_thinking is defined %}\n {%- if enable_thinking %}\n {%- set thinking_option = 'on' %}\n {%- else %}\n {%- set thinking_option = 'off' %}\n {%- endif %}\n{%- elif thinking_option is not defined %}\n {%- set thinking_option = 'on' %}\n{%- endif %}\n\n{#- ==================== preserved thinking ==================== -#}\n{% set preserved_thinking = true %}\n\n{#- ==================== system message ==================== -#}\n{{- 'SYSTEM' }}\n{%- if tools %}\n {%- if messages[0].role == 'system' %}\n {{- messages[0].content + '\\n' }}\n {%- endif %}\n {{- \"# Tools\\n\\nYou may call one or more functions to assist with the user query.\\n\\nYou are provided with function signatures within XML tags:\\n\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\\n\\n\\nIf none of the functions can be used, point it out. If the given question lacks the parameters required by the function, also point it out.\\nIf you need to use a function, for each function call, output the function name and arguments within the following XML format:\\n{function-name}\\n{arg-key-1}\\n{arg-value-1}\\n{arg-key-2}\\n{arg-value-2}\\n...\\n\\n\" }}\n {%- if messages[0].role == 'system' and messages[0].content is string and ('detailed thinking on' in messages[0].content or 'detailed thinking off' in messages[0].content) %}\n {{- '' }}\n {%- else %}\n {{- 'detailed thinking ' + thinking_option + '' }}\n {%- endif %}\n{%- else %}\n {%- if messages[0].role == 'system' %}\n {%- if 'detailed thinking on' in messages[0].content or 'detailed thinking off' in messages[0].content %}\n {{- messages[0].content + '' }}\n {%- else %}\n {{- messages[0].content + '\\n' }}\n {{- 'detailed thinking ' + thinking_option + '' }}\n {%- endif %}\n {% else %}\n {{- 'detailed thinking ' + thinking_option + '' }}\n {%- endif %}\n{%- endif %}\n{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}\n{%- for message in messages[::-1] %}\n {%- set index = (messages|length - 1) - loop.index0 %}\n {%- if ns.multi_step_tool and message.role == \"user\" and message.content is string and not(message.content.startswith('') and message.content.endswith('')) %}\n {%- set ns.multi_step_tool = false %}\n {%- set ns.last_query_index = index %}\n {%- endif %}\n{%- endfor %}\n{%- for message in messages %}\n {%- if message.content is string %}\n {%- set content = message.content %}\n {%- else %}\n {%- set content = '' %}\n {%- endif %}\n {%- if message.role == \"user\" %}\n {{- 'HUMAN' + message.content + '' }}\n {%- elif message.role == \"system\" and not loop.first %}\n {{- 'SYSTEM' + message.content + '' }}\n {%- elif message.role == \"assistant\" %}\n {%- set reasoning_content = '' %}\n {%- if message.reasoning_content is string and message.reasoning_content != '' %}\n {%- set reasoning_content = message.reasoning_content %}\n {%- else %}\n {%- if '' in content %}\n {%- set reasoning_content = content.split('')[0].rstrip('\\n').split('')[-1].lstrip('\\n') %}\n {%- set content = content.split('')[-1].lstrip('\\n') %}\n {%- endif %}\n {%- endif %}\n {%- if preserved_thinking or loop.index0 > ns.last_query_index %}\n {%- if reasoning_content != '' %}\n {{- 'ASSISTANT' + '\\n' + reasoning_content.strip('\\n') + '' + content.lstrip('\\n') }}\n {%- else %}\n {{- 'ASSISTANT\\n' + content }}\n {%- endif %}\n {%- else %}\n {{- 'ASSISTANT\\n' + content }}\n {%- endif %}\n {%- if message.tool_calls %}\n {%- for tool_call in message.tool_calls %}\n {%- if (loop.first and content) or (not loop.first) %}\n {{- '\\n' }}\n {%- endif %}\n {%- set tc = tool_call %}\n {%- if tool_call.function %}\n {%- set tc = tool_call.function %}\n {%- endif %}\n {{- '' + tc.name }}\n {% set _args = tc.arguments %}\n {%- for k, v in _args.items() %}\n {{- '' + k + '' }}\n {{- '\\n' }}\n {%- if v is string %}\n {{- v }}\n {%- else %}\n {{- v | tojson(ensure_ascii=False) }}\n {%- endif %}\n {{- '' }}\n {%- endfor %}\n {{- '\\n' }}\n {%- endfor %}\n {%- endif %}\n {{- '' }}\n {%- elif message.role == \"tool\" %}\n {%- if loop.first or (messages[loop.index0 - 1].role != \"tool\") %}\n {{- 'OBSERVATION' }}\n {%- endif %}\n {{- '\\n\\n' }}\n {{- content }}\n {{- '\\n' }}\n {%- if loop.last or (messages[loop.index0 + 1].role != \"tool\") %}\n {{- '' }}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n\n{#- ==================== generation prompt ==================== -#}\n{%- if add_generation_prompt %}\n {{- 'ASSISTANT' }}\n {%- if thinking_option == 'on' %}\n {{- '\\n' }}\n {%- elif thinking_option == 'off' %}\n {{- '\\n' }}\n {%- endif %}\n{%- endif...

content endif message messages thinking else

Related Articles