AdvancedMage commited on
Commit
23e4df4
·
verified ·
1 Parent(s): c52f808

Update chat_template.jinja

Browse files

Update the tool call parsing format according to

@liopen
in this [issue](https://huggingface.co/moonshotai/Kimi-K2-Instruct/discussions/48).

Files changed (1) hide show
  1. chat_template.jinja +1 -2
chat_template.jinja CHANGED
@@ -21,8 +21,7 @@
21
  {%- if message['content'] -%}{{ message['content'] }}{%- endif -%}
22
  <|tool_calls_section_begin|>
23
  {%- for tool_call in message['tool_calls'] -%}
24
- {%- set formatted_id = tool_call['id'] -%}
25
- <|tool_call_begin|>{{ formatted_id }}<|tool_call_argument_begin|>{% if tool_call['function']['arguments'] is string %}{{ tool_call['function']['arguments'] }}{% else %}{{ tool_call['function']['arguments'] | tojson }}{% endif %}<|tool_call_end|>
26
  {%- endfor -%}
27
  <|tool_calls_section_end|>
28
  {%- elif message['role'] == 'tool' -%}
 
21
  {%- if message['content'] -%}{{ message['content'] }}{%- endif -%}
22
  <|tool_calls_section_begin|>
23
  {%- for tool_call in message['tool_calls'] -%}
24
+ <|tool_call_begin|>functions.{{ tool_call['function']['name'] }}:{{ loop.index }}<|tool_call_argument_begin|>{% if tool_call['function']['arguments'] is string %}{{ tool_call['function']['arguments'] }}{% else %}{{ tool_call['function']['arguments'] | tojson }}{% endif %}<|tool_call_end|>
 
25
  {%- endfor -%}
26
  <|tool_calls_section_end|>
27
  {%- elif message['role'] == 'tool' -%}