Add a response template and fix tool calls with null content

#8
by Rocketknight1 HF Staff - opened
Files changed (2) hide show
  1. chat_template.jinja +1 -1
  2. tokenizer_config.json +48 -1
chat_template.jinja CHANGED
@@ -42,7 +42,7 @@ For each function call, output the function name and arguments within the follow
42
  {{- item }}
43
  {%- endif -%}
44
  {%- endfor -%}
45
- {%- else -%}
46
  {{- content }}
47
  {%- endif -%}
48
  {%- endmacro -%}
 
42
  {{- item }}
43
  {%- endif -%}
44
  {%- endfor -%}
45
+ {%- elif content is not none -%}
46
  {{- content }}
47
  {%- endif -%}
48
  {%- endmacro -%}
tokenizer_config.json CHANGED
@@ -29,5 +29,52 @@
29
  "pad_token": "<|endoftext|>",
30
  "padding_side": "left",
31
  "remove_space": false,
32
- "tokenizer_class": "TokenizersBackend"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  }
 
29
  "pad_token": "<|endoftext|>",
30
  "padding_side": "left",
31
  "remove_space": false,
32
+ "tokenizer_class": "TokenizersBackend",
33
+ "response_template": {
34
+ "defaults": {
35
+ "role": "assistant"
36
+ },
37
+ "start_anchor": "<|assistant|>",
38
+ "fields": {
39
+ "reasoning_content": {
40
+ "open_pattern": "<think>|(?=</think>)",
41
+ "close_pattern": "</think>|(?=<tool_call>)",
42
+ "content": "text",
43
+ "content_args": {
44
+ "strip": true
45
+ },
46
+ "repeats": true,
47
+ "join": ""
48
+ },
49
+ "tool_calls": {
50
+ "open_pattern": "\\s*<tool_call>\\s*(?P<name>[^<]*?)\\s*(?=<arg_key>|</tool_call>)",
51
+ "close": "</tool_call>",
52
+ "repeats": true,
53
+ "content": "xml-inline",
54
+ "content_args": {
55
+ "tag_pattern": "<arg_key>\\s*(?P<key>.*?)\\s*</arg_key>\\s*<arg_value>(?P<value>.*?)</arg_value>"
56
+ },
57
+ "transform": {
58
+ "type": "function",
59
+ "function": {
60
+ "name": "{name}",
61
+ "arguments": "{content}"
62
+ }
63
+ }
64
+ },
65
+ "content": {
66
+ "close": [
67
+ "<|user|>",
68
+ "<|observation|>",
69
+ "<|endoftext|>"
70
+ ],
71
+ "content": "text",
72
+ "content_args": {
73
+ "strip": false
74
+ },
75
+ "repeats": true,
76
+ "join": ""
77
+ }
78
+ }
79
+ }
80
  }