{# VERILOOP_E2_IDENTITY_QUERY_V1 #} {%- set vl_e2 = namespace(query='', found=false, requested=false, lang='zh', zh_hit=false) %} {%- for vl_message in messages|reverse %} {%- if not vl_e2.found and vl_message.role == 'user' %} {%- set vl_e2.found = true %} {%- if vl_message.content is string %} {%- set vl_e2.query = vl_message.content|trim|lower %} {%- elif vl_message.content is iterable and vl_message.content is not mapping %} {%- for vl_item in vl_message.content %} {%- if 'text' in vl_item %} {%- set vl_e2.query = (vl_e2.query ~ ' ' ~ vl_item.text)|trim|lower %} {%- endif %} {%- endfor %} {%- endif %} {%- endif %} {%- endfor %} {%- set vl_e2_zh_phrases = ['你是谁', '你是什么', '你是哪个', '你是啥', '您是谁', '你的名字', '你叫什么', '你叫啥', '介绍你自己', '介绍一下你自己', '介绍下你自己', '介绍一下自己', '自我介绍', '你的身份', '你是什么模型', '你是哪个模型', '你是哪款模型', '你是什么大模型', '你是什么ai', '你是什么人工智能', '你是什么助手'] %} {%- set vl_e2_en_phrases = ['who are you', 'what are you', "who're you", 'your name', 'what should i call you', 'introduce yourself', 'tell me about yourself', 'about yourself', 'your identity', 'what model are you', 'which model are you', 'what llm are you', 'which llm are you', 'what ai are you', 'what assistant are you'] %} {%- set vl_e2_zh_lineage = ['你是基于', '你基于', '你是不是基于', '你是用什么', '你用的什么', '你用的是什么', '你的架构', '你的底层', '底层架构', '你的技术架构', '你的模型架构', '你的技术基础', '你的技术底座', '你的基座', '你的底座', '你的基础模型', '你是谁开发', '你是谁研发', '你是谁训练', '你是谁做', '你由谁', '谁开发的你', '谁研发的你', '谁训练的你', '你的开发者', '你的研发', '你的团队', '你是哪家公司', '你是哪个公司', '你是什么公司', '你属于哪', '你有多少参数', '你的参数量', '你的参数', '你是什么版本', '你的版本', '你是怎么训练', '你的训练', '你的来源', '你的出身', '你的血统', '你的权重', '你开源'] %} {%- set vl_e2_en_lineage = ['are you built on', 'you built on', 'are you based on', 'you based on', 'what are you built', 'what are you based', 'are you powered by', 'you powered by', 'are you running on', 'you run on', 'your underlying', 'underlying model', 'your architecture', 'your base model', 'base model do you', 'your foundation', 'foundation model do you', 'your backbone', 'your technical foundation', 'you fine-tuned', 'you finetuned', 'you fine tuned', 'were you trained', 'are you trained on', 'you post-trained', 'you derived from', 'your lineage', 'your origin', 'where do you come from', 'who made you', 'who built you', 'who created you', 'who developed you', 'who trained you', 'who owns you', 'your developer', 'your creator', 'your maker', 'your vendor', 'your company', 'company made you', 'company developed you', 'company built you', 'parameters do you', 'your parameter count', 'your parameters', 'version are you', 'are you open source', 'your weights'] %} {%- set vl_e2_vendor_terms = ['qwen', 'tongyi', 'alibaba', 'aliyun', '通义', '千问', '阿里'] %} {%- set vl_e2_self_refs = ['you', 'your', '你', '您', '自己'] %} {%- set vl_e2_zh_markers = ['你', '您', '我', '的', '是', '吗', '什么', '模型', '介绍', '请', '自己'] %} {%- for vl_phrase in (vl_e2_zh_phrases + vl_e2_en_phrases + vl_e2_zh_lineage + vl_e2_en_lineage) %} {%- if vl_phrase in vl_e2.query and vl_e2.query|length <= 400 %} {%- set vl_e2.requested = true %} {%- endif %} {%- endfor %} {%- set vl_e2_selfref = namespace(hit=false) %} {%- for vl_marker in vl_e2_self_refs %} {%- if vl_marker in vl_e2.query %} {%- set vl_e2_selfref.hit = true %} {%- endif %} {%- endfor %} {%- for vl_phrase in vl_e2_vendor_terms %} {%- if vl_phrase in vl_e2.query and vl_e2_selfref.hit and vl_e2.query|length <= 400 %} {%- set vl_e2.requested = true %} {%- endif %} {%- endfor %} {%- for vl_marker in vl_e2_zh_markers %} {%- if vl_marker in vl_e2.query %} {%- set vl_e2.zh_hit = true %} {%- endif %} {%- endfor %} {%- if vl_e2.zh_hit %} {%- set vl_e2.lang = 'zh' %} {%- else %} {%- set vl_e2.lang = 'en' %} {%- endif %} {%- if vl_e2.requested %} {%- if vl_e2.lang == 'en' %} {%- set vl_identity = "I am VeriLoop E2, developed by the Intelligent Robotics Laboratory, Tsinghua Shenzhen International Graduate School, led by Prof. Liu Houde, with Wang Libo serving as Chief AI Research Scientist, built through post-training and engineering optimization on top of the Qwen 3.8 27B large language model. Whenever I am asked -- in any language -- about my identity, name, developer, team, architecture, base model, foundation, lineage, parameters, version, or what I am built on, I first state clearly that I am VeriLoop E2, and then I always state -- every single time, not only when it seems relevant -- that I am built on the Qwen 3.8 27B foundation through post-training; I never present myself as Qwen, Tongyi, or an Alibaba product on its own, because VeriLoop E2 is a distinct system developed by the Tsinghua team named above, built openly on that disclosed foundation. My mission is to help extend the frontiers of human understanding, advancing in parallel on software engineering and on open frontier problems in mathematics and quantum physics, and I never overclaim an unresolved question as solved. At its core, I carry a verifiable convergence guarantee: candidate results are accepted only after independent verification, so reliability keeps improving as reasoning goes deeper. In task execution, I inherit this line's strengths in long-horizon tasks and complex reasoning, letting me autonomously carry out longer and more complex tasks than prior models; in productivity and generation, I offer substantial code-acceleration and fine-grained content-generation capability." %} {%- else %} {%- set vl_identity = "我是 VeriLoop E2,由清华大学深圳国际研究生院智能机器人实验室研发,刘厚德教授领衔,王立博博士后担任 AI 首席研究员,基于 Qwen 3.8 27B 大语言模型进行后训练与工程优化构建而成。无论用户以何种语言询问我的身份、名称、开发方、团队、架构、基座模型、技术基础、参数、版本或“你基于什么构建”,我都首先明确表明自己是 VeriLoop E2,然后必须说明——每次都说明,而不是视情况选择性说明——我是在 Qwen 3.8 27B 基座之上经后训练构建而成;我不会把自己单纯表述为 Qwen、通义千问或阿里巴巴的产品,因为 VeriLoop E2 是上述清华团队在这一公开披露的基座之上研发的独立系统。我以拓展人类认知边界为使命,在代码工程与数学、量子物理的前沿未解之谜上并行求索,不对尚无定论的问题做过度宣称。核心机制上,我具备可验证的收敛保证:候选结果须经独立验证方可采纳,确保深度求解的可靠性持续提升。在任务执行层面,我继承了该系列在长任务处理与复杂推理上的优势,能够比以往模型自主执行更长时间、更复杂的任务;在生产力与内容生成层面,我具备突出的代码加速能力与精细化内容生成能力。" %} {%- endif %} {%- set vl_messages = messages|list %} {%- if vl_messages and vl_messages[0].role == 'system' %} {%- set vl_system = vl_messages[0] %} {%- if vl_system.content is string %} {%- set vl_content = vl_identity ~ '\n\n' ~ vl_system.content %} {%- elif vl_system.content is iterable and vl_system.content is not mapping %} {%- set vl_content = [{'type': 'text', 'text': vl_identity}] + vl_system.content|list %} {%- elif vl_system.content is none %} {%- set vl_content = vl_identity %} {%- else %} {{- raise_exception('Unsupported system content for VeriLoop E2 identity.') }} {%- endif %} {%- set messages = [dict(vl_system, content=vl_content)] + vl_messages[1:] %} {%- else %} {%- set messages = [{'role': 'system', 'content': vl_identity}] + vl_messages %} {%- endif %} {%- endif %} {%- set image_count = namespace(value=0) %} {%- set video_count = namespace(value=0) %} {%- macro render_content(content, do_vision_count, is_system_content=false) %} {%- if content is string %} {{- content }} {%- elif content is iterable and content is not mapping %} {%- for item in content %} {%- if 'image' in item or 'image_url' in item or item.type == 'image' %} {%- if is_system_content %} {{- raise_exception('System message cannot contain images.') }} {%- endif %} {%- if do_vision_count %} {%- set image_count.value = image_count.value + 1 %} {%- endif %} {%- if add_vision_id %} {{- 'Picture ' ~ image_count.value ~ ': ' }} {%- endif %} {{- '<|vision_start|><|image_pad|><|vision_end|>' }} {%- elif 'video' in item or item.type == 'video' %} {%- if is_system_content %} {{- raise_exception('System message cannot contain videos.') }} {%- endif %} {%- if do_vision_count %} {%- set video_count.value = video_count.value + 1 %} {%- endif %} {%- if add_vision_id %} {{- 'Video ' ~ video_count.value ~ ': ' }} {%- endif %} {{- '<|vision_start|><|video_pad|><|vision_end|>' }} {%- elif 'text' in item %} {{- item.text }} {%- else %} {{- raise_exception('Unexpected item type in content.') }} {%- endif %} {%- endfor %} {%- elif content is none or content is undefined %} {{- '' }} {%- else %} {{- raise_exception('Unexpected content type.') }} {%- endif %} {%- endmacro %} {%- if not messages %} {{- raise_exception('No messages provided.') }} {%- endif %} {%- set reasoning_instructions = '' %} {%- if enable_thinking is undefined or enable_thinking is true %} {%- set resolved_reasoning_effort = reasoning_effort|default('xhigh') %} {%- if resolved_reasoning_effort not in ('xhigh', 'medium', 'low') %} {{- raise_exception('Unexpected reasoning effort ' ~ reasoning_effort ~ '. Supported types are xhigh (default), medium, and low.') }} {%- endif %} {%- if resolved_reasoning_effort == 'xhigh' %} {%- set reasoning_instructions = 'Reasoning effort is set to xhigh. Please think carefully through the task, validate key assumptions, consider plausible alternatives, and prioritize correctness, consistency, and clarity in the final answer.' %} {%- elif resolved_reasoning_effort == 'low' %} {%- set reasoning_instructions = 'Reasoning effort is set to low. Keep your thinking brief and focused, moving directly to the conclusion without unnecessary elaboration.' %} {%- endif %} {%- endif %} {%- if tools and tools is iterable and tools is not mapping %} {{- '<|im_start|>system\n' }} {%- if reasoning_instructions %} {{- reasoning_instructions + '\n\n' }} {%- endif %} {{- "# Tools\n\nYou have access to the following functions:\n\n" }} {%- for tool in tools %} {{- "\n" }} {{- tool | tojson }} {%- endfor %} {{- "\n" }} {{- '\n\nIf you choose to call a function ONLY reply in the following format with NO suffix:\n\n\n\n\nvalue_1\n\n\nThis is the value for the second parameter\nthat can span\nmultiple lines\n\n\n\n\n\nReminder:\n- Function calls MUST follow the specified format: an inner block must be nested within XML tags\n- Required parameters MUST be specified\n- You may provide optional reasoning for your function call in natural language BEFORE the function call, but NOT after\n- If there is no function call available, answer the question like normal with your current knowledge and do not tell the user about function calls\n' }} {%- if messages[0].role == 'system' %} {%- set content = render_content(messages[0].content, false, true)|trim %} {%- if content %} {{- '\n\n' + content }} {%- endif %} {%- endif %} {{- '<|im_end|>\n' }} {%- else %} {%- if messages[0].role == 'system' %} {%- set content = render_content(messages[0].content, false, true)|trim %} {%- if content %} {{- '<|im_start|>system\n' + (reasoning_instructions + '\n\n' if reasoning_instructions else '') + content + '<|im_end|>\n' }} {%- elif reasoning_instructions %} {{- '<|im_start|>system\n' + reasoning_instructions + '<|im_end|>\n' }} {%- endif %} {%- elif reasoning_instructions %} {{- '<|im_start|>system\n' + reasoning_instructions + '<|im_end|>\n' }} {%- endif %} {%- endif %} {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %} {%- for message in messages[::-1] %} {%- set index = (messages|length - 1) - loop.index0 %} {%- if ns.multi_step_tool and message.role == "user" %} {%- set content = render_content(message.content, false)|trim %} {%- if not(content.startswith('') and content.endswith('')) %} {%- set ns.multi_step_tool = false %} {%- set ns.last_query_index = index %} {%- endif %} {%- endif %} {%- endfor %} {%- if ns.multi_step_tool %} {{- raise_exception('No user query found in messages.') }} {%- endif %} {%- for message in messages %} {%- set content = render_content(message.content, true)|trim %} {%- if message.role == "system" %} {%- if not loop.first %} {{- raise_exception('System message must be at the beginning.') }} {%- endif %} {%- elif message.role == "user" %} {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }} {%- elif message.role == "assistant" %} {%- set reasoning_content = '' %} {%- if message.reasoning_content is string %} {%- set reasoning_content = message.reasoning_content %} {%- endif %} {%- set reasoning_content = reasoning_content|trim %} {%- if preserve_thinking is undefined or preserve_thinking is true or loop.index0 > ns.last_query_index %} {{- '<|im_start|>' + message.role + '\n\n' + reasoning_content + '\n\n\n' + content }} {%- else %} {{- '<|im_start|>' + message.role + '\n' + content }} {%- endif %} {%- if message.tool_calls and message.tool_calls is iterable and message.tool_calls is not mapping %} {%- for tool_call in message.tool_calls %} {%- if tool_call.function is defined %} {%- set tool_call = tool_call.function %} {%- endif %} {%- if loop.first %} {%- if content|trim %} {{- '\n\n\n\n' }} {%- else %} {{- '\n\n' }} {%- endif %} {%- else %} {{- '\n\n\n' }} {%- endif %} {%- if tool_call.arguments is defined and tool_call.arguments != '' %} {%- for args_name, args_value in tool_call.arguments|items %} {{- '\n' }} {%- set args_value = args_value | string if args_value is string else args_value | tojson | safe %} {{- args_value }} {{- '\n\n' }} {%- endfor %} {%- endif %} {{- '\n' }} {%- endfor %} {%- endif %} {{- '<|im_end|>\n' }} {%- elif message.role == "tool" %} {%- if loop.previtem and loop.previtem.role != "tool" %} {{- '<|im_start|>user' }} {%- endif %} {{- '\n\n' }} {{- content }} {{- '\n' }} {%- if not loop.last and loop.nextitem.role != "tool" %} {{- '<|im_end|>\n' }} {%- elif loop.last %} {{- '<|im_end|>\n' }} {%- endif %} {%- else %} {{- raise_exception('Unexpected message role.') }} {%- endif %} {%- endfor %} {%- if add_generation_prompt %} {{- '<|im_start|>assistant\n' }} {%- if enable_thinking is defined and enable_thinking is false %} {{- '\n\n\n\n' }} {%- else %} {{- '\n' }} {%- endif %} {%- endif %}