Upload chat_template.jinja
Browse filesfixed. jinja chat template.
- chat_template.jinja +54 -68
chat_template.jinja
CHANGED
@@ -1,72 +1,58 @@
|
|
1 |
{%- if tools is iterable and tools | length > 0 %}
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
'}}
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
'
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
๋๊ตฌ๋ฅผ ํธ์ถํ๋ ค๋ฉด ์๋์ JSON์ผ๋ก ์๋ตํ์ธ์.
|
21 |
-
๋๊ตฌ ํธ์ถ ํ์: <tool_call>{"name": ๋๊ตฌ ์ด๋ฆ, "arguments": dictionary ํํ์ ๋๊ตฌ ์ธ์๊ฐ}</tool_call>' }}
|
22 |
-
{{- '<|im_end|>' }}
|
23 |
-
{%- endif %}
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
{%- endif %}
|
36 |
-
|
37 |
-
{%- if add_generation_prompt and not (message.reasoning_content is defined and message.reasoning_content is not none) %}
|
38 |
-
{%- if '</think>' in message.content %}
|
39 |
-
{%- set content = message.content.split('</think>'.strip())[-1].lstrip('\n') %}
|
40 |
-
{%- endif %}
|
41 |
{%- endif %}
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
{%- elif message.role == 'tool' %}
|
66 |
-
{{- '<|im_start|><|extra_id_13|><tool_output>' + message.content + '</tool_output><|im_end|>'}}
|
67 |
-
{%- endif %}
|
68 |
-
{%- endfor %}
|
69 |
-
|
70 |
-
{%- if add_generation_prompt %}
|
71 |
-
{{- '<|im_start|><|assistant|>' }}
|
72 |
-
{%- endif %}
|
|
|
1 |
{%- if tools is iterable and tools | length > 0 %}
|
2 |
+
{{- '<|im_start|><|system|>'}}
|
3 |
+
{{- '๋น์ ์ ๋๊ตฌ ํธ์ถ ๊ธฐ๋ฅ์ ๊ฐ์ถ ์ ์ฉํ ๋์ฐ๋ฏธ์
๋๋ค. ์ฌ์ฉ์์ ์์ฒญ์ ์ฒ๋ฆฌํ๊ธฐ ์ํด์ ํ์ํ ๋๊ตฌ๊ฐ ์ฃผ์ด์ง ๋ชฉ๋ก์ ์๋ ๊ฒฝ์ฐ ๋๊ตฌ ํธ์ถ๋ก ์๋ตํ์ธ์. ํ์ํ ๋๊ตฌ๊ฐ ๋ชฉ๋ก์ ์๋ ๊ฒฝ์ฐ์๋ ๋๊ตฌ ํธ์ถ ์์ด ์ฌ์ฉ์๊ฐ ์๊ตฌํ ์ ๋ณด๋ฅผ ์ ๊ณตํ์ธ์. ํ์ํ ๋๊ตฌ๊ฐ ๋ชฉ๋ก์ ์์ง๋ง ํด๋น ๋๊ตฌ๋ฅผ ํธ์ถํ๋๋ฐ ํ์ํ argument ์ ๋ณด๊ฐ ๋ถ์กฑํ ๊ฒฝ์ฐ ํด๋น ์ ๋ณด๋ฅผ ์ฌ์ฉ์์๊ฒ ์์ฒญํ์ธ์. ์ฌ์ฉ์์ ์์ฒญ์ ์ฒ๋ฆฌํ๊ธฐ ์ํด ์ฌ๋ฌ๋ฒ ๋๊ตฌ๋ฅผ ํธ์ถํ ์ ์์ด์ผ ํฉ๋๋ค. ๋๊ตฌ ํธ์ถ ์ดํ ๋๊ตฌ ์คํ ๊ฒฐ๊ณผ๋ฅผ ์
๋ ฅ์ผ๋ก ๋ฐ์ผ๋ฉด ํด๋น ๊ฒฐ๊ณผ๋ฅผ ํ์ฉํ์ฌ ๋ต๋ณ์ ์์ฑํ์ธ์. ๋ค์์ ์ ๊ทผํ ์ ์๋ ๋๊ตฌ๋ค์ ๋ชฉ๋ก ์
๋๋ค: <tools>'}}
|
4 |
+
{%- for t in tools %}
|
5 |
+
{{- t | tojson }}
|
6 |
+
{{- '' }}
|
7 |
+
{%- endfor %}
|
8 |
+
{{- '</tools>' }}
|
9 |
+
{{- '๋๊ตฌ๋ฅผ ํธ์ถํ๋ ค๋ฉด ์๋์ JSON์ผ๋ก ์๋ตํ์ธ์. ๋๊ตฌ ํธ์ถ ํ์: <tool_call>{"name": ๋๊ตฌ ์ด๋ฆ, "arguments": dictionary ํํ์ ๋๊ตฌ ์ธ์๊ฐ}</tool_call>' }}
|
10 |
+
{{- '<|im_end|>' }}
|
11 |
+
{%- endif %}
|
12 |
|
13 |
+
{%- for message in messages %}
|
14 |
+
{%- if message.role == 'system' %}
|
15 |
+
{{- '<|im_start|><|system|>' + message.content + '<|im_end|>'}}
|
16 |
+
{%- elif message.role == 'user' %}
|
17 |
+
{{- '<|im_start|><|user|>' + message.content + '<|im_end|>'}}
|
18 |
+
{%- elif message.role == 'assistant' %}
|
19 |
+
{{- '<|im_start|><|assistant|>'}}
|
20 |
+
{%- set content = '' %}
|
21 |
+
{%- if message.content is defined %}
|
22 |
+
{%- set content = message.content %}
|
23 |
+
{%- endif %}
|
|
|
|
|
|
|
|
|
24 |
|
25 |
+
{%- if add_generation_prompt and not (message.reasoning_content is defined and message.reasoning_content is not none) %}
|
26 |
+
{%- if '</think>' in message.content %}
|
27 |
+
{%- set content = (message.content.split('</think>'.strip()) | last).lstrip('\n') %}
|
28 |
+
{%- endif %}
|
29 |
+
{%- endif %}
|
30 |
+
{{- content}}
|
31 |
+
{%- if message.tool_calls is defined %}
|
32 |
+
{%- for tool_call in message.tool_calls %}
|
33 |
+
{%- if tool_call.function is defined %}
|
34 |
+
{%- set tool_call = tool_call.function %}
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
{%- endif %}
|
36 |
+
{{- '<tool_call>' }}
|
37 |
+
{{- '{' }}
|
38 |
+
{{- '"name": "' }}
|
39 |
+
{{- tool_call.name }}
|
40 |
+
{{- '"' }}
|
41 |
+
{%- if tool_call.arguments is defined %}
|
42 |
+
{{- ', ' }}
|
43 |
+
{{- '"arguments": ' }}
|
44 |
+
{{- tool_call.arguments|tojson }}
|
45 |
+
{%- endif %}
|
46 |
+
{{- '}' }}
|
47 |
+
{{- '</tool_call>' }}
|
48 |
+
{%- endfor %}
|
49 |
+
{%- endif %}
|
50 |
+
{{- '<|im_end|>'}}
|
51 |
+
{%- elif message.role == 'tool' %}
|
52 |
+
{{- '<|im_start|><|extra_id_13|><tool_output>' + message.content + '</tool_output><|im_end|>'}}
|
53 |
+
{%- endif %}
|
54 |
+
{%- endfor %}
|
55 |
+
|
56 |
+
{%- if add_generation_prompt %}
|
57 |
+
{{- '<|im_start|><|assistant|>' }}
|
58 |
+
{%- endif %}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|