ONNX
llama
Xenova HF Staff commited on
Commit
c2c8b7a
·
verified ·
1 Parent(s): cdc49b0

Upload folder using huggingface_hub

Browse files
.gitattributes CHANGED
@@ -33,3 +33,23 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ onnx/model.onnx_data filter=lfs diff=lfs merge=lfs -text
37
+ onnx/model.onnx_data_1 filter=lfs diff=lfs merge=lfs -text
38
+ onnx/model.onnx_data_2 filter=lfs diff=lfs merge=lfs -text
39
+ onnx/model.onnx_data_3 filter=lfs diff=lfs merge=lfs -text
40
+ onnx/model.onnx_data_4 filter=lfs diff=lfs merge=lfs -text
41
+ onnx/model.onnx_data_5 filter=lfs diff=lfs merge=lfs -text
42
+ onnx/model.onnx_data_6 filter=lfs diff=lfs merge=lfs -text
43
+ onnx/model.onnx_data_7 filter=lfs diff=lfs merge=lfs -text
44
+ onnx/model_fp16.onnx_data filter=lfs diff=lfs merge=lfs -text
45
+ onnx/model_fp16.onnx_data_1 filter=lfs diff=lfs merge=lfs -text
46
+ onnx/model_fp16.onnx_data_2 filter=lfs diff=lfs merge=lfs -text
47
+ onnx/model_fp16.onnx_data_3 filter=lfs diff=lfs merge=lfs -text
48
+ onnx/model_q4.onnx_data filter=lfs diff=lfs merge=lfs -text
49
+ onnx/model_q4.onnx_data_1 filter=lfs diff=lfs merge=lfs -text
50
+ onnx/model_q4f16.onnx_data filter=lfs diff=lfs merge=lfs -text
51
+ onnx/model_q4f16.onnx_data_1 filter=lfs diff=lfs merge=lfs -text
52
+ onnx/model_quantized.onnx_data filter=lfs diff=lfs merge=lfs -text
53
+ onnx/model_quantized.onnx_data_1 filter=lfs diff=lfs merge=lfs -text
54
+ onnx/model_quantized.onnx_data_2 filter=lfs diff=lfs merge=lfs -text
55
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
chat_template.jinja ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ {%- if tools %}
3
+ {{- '<|im_start|>system
4
+ ' }}
5
+ {%- if messages[0].role == 'system' %}
6
+ {{- messages[0].content + '
7
+
8
+ ' }}
9
+ {%- else %}
10
+ {{- '你是一位工具函数调用专家,你会得到一个问题和一组可能的工具函数。根据问题,你需要进行一个或多个函数/工具调用以实现目的,请尽量尝试探索通过工具解决问题。
11
+ 如果没有一个函数可以使用,请直接使用自然语言回复用户。
12
+ 如果给定的问题缺少函数所需的参数,请使用自然语言进行提问,向用户询问必要信息。
13
+ 如果调用结果已经足够回答用户问题,请对历史结果进行总结,使用自然语言回复用户。' }}
14
+ {%- endif %}
15
+ {{- "# Tools
16
+
17
+ You may call one or more functions to assist with the user query.
18
+
19
+ You are provided with function signatures within <tools></tools> XML tags:
20
+ <tools>" }}
21
+ {%- for tool in tools %}
22
+ {{- "
23
+ " }}
24
+ {{- tool | tojson }}
25
+ {%- endfor %}
26
+ {{- "
27
+ </tools>
28
+
29
+ For each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:
30
+ <tool_call>
31
+ {\"name\": <function-name>, \"arguments\": <args-json-object>}
32
+ </tool_call><|im_end|>
33
+ " }}
34
+ {%- else %}
35
+ {%- if messages[0].role == 'system' %}
36
+ {{- '<|im_start|>system
37
+ ' + messages[0].content + '<|im_end|>
38
+ ' }}
39
+ {%- else %}
40
+ {{- '<|im_start|>system
41
+ 你是南北阁,一款由BOSS直聘自主研发并训练的专业大语言模型。<|im_end|>
42
+ ' }}
43
+ {%- endif %}
44
+ {%- endif %}
45
+ {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
46
+ {%- for message in messages[::-1] %}
47
+ {%- set index = (messages|length - 1) - loop.index0 %}
48
+ {%- if ns.multi_step_tool and message.role == "user" and message.content is string and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}
49
+ {%- set ns.multi_step_tool = false %}
50
+ {%- set ns.last_query_index = index %}
51
+ {%- endif %}
52
+ {%- endfor %}
53
+ {%- for message in messages %}
54
+ {%- if message.content is string %}
55
+ {%- set content = message.content %}
56
+ {%- else %}
57
+ {%- set content = '' %}
58
+ {%- endif %}
59
+ {%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
60
+ {{- '<|im_start|>' + message.role + '
61
+ ' + content + '<|im_end|>' + '
62
+ ' }}
63
+ {%- elif message.role == "assistant" %}
64
+ {%- set reasoning_content = '' %}
65
+ {%- if message.reasoning_content is string %}
66
+ {%- set reasoning_content = message.reasoning_content %}
67
+ {%- else %}
68
+ {%- if '</think>' in content %}
69
+ {%- set reasoning_content = content.split('</think>')[0].rstrip('
70
+ ').split('<think>')[-1].lstrip('
71
+ ') %}
72
+ {%- set content = content.split('</think>')[-1].lstrip('
73
+ ') %}
74
+ {%- endif %}
75
+ {%- endif %}
76
+ {%- if loop.index0 > ns.last_query_index or keep_all_think or (extra_body is defined and extra_body.keep_all_think) %}
77
+ {%- if loop.last or (not loop.last and reasoning_content) %}
78
+ {{- '<|im_start|>' + message.role + '
79
+ <think>
80
+ ' + reasoning_content.strip('
81
+ ') + '
82
+ </think>
83
+
84
+ ' + content.lstrip('
85
+ ') }}
86
+ {%- else %}
87
+ {{- '<|im_start|>' + message.role + '
88
+ ' + content }}
89
+ {%- endif %}
90
+ {%- else %}
91
+ {{- '<|im_start|>' + message.role + '
92
+ ' + content }}
93
+ {%- endif %}
94
+ {%- if message.tool_calls %}
95
+ {%- for tool_call in message.tool_calls %}
96
+ {%- if (loop.first and content) or (not loop.first) %}
97
+ {{- '
98
+ ' }}
99
+ {%- endif %}
100
+ {%- if tool_call.function %}
101
+ {%- set tool_call = tool_call.function %}
102
+ {%- endif %}
103
+ {{- '<tool_call>
104
+ {"name": "' }}
105
+ {{- tool_call.name }}
106
+ {{- '", "arguments": ' }}
107
+ {%- if tool_call.arguments is string %}
108
+ {{- tool_call.arguments }}
109
+ {%- else %}
110
+ {{- tool_call.arguments | tojson }}
111
+ {%- endif %}
112
+ {{- '}
113
+ </tool_call>' }}
114
+ {%- endfor %}
115
+ {%- endif %}
116
+ {{- '<|im_end|>
117
+ ' }}
118
+ {%- elif message.role == "tool" %}
119
+ {%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
120
+ {{- '<|im_start|>user' }}
121
+ {%- endif %}
122
+ {{- '
123
+ <tool_response>
124
+ ' }}
125
+ {{- content }}
126
+ {{- '
127
+ </tool_response>' }}
128
+ {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
129
+ {{- '<|im_end|>
130
+ ' }}
131
+ {%- endif %}
132
+ {%- endif %}
133
+ {%- endfor %}
134
+ {%- if add_generation_prompt %}
135
+ {{- '<|im_start|>assistant
136
+ ' }}
137
+ {%- endif %}
config.json ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "LlamaForCausalLM"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "bos_token_id": 166100,
8
+ "dtype": "bfloat16",
9
+ "embd_pdrop": 0.0,
10
+ "eos_token_id": 166101,
11
+ "head_dim": 128,
12
+ "hidden_act": "silu",
13
+ "hidden_size": 2560,
14
+ "initializer_range": 0.02,
15
+ "intermediate_size": 10496,
16
+ "max_position_embeddings": 262144,
17
+ "mlp_bias": false,
18
+ "model_type": "llama",
19
+ "num_attention_heads": 20,
20
+ "num_hidden_layers": 32,
21
+ "num_key_value_heads": 4,
22
+ "pad_token_id": 0,
23
+ "pretraining_tp": 1,
24
+ "resid_pdrop": 0.0,
25
+ "rms_norm_eps": 1e-05,
26
+ "rope_parameters": {
27
+ "rope_theta": 70000000,
28
+ "rope_type": "default"
29
+ },
30
+ "tie_word_embeddings": false,
31
+ "transformers_version": "5.1.0",
32
+ "use_cache": true,
33
+ "vocab_size": 166144,
34
+ "transformers.js_config": {
35
+ "use_external_data_format": {
36
+ "model.onnx": 8,
37
+ "model_fp16.onnx": 4,
38
+ "model_quantized.onnx": 3,
39
+ "model_q4.onnx": 2,
40
+ "model_q4f16.onnx": 2
41
+ },
42
+ "kv_cache_dtype": {
43
+ "q4f16": "float16",
44
+ "fp16": "float16"
45
+ }
46
+ }
47
+ }
generation_config.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 166100,
4
+ "eos_token_id": 166101,
5
+ "pad_token_id": 0,
6
+ "transformers_version": "5.1.0"
7
+ }
onnx/model.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d23b485499bcf2952e7cae4c5419c40f6c411202ef271fab2688de7f48ab8bbe
3
+ size 213152
onnx/model.onnx_data ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:54fb24b5944d70b2770919a5c38bd33da3f768d9f530289b0b3ef3e498bc2bd2
3
+ size 2005946368
onnx/model.onnx_data_1 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e053253e66ac2bbcd029b1c55ef6c4cc0dfa30dbed65fa8ba3f8c3f790c85178
3
+ size 2034339840
onnx/model.onnx_data_2 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bd790d4b735e1ed06617b9b97018cc3fe18d0a24bb4cb44170a92047208dd2cb
3
+ size 2071050240
onnx/model.onnx_data_3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:28950a8945e7465a46cdbc4ff64c8f640061056c6ef792578ddb59fa1cc455ea
3
+ size 2060564480
onnx/model.onnx_data_4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4a8386b6df48f2d9bbbe4415cb963b5d5555122a4b61b8237906f93f21b30229
3
+ size 2034339840
onnx/model.onnx_data_5 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1de9b9483c3f2cee394fe0f2714e6a9c5b15f59382d8332a6c0267229e94dafc
3
+ size 2071050240
onnx/model.onnx_data_6 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:aaf7cf996e3d281429089983c8e5ca3737b4910d4cbe0ba46f480380ba96849c
3
+ size 1890160640
onnx/model.onnx_data_7 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:485e56209b04a3258897b4a4c4cf1d51381e4d0edd6ae0eaa76b5343a0c26f6e
3
+ size 1701314560
onnx/model_fp16.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f99c617e5e90f8d26a4a1d6e645bdb89088568b1e65be11989c646dd58fe1e26
3
+ size 214709
onnx/model_fp16.onnx_data ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0f16fb9da299a582960ba396e1e2fd1f4578242dc08411e81e4e03548c3bf6b9
3
+ size 2092237824
onnx/model_fp16.onnx_data_1 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c1663ebdd6bc7877a97a4b5deebc523a4751edf71d5a57db0b77722c39268e35
3
+ size 2047452160
onnx/model_fp16.onnx_data_2 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4278f38f41032fe9ef3665c3479bfaebdba7f2ec4514c53543b2d9d3e329a410
3
+ size 2065807360
onnx/model_fp16.onnx_data_3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3c8c3bbe67afa46f9b730eefdd26bd6defa5748d9b4e5af09dbab1cdf300a813
3
+ size 1728885760
onnx/model_q4.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e0f87d4334c86f0acd51b1841797fc6d727b4f13e8b2612f16ebcd699256702e
3
+ size 315867
onnx/model_q4.onnx_data ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:35714a10515ff7523f68d39909ce94410d7dadcc63c87c113d9fddc8f6608ac1
3
+ size 2083780608
onnx/model_q4.onnx_data_1 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9b29218acbe13d7653b70c2bea51e2bd571acdc139943d2c5b42164edbc8c072
3
+ size 570982400
onnx/model_q4f16.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c06e7d4ca01d1438575e4c1dfa4803f534f80a18b94016571398a7b5ceb37dd6
3
+ size 318075
onnx/model_q4f16.onnx_data ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5db01c3890fd82f3dacfef015a6d068ec10c0ddc4c6a62e8a53b8e835c5e78cc
3
+ size 2095586304
onnx/model_q4f16.onnx_data_1 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:59fdb0bd4e6dcfd7dfed0c9a8e9bf2c569adf8860ecdb2d39efa42a35b17a2ec
3
+ size 245893120
onnx/model_quantized.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8b185e3dfcc6f954ab74a1a7637d25c9ea9fb701b0327f0f29bbf88efb4a3aa9
3
+ size 321968
onnx/model_quantized.onnx_data ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7c7ac2ee520ce2ae579192f2cd71ba48be74bdf463280fa9dbde80e4200bdd99
3
+ size 2092935168
onnx/model_quantized.onnx_data_1 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2bba05c3bfc93a590289bd383f8b5c2cba2bbdd58f0bdf88db3ab7845cd9d268
3
+ size 2094039040
onnx/model_quantized.onnx_data_2 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b29acb0aacbe24ae6bca1290ec379f4c3a2840db16e5d407a12cfea5d9605860
3
+ size 495984640
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c43a56fffae38518557edf7e8f7d2b49ab972322d4447578593d110630c5ca76
3
+ size 10518000
tokenizer_config.json ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": true,
3
+ "backend": "tokenizers",
4
+ "bos_token": "<|im_start|>",
5
+ "clean_up_tokenization_spaces": false,
6
+ "eos_token": "<|im_end|>",
7
+ "is_local": false,
8
+ "legacy": true,
9
+ "model_max_length": 1000000000000000019884624838656,
10
+ "pad_token": "<unk>",
11
+ "sp_model_kwargs": {},
12
+ "spaces_between_special_tokens": false,
13
+ "tokenizer_class": "TokenizersBackend",
14
+ "unk_token": "<unk>",
15
+ "use_default_system_prompt": false,
16
+ "chat_template": "\n {%- if tools %}\n {{- '<|im_start|>system\n' }}\n {%- if messages[0].role == 'system' %}\n {{- messages[0].content + '\n\n' }}\n {%- else %} \n {{- '\u4f60\u662f\u4e00\u4f4d\u5de5\u5177\u51fd\u6570\u8c03\u7528\u4e13\u5bb6\uff0c\u4f60\u4f1a\u5f97\u5230\u4e00\u4e2a\u95ee\u9898\u548c\u4e00\u7ec4\u53ef\u80fd\u7684\u5de5\u5177\u51fd\u6570\u3002\u6839\u636e\u95ee\u9898\uff0c\u4f60\u9700\u8981\u8fdb\u884c\u4e00\u4e2a\u6216\u591a\u4e2a\u51fd\u6570/\u5de5\u5177\u8c03\u7528\u4ee5\u5b9e\u73b0\u76ee\u7684\uff0c\u8bf7\u5c3d\u91cf\u5c1d\u8bd5\u63a2\u7d22\u901a\u8fc7\u5de5\u5177\u89e3\u51b3\u95ee\u9898\u3002\n\u5982\u679c\u6ca1\u6709\u4e00\u4e2a\u51fd\u6570\u53ef\u4ee5\u4f7f\u7528\uff0c\u8bf7\u76f4\u63a5\u4f7f\u7528\u81ea\u7136\u8bed\u8a00\u56de\u590d\u7528\u6237\u3002\n\u5982\u679c\u7ed9\u5b9a\u7684\u95ee\u9898\u7f3a\u5c11\u51fd\u6570\u6240\u9700\u7684\u53c2\u6570\uff0c\u8bf7\u4f7f\u7528\u81ea\u7136\u8bed\u8a00\u8fdb\u884c\u63d0\u95ee\uff0c\u5411\u7528\u6237\u8be2\u95ee\u5fc5\u8981\u4fe1\u606f\u3002\n\u5982\u679c\u8c03\u7528\u7ed3\u679c\u5df2\u7ecf\u8db3\u591f\u56de\u7b54\u7528\u6237\u95ee\u9898\uff0c\u8bf7\u5bf9\u5386\u53f2\u7ed3\u679c\u8fdb\u884c\u603b\u7ed3\uff0c\u4f7f\u7528\u81ea\u7136\u8bed\u8a00\u56de\u590d\u7528\u6237\u3002' }} \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 <tools></tools> XML tags:\n<tools>\" }}\n {%- for tool in tools %}\n {{- \"\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\\\"name\\\": <function-name>, \\\"arguments\\\": <args-json-object>}\n</tool_call><|im_end|>\n\" }}\n {%- else %}\n {%- if messages[0].role == 'system' %}\n {{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}\n {%- else %} \n {{- '<|im_start|>system\n\u4f60\u662f\u5357\u5317\u9601\uff0c\u4e00\u6b3e\u7531BOSS\u76f4\u8058\u81ea\u4e3b\u7814\u53d1\u5e76\u8bad\u7ec3\u7684\u4e13\u4e1a\u5927\u8bed\u8a00\u6a21\u578b\u3002<|im_end|>\n' }} \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('<tool_response>') and message.content.endswith('</tool_response>')) %}\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\") or (message.role == \"system\" and not loop.first) %}\n {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}\n {%- elif message.role == \"assistant\" %}\n {%- set reasoning_content = '' %}\n {%- if message.reasoning_content is string %}\n {%- set reasoning_content = message.reasoning_content %}\n {%- else %}\n {%- if '</think>' in content %}\n {%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}\n {%- set content = content.split('</think>')[-1].lstrip('\n') %}\n {%- endif %}\n {%- endif %}\n {%- if loop.index0 > ns.last_query_index or keep_all_think or (extra_body is defined and extra_body.keep_all_think) %}\n {%- if loop.last or (not loop.last and reasoning_content) %}\n {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}\n {%- else %}\n {{- '<|im_start|>' + message.role + '\n' + content }}\n {%- endif %}\n {%- else %}\n {{- '<|im_start|>' + message.role + '\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 {%- if tool_call.function %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {{- '<tool_call>\n{\"name\": \"' }}\n {{- tool_call.name }}\n {{- '\", \"arguments\": ' }}\n {%- if tool_call.arguments is string %}\n {{- tool_call.arguments }}\n {%- else %}\n {{- tool_call.arguments | tojson }}\n {%- endif %}\n {{- '}\n</tool_call>' }}\n {%- endfor %}\n {%- endif %}\n {{- '<|im_end|>\n' }}\n {%- elif message.role == \"tool\" %}\n {%- if loop.first or (messages[loop.index0 - 1].role != \"tool\") %}\n {{- '<|im_start|>user' }}\n {%- endif %}\n {{- '\n<tool_response>\n' }}\n {{- content }}\n {{- '\n</tool_response>' }}\n {%- if loop.last or (messages[loop.index0 + 1].role != \"tool\") %}\n {{- '<|im_end|>\n' }}\n {%- endif %}\n {%- endif %}\n {%- endfor %}\n {%- if add_generation_prompt %}\n {{- '<|im_start|>assistant\n' }}\n {%- endif %}\n"
17
+ }