singleheart commited on
Commit
afd9c10
·
verified ·
1 Parent(s): 21f4bfc

Upload chat_template.jinja with huggingface_hub

Browse files
Files changed (1) hide show
  1. chat_template.jinja +88 -0
chat_template.jinja ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- if tools is iterable and tools | length > 0 %}
2
+ {{- '<|im_start|>system
3
+ '}}
4
+ {{- '당신은 도구 호출 기능을 갖춘 유용한 도우미입니다. 사용자의 요청을 처리하기 위해서 필요한 도구가 주어진 목록에 있는 경우 도구 호출로 응답하세요.
5
+ 필요한 도구가 목록에 없는 경우에는 도구 호출 없이 사용자가 요구한 정보를 제공하세요.
6
+ 필요한 도구가 목록에 있지만 해당 도구를 호출하는데 필요한 argument 정보가 부족한 경우 해당 정보를 사용자에게 요청하세요.
7
+ 사용자의 요청을 처리하기 위해 여러번 도구를 호출할 수 있어야 합니다.
8
+ 도구 호출 이후 도구 실행 결과를 입력으로 받으면 해당 결과를 활용하여 답변을 생성하세요.
9
+
10
+ 다음은 접근할 수 있는 도구들의 목록 입니다:
11
+ <tools>
12
+ '}}
13
+ {%- for t in tools %}
14
+ {{- t | tojson }}
15
+ {{- '
16
+ ' }}
17
+ {%- endfor %}
18
+ {{- '</tools>' }}
19
+ {{- '
20
+
21
+ 도구를 호출하려면 아래의 JSON으로 응답하세요.
22
+ 도구 호출 형식: <tool_call>{"name": 도구 이름, "arguments": dictionary 형태의 도구 인자값}</tool_call>' }}
23
+ {{- '<|im_end|>
24
+ ' }}
25
+ {%- endif %}
26
+
27
+ {%- for message in messages %}
28
+ {%- if message.role == 'system' %}
29
+ {{- '<|im_start|>system
30
+ ' + message.content + '<|im_end|>
31
+ '}}
32
+ {%- elif message.role == 'user' %}
33
+ {{- '<|im_start|>user
34
+ ' + message.content + '<|im_end|>
35
+ '}}
36
+ {%- elif message.role == 'assistant' %}
37
+ {{- '<|im_start|>assistant
38
+ '}}
39
+ {%- set content = '' %}
40
+ {%- if message.content is defined %}
41
+ {%- set content = message.content %}
42
+ {%- endif %}
43
+
44
+ {%- if add_generation_prompt and not (message.reasoning_content is defined and message.reasoning_content is not none) %}
45
+ {%- if '</think>' in message.content %}
46
+ {%- set content = message.content.split('</think>'.strip())[-1].lstrip('\n') %}
47
+ {%- endif %}
48
+ {%- endif %}
49
+
50
+ {{- content}}
51
+ {%- if message.tool_calls is defined %}
52
+ {%- for tool_call in message.tool_calls %}
53
+ {%- if tool_call.function is defined %}
54
+ {%- set tool_call = tool_call.function %}
55
+ {%- endif %}
56
+ {{- '<tool_call>' }}
57
+ {{- '{' }}
58
+ {{- '"name": "' }}
59
+ {{- tool_call.name }}
60
+ {{- '"' }}
61
+ {%- if tool_call.arguments is defined %}
62
+ {{- ', ' }}
63
+ {{- '"arguments": ' }}
64
+ {{- tool_call.arguments|tojson }}
65
+ {%- endif %}
66
+ {{- '}' }}
67
+ {{- '</tool_call>' }}
68
+ {%- endfor %}
69
+ {%- endif %}
70
+ {{- '<|im_end|>
71
+ '}}
72
+
73
+ {%- elif message.role == 'tool' %}
74
+ {{- '<|im_start|>user
75
+ <tool_response>' + message.content + '</tool_response><|im_end|>
76
+ '}}
77
+ {%- endif %}
78
+ {%- endfor %}
79
+
80
+ {%- if add_generation_prompt %}
81
+ {{- '<|im_start|>assistant
82
+ ' }}
83
+ {%- if enable_thinking is defined and enable_thinking is true %}
84
+ {{- '<think>' }}
85
+ {%- else %}
86
+ {{- '</think>' }}
87
+ {%- endif %}
88
+ {%- endif %}