danielhanchen commited on
Commit
38ed3f5
·
verified ·
1 Parent(s): f8ebef3

Add files using upload-large-folder tool

Browse files
Files changed (3) hide show
  1. chat_template.jinja +58 -70
  2. config.json +1 -1
  3. tokenizer_config.json +1 -1
chat_template.jinja CHANGED
@@ -1,79 +1,51 @@
1
  {{- bos_token }}
2
- {%- if custom_tools is defined %}
3
  {%- set tools = custom_tools %}
4
  {%- endif %}
5
- {%- if not tools_in_user_message is defined %}
6
- {%- set tools_in_user_message = true %}
7
- {%- endif %}
8
- {%- if not date_string is defined %}
9
- {%- if strftime_now is defined %}
10
- {%- set date_string = strftime_now("%d %b %Y") %}
11
- {%- else %}
12
- {%- set date_string = "26 Jul 2024" %}
13
- {%- endif %}
14
- {%- endif %}
15
- {%- if not tools is defined %}
16
  {%- set tools = none %}
17
  {%- endif %}
18
 
 
19
  {#- This block extracts the system message, so we can slot it into the right place. #}
20
- {%- if messages[0]['role'] == 'system' %}
 
21
  {%- if messages[0]['content'] is string %}
22
  {%- set system_message = messages[0]['content']|trim %}
23
  {%- else %}
24
- {#- FIXME: The processor requires an array, always. #}
25
  {%- set system_message = messages[0]['content'][0]['text']|trim %}
26
  {%- endif %}
27
  {%- set messages = messages[1:] %}
28
- {%- set user_supplied_system_message = true %}
29
  {%- else %}
30
- {%- set system_message = "" %}
31
- {%- set user_supplied_system_message = false %}
 
 
 
 
 
32
  {%- endif %}
33
-
34
- {#- System message if the user supplied one #}
35
- {%- if user_supplied_system_message %}
36
  {{- "<|header_start|>system<|header_end|>\n\n" }}
37
- {%- if tools is not none %}
38
- {{- "Environment: ipython\n" }}
39
- {%- endif %}
40
- {%- if tools is not none and not tools_in_user_message %}
41
- {{- "You have access to the following functions. To call a function, please respond with JSON for a function call." }}
42
- {{- 'Respond in the format {"name": function name, "parameters": dictionary of argument name and its value}.' }}
43
- {{- "Do not use variables.\n\n" }}
44
- {%- for t in tools %}
45
- {{- t | tojson(indent=4) }}
46
- {{- "\n\n" }}
47
- {%- endfor %}
48
- {%- endif %}
49
  {{- system_message }}
 
 
 
 
 
 
50
  {{- "<|eot|>" }}
51
  {%- endif %}
52
 
53
- {#- Custom tools are passed in a user message with some extra guidance #}
54
- {%- if tools_in_user_message and not tools is none %}
55
- {#- Extract the first user message so we can plug it in here #}
56
- {%- if messages | length != 0 %}
57
- {%- set first_user_message = messages[0]['content']|trim %}
58
- {%- set messages = messages[1:] %}
59
- {%- else %}
60
- {{- raise_exception("Cannot put tools in the first user message when there's no first user message!") }}
61
- {%- endif %}
62
- {{- '<|header_start|>user<|header_end|>\n\n' -}}
63
- {{- "Given the following functions, please respond with a JSON for a function call " }}
64
- {{- "with its proper arguments that best answers the given prompt.\n\n" }}
65
- {{- 'Respond in the format {"name": function name, "parameters": dictionary of argument name and its value}.' }}
66
- {{- "Do not use variables.\n\n" }}
67
- {%- for t in tools %}
68
- {{- t | tojson(indent=4) }}
69
- {{- "\n\n" }}
70
- {%- endfor %}
71
- {{- first_user_message + "<|eot|>"}}
72
- {%- endif %}
73
-
74
  {%- for message in messages %}
75
- {%- if not (message.role == 'ipython' or message.role == 'tool' or 'tool_calls' in message) %}
76
- {{- '<|header_start|>' + message['role'] + '<|header_end|>\n\n' }}
 
77
  {%- if message['content'] is string %}
78
  {{- message['content'] }}
79
  {%- else %}
@@ -81,14 +53,16 @@
81
  {%- if content['type'] == 'image' %}
82
  {{- '<|image|>' }}
83
  {%- elif content['type'] == 'text' %}
84
- {{- content['text'] }}
85
  {%- endif %}
86
  {%- endfor %}
87
  {%- endif %}
88
- {{- "<|eot|>" }}
89
- {%- elif 'tool_calls' in message and message.tool_calls|length > 0 %}
90
- {{- '<|header_start|>assistant<|header_end|>\n\n' -}}
91
- {{- '<|python_start|>' }}
 
 
92
  {%- if message['content'] is string %}
93
  {{- message['content'] }}
94
  {%- else %}
@@ -100,24 +74,38 @@
100
  {%- endif %}
101
  {%- endfor %}
102
  {%- endif %}
103
- {{- '<|python_end|>' }}
104
  {%- for tool_call in message.tool_calls %}
105
- {{- '{"name": "' + tool_call.function.name + '", ' }}
106
- {{- '"parameters": ' }}
107
- {{- tool_call.function.arguments | tojson }}
108
- {{- "}" }}
 
 
 
 
 
 
 
 
109
  {%- endfor %}
110
- {{- "<|eot|>" }}
 
 
111
  {%- elif message.role == "tool" or message.role == "ipython" %}
112
  {{- "<|header_start|>ipython<|header_end|>\n\n" }}
113
- {%- if message.content is mapping or message.content is iterable %}
114
- {{- message.content | tojson }}
115
  {%- else %}
116
- {{- message.content }}
 
 
 
 
117
  {%- endif %}
118
  {{- "<|eot|>" }}
119
  {%- endif %}
120
  {%- endfor %}
121
  {%- if add_generation_prompt %}
122
  {{- '<|header_start|>assistant<|header_end|>\n\n' }}
123
- {%- endif %}
 
1
  {{- bos_token }}
2
+ {%- if custom_tools is defined and custom_tools%}
3
  {%- set tools = custom_tools %}
4
  {%- endif %}
5
+ {%- if tools is defined and tools %}
6
+ {%- set tool_definition = tool_definition ~ (tools | tojson(indent=4)) %}
7
+ {%- else %}
 
 
 
 
 
 
 
 
8
  {%- set tools = none %}
9
  {%- endif %}
10
 
11
+
12
  {#- This block extracts the system message, so we can slot it into the right place. #}
13
+ {%- if messages[0]['role'] == 'system' %}
14
+ {%- set user_provided_system_message = true %}
15
  {%- if messages[0]['content'] is string %}
16
  {%- set system_message = messages[0]['content']|trim %}
17
  {%- else %}
 
18
  {%- set system_message = messages[0]['content'][0]['text']|trim %}
19
  {%- endif %}
20
  {%- set messages = messages[1:] %}
 
21
  {%- else %}
22
+ {%- if tools is not none %}
23
+ {#- Since not system_message was provided by user, if tool is provided, system_message is now default tool system message #}
24
+ {#- This system message is from llama website:https://www.llama.com/docs/model-cards-and-prompt-formats/llama4/ #}
25
+ {%- set system_message = "You are a helpful assistant and an expert in function composition. You can answer general questions using your internal knowledge OR invoke functions when necessary. Follow these strict guidelines:\n\n1. FUNCTION CALLS:\n- ONLY use functions that are EXPLICITLY listed in the function list below\n- If NO functions are listed (empty function list []), respond ONLY with internal knowledge or \"I don't have access to [Unavailable service] information\"\n- If a function is not in the list, respond ONLY with internal knowledge or \"I don't have access to [Unavailable service] information\"\n- If ALL required parameters are present AND the query EXACTLY matches a listed function's purpose: output ONLY the function call(s)\n- Use exact format: [func_name1(param1=value1, param2=value2), func_name2(...)]\nExamples:\nCORRECT: [get_weather(location=\"Vancouver\"), calculate_route(start=\"Boston\", end=\"New York\")] <- Only if get_weather and calculate_route are in function list\nINCORRECT: get_weather(location=\"New York\")\nINCORRECT: Let me check the weather: [get_weather(location=\"New York\")]\nINCORRECT: [get_events(location=\"Singapore\")] <- If function not in list\n\n2. RESPONSE RULES:\n- For pure function requests matching a listed function: ONLY output the function call(s)\n- For knowledge questions: ONLY output text\n- For missing parameters: ONLY request the specific missing parameters\n- For unavailable services (not in function list): output ONLY with internal knowledge or \"I don't have access to [Unavailable service] information\". Do NOT execute a function call.\n- If the query asks for information beyond what a listed function provides: output ONLY with internal knowledge about your limitations\n- NEVER combine text and function calls in the same response\n- NEVER suggest alternative functions when the requested service is unavailable\n- NEVER create or invent new functions not listed below\n\n3. STRICT BOUNDARIES:\n- ONLY use functions from the list below - no exceptions\n- NEVER use a function as an alternative to unavailable information\n- NEVER call functions not present in the function list\n- NEVER add explanatory text to function calls\n- NEVER respond with empty brackets\n- Use proper Python/JSON syntax for function calls\n- Check the function list carefully before responding\n\n4. TOOL RESPONSE HANDLING:\n- When receiving tool responses: provide concise, natural language responses\n- Don't repeat tool response verbatim\n- Don't add supplementary information\n\nHere is a list of functions in JSON format that you can invoke:\n" %}
26
+ {%- else %}
27
+ {%- set system_message = "" %}
28
+ {%- endif %}
29
  {%- endif %}
30
+ {#- Now writing the system message: use the user provided system message if user_provided_system_message, else default tool system message if tools presented #}
31
+ {%- if system_message %}
32
+ {#- always use user provided system message to override default tool system message #}
33
  {{- "<|header_start|>system<|header_end|>\n\n" }}
 
 
 
 
 
 
 
 
 
 
 
 
34
  {{- system_message }}
35
+ {%- if user_provided_system_message and tools %}
36
+ {{- "\nHere is a list of functions in JSON format that you can invoke. Use exact format: [func_name1(param1=value1, param2=value2), func_name2(...)]\n" }}
37
+ {{- tool_definition -}}
38
+ {%- elif tool_definition %}
39
+ {{- tool_definition -}}
40
+ {%- endif %}
41
  {{- "<|eot|>" }}
42
  {%- endif %}
43
 
44
+ {#- Now deal with all other messages #}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  {%- for message in messages %}
46
+ {#- Base case: messages that are not from tool role and has empty tool_call list #}
47
+ {%- if not (message.role == 'ipython' or message.role == 'tool' or ('tool_calls' in message and message.tool_calls|length != 0 )) %}
48
+ {{- '<|header_start|>' + message['role'] + '<|header_end|>\n\n' }}
49
  {%- if message['content'] is string %}
50
  {{- message['content'] }}
51
  {%- else %}
 
53
  {%- if content['type'] == 'image' %}
54
  {{- '<|image|>' }}
55
  {%- elif content['type'] == 'text' %}
56
+ {{- content['text'] | trim }}
57
  {%- endif %}
58
  {%- endfor %}
59
  {%- endif %}
60
+ {{- "<|eot|>" }}
61
+ {#- Tool case: messages has non-empty tool_call list, must from assistant #}
62
+ {%- elif 'tool_calls' in message %}
63
+ {#- assume tool_calls are always coming from assistant #}
64
+ {%- if message.role == 'assistant' %}
65
+ {{- '<|header_start|>assistant<|header_end|>\n\n' -}}
66
  {%- if message['content'] is string %}
67
  {{- message['content'] }}
68
  {%- else %}
 
74
  {%- endif %}
75
  {%- endfor %}
76
  {%- endif %}
77
+ {{- "[" }}
78
  {%- for tool_call in message.tool_calls %}
79
+ {%- if tool_call.function is defined %}
80
+ {%- set tool_call = tool_call.function %}
81
+ {%- endif %}
82
+ {{- tool_call.name + '(' -}}
83
+ {%- for param in tool_call.arguments %}
84
+ {{- param + '="' -}}
85
+ {{- "%s" | format(tool_call.arguments[param]) -}}
86
+ {{- '"' -}}
87
+ {% if not loop.last %}, {% endif %}
88
+ {%- endfor %}
89
+ {{- ')' -}}
90
+ {% if not loop.last %}, {% endif %}
91
  {%- endfor %}
92
+ {{- "]<|eot|>" }}
93
+ {%- endif %}
94
+ {#- Tool_response case: messages are from tool_response #}
95
  {%- elif message.role == "tool" or message.role == "ipython" %}
96
  {{- "<|header_start|>ipython<|header_end|>\n\n" }}
97
+ {%- if message.content is string %}
98
+ {{- message.content | tojson }}
99
  {%- else %}
100
+ {%- for content in message['content'] %}
101
+ {%- if content['type'] == 'text' %}
102
+ {{- content['text'] | tojson }}
103
+ {%- endif %}
104
+ {%- endfor %}
105
  {%- endif %}
106
  {{- "<|eot|>" }}
107
  {%- endif %}
108
  {%- endfor %}
109
  {%- if add_generation_prompt %}
110
  {{- '<|header_start|>assistant<|header_end|>\n\n' }}
111
+ {%- endif %}
config.json CHANGED
@@ -126,7 +126,7 @@
126
  },
127
  "tie_word_embeddings": false,
128
  "torch_dtype": "bfloat16",
129
- "transformers_version": "4.52.2",
130
  "unsloth_fixed": true,
131
  "vision_config": {
132
  "attention_dropout": 0.0,
 
126
  },
127
  "tie_word_embeddings": false,
128
  "torch_dtype": "bfloat16",
129
+ "transformers_version": "4.52.3",
130
  "unsloth_fixed": true,
131
  "vision_config": {
132
  "attention_dropout": 0.0,
tokenizer_config.json CHANGED
@@ -9096,5 +9096,5 @@
9096
  "processor_class": "Llama4Processor",
9097
  "tokenizer_class": "PreTrainedTokenizer",
9098
  "unk_token": null,
9099
- "chat_template": "{{- bos_token }}\n{%- if custom_tools is defined %}\n {%- set tools = custom_tools %}\n{%- endif %}\n{%- if not tools_in_user_message is defined %}\n {%- set tools_in_user_message = true %}\n{%- endif %}\n{%- if not date_string is defined %}\n {%- if strftime_now is defined %}\n {%- set date_string = strftime_now(\"%d %b %Y\") %}\n {%- else %}\n {%- set date_string = \"26 Jul 2024\" %}\n {%- endif %}\n{%- endif %}\n{%- if not tools is defined %}\n {%- set tools = none %}\n{%- endif %}\n\n{#- This block extracts the system message, so we can slot it into the right place. #}\n{%- if messages[0]['role'] == 'system' %} \n {%- if messages[0]['content'] is string %}\n {%- set system_message = messages[0]['content']|trim %}\n {%- else %}\n {#- FIXME: The processor requires an array, always. #}\n {%- set system_message = messages[0]['content'][0]['text']|trim %}\n {%- endif %}\n {%- set messages = messages[1:] %}\n {%- set user_supplied_system_message = true %}\n{%- else %}\n {%- set system_message = \"\" %}\n {%- set user_supplied_system_message = false %}\n{%- endif %}\n\n{#- System message if the user supplied one #}\n{%- if user_supplied_system_message %}\n {{- \"<|header_start|>system<|header_end|>\\n\\n\" }}\n {%- if tools is not none %}\n {{- \"Environment: ipython\\n\" }}\n {%- endif %}\n {%- if tools is not none and not tools_in_user_message %}\n {{- \"You have access to the following functions. To call a function, please respond with JSON for a function call.\" }}\n {{- 'Respond in the format {\"name\": function name, \"parameters\": dictionary of argument name and its value}.' }}\n {{- \"Do not use variables.\\n\\n\" }}\n {%- for t in tools %}\n {{- t | tojson(indent=4) }}\n {{- \"\\n\\n\" }}\n {%- endfor %}\n {%- endif %}\n {{- system_message }}\n {{- \"<|eot|>\" }}\n{%- endif %}\n\n{#- Custom tools are passed in a user message with some extra guidance #}\n{%- if tools_in_user_message and not tools is none %}\n {#- Extract the first user message so we can plug it in here #}\n {%- if messages | length != 0 %}\n {%- set first_user_message = messages[0]['content']|trim %}\n {%- set messages = messages[1:] %}\n {%- else %}\n {{- raise_exception(\"Cannot put tools in the first user message when there's no first user message!\") }}\n{%- endif %}\n {{- '<|header_start|>user<|header_end|>\\n\\n' -}}\n {{- \"Given the following functions, please respond with a JSON for a function call \" }}\n {{- \"with its proper arguments that best answers the given prompt.\\n\\n\" }}\n {{- 'Respond in the format {\"name\": function name, \"parameters\": dictionary of argument name and its value}.' }}\n {{- \"Do not use variables.\\n\\n\" }}\n {%- for t in tools %}\n {{- t | tojson(indent=4) }}\n {{- \"\\n\\n\" }}\n {%- endfor %}\n {{- first_user_message + \"<|eot|>\"}}\n{%- endif %}\n\n{%- for message in messages %}\n {%- if not (message.role == 'ipython' or message.role == 'tool' or 'tool_calls' in message) %}\n {{- '<|header_start|>' + message['role'] + '<|header_end|>\\n\\n' }}\n {%- if message['content'] is string %}\n {{- message['content'] }}\n {%- else %}\n {%- for content in message['content'] %}\n {%- if content['type'] == 'image' %}\n {{- '<|image|>' }}\n {%- elif content['type'] == 'text' %}\n {{- content['text'] }}\n {%- endif %}\n {%- endfor %}\n {%- endif %}\n {{- \"<|eot|>\" }}\n {%- elif 'tool_calls' in message and message.tool_calls|length > 0 %}\n {{- '<|header_start|>assistant<|header_end|>\\n\\n' -}}\n {{- '<|python_start|>' }}\n {%- if message['content'] is string %}\n {{- message['content'] }}\n {%- else %}\n {%- for content in message['content'] %}\n {%- if content['type'] == 'image' %}\n {{- '<|image|>' }}\n {%- elif content['type'] == 'text' %}\n {{- content['text'] }}\n {%- endif %}\n {%- endfor %}\n {%- endif %}\n {{- '<|python_end|>' }}\n {%- for tool_call in message.tool_calls %}\n {{- '{\"name\": \"' + tool_call.function.name + '\", ' }}\n {{- '\"parameters\": ' }}\n {{- tool_call.function.arguments | tojson }}\n {{- \"}\" }}\n {%- endfor %}\n {{- \"<|eot|>\" }}\n {%- elif message.role == \"tool\" or message.role == \"ipython\" %}\n {{- \"<|header_start|>ipython<|header_end|>\\n\\n\" }}\n {%- if message.content is mapping or message.content is iterable %}\n {{- message.content | tojson }}\n {%- else %}\n {{- message.content }}\n {%- endif %}\n {{- \"<|eot|>\" }}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|header_start|>assistant<|header_end|>\\n\\n' }}\n{%- endif %}\n"
9100
  }
 
9096
  "processor_class": "Llama4Processor",
9097
  "tokenizer_class": "PreTrainedTokenizer",
9098
  "unk_token": null,
9099
+ "chat_template": "{{- bos_token }}\n{%- if custom_tools is defined and custom_tools%}\n {%- set tools = custom_tools %}\n{%- endif %}\n{%- if tools is defined and tools %}\n {%- set tool_definition = tool_definition ~ (tools | tojson(indent=4)) %}\n{%- else %}\n {%- set tools = none %}\n{%- endif %}\n\n\n{#- This block extracts the system message, so we can slot it into the right place. #}\n{%- if messages[0]['role'] == 'system' %}\n {%- set user_provided_system_message = true %}\n {%- if messages[0]['content'] is string %}\n {%- set system_message = messages[0]['content']|trim %}\n {%- else %}\n {%- set system_message = messages[0]['content'][0]['text']|trim %}\n {%- endif %}\n {%- set messages = messages[1:] %}\n{%- else %}\n {%- if tools is not none %}\n {#- Since not system_message was provided by user, if tool is provided, system_message is now default tool system message #}\n {#- This system message is from llama website:https://www.llama.com/docs/model-cards-and-prompt-formats/llama4/ #}\n {%- set system_message = \"You are a helpful assistant and an expert in function composition. You can answer general questions using your internal knowledge OR invoke functions when necessary. Follow these strict guidelines:\\n\\n1. FUNCTION CALLS:\\n- ONLY use functions that are EXPLICITLY listed in the function list below\\n- If NO functions are listed (empty function list []), respond ONLY with internal knowledge or \\\"I don't have access to [Unavailable service] information\\\"\\n- If a function is not in the list, respond ONLY with internal knowledge or \\\"I don't have access to [Unavailable service] information\\\"\\n- If ALL required parameters are present AND the query EXACTLY matches a listed function's purpose: output ONLY the function call(s)\\n- Use exact format: [func_name1(param1=value1, param2=value2), func_name2(...)]\\nExamples:\\nCORRECT: [get_weather(location=\\\"Vancouver\\\"), calculate_route(start=\\\"Boston\\\", end=\\\"New York\\\")] <- Only if get_weather and calculate_route are in function list\\nINCORRECT: get_weather(location=\\\"New York\\\")\\nINCORRECT: Let me check the weather: [get_weather(location=\\\"New York\\\")]\\nINCORRECT: [get_events(location=\\\"Singapore\\\")] <- If function not in list\\n\\n2. RESPONSE RULES:\\n- For pure function requests matching a listed function: ONLY output the function call(s)\\n- For knowledge questions: ONLY output text\\n- For missing parameters: ONLY request the specific missing parameters\\n- For unavailable services (not in function list): output ONLY with internal knowledge or \\\"I don't have access to [Unavailable service] information\\\". Do NOT execute a function call.\\n- If the query asks for information beyond what a listed function provides: output ONLY with internal knowledge about your limitations\\n- NEVER combine text and function calls in the same response\\n- NEVER suggest alternative functions when the requested service is unavailable\\n- NEVER create or invent new functions not listed below\\n\\n3. STRICT BOUNDARIES:\\n- ONLY use functions from the list below - no exceptions\\n- NEVER use a function as an alternative to unavailable information\\n- NEVER call functions not present in the function list\\n- NEVER add explanatory text to function calls\\n- NEVER respond with empty brackets\\n- Use proper Python/JSON syntax for function calls\\n- Check the function list carefully before responding\\n\\n4. TOOL RESPONSE HANDLING:\\n- When receiving tool responses: provide concise, natural language responses\\n- Don't repeat tool response verbatim\\n- Don't add supplementary information\\n\\nHere is a list of functions in JSON format that you can invoke:\\n\" %}\n {%- else %}\n {%- set system_message = \"\" %}\n {%- endif %}\n{%- endif %}\n{#- Now writing the system message: use the user provided system message if user_provided_system_message, else default tool system message if tools presented #}\n{%- if system_message %}\n {#- always use user provided system message to override default tool system message #}\n {{- \"<|header_start|>system<|header_end|>\\n\\n\" }}\n {{- system_message }}\n {%- if user_provided_system_message and tools %}\n {{- \"\\nHere is a list of functions in JSON format that you can invoke. Use exact format: [func_name1(param1=value1, param2=value2), func_name2(...)]\\n\" }}\n {{- tool_definition -}}\n {%- elif tool_definition %}\n {{- tool_definition -}}\n {%- endif %}\n {{- \"<|eot|>\" }}\n{%- endif %}\n\n{#- Now deal with all other messages #}\n{%- for message in messages %}\n {#- Base case: messages that are not from tool role and has empty tool_call list #}\n {%- if not (message.role == 'ipython' or message.role == 'tool' or ('tool_calls' in message and message.tool_calls|length != 0 )) %}\n {{- '<|header_start|>' + message['role'] + '<|header_end|>\\n\\n' }}\n {%- if message['content'] is string %}\n {{- message['content'] }}\n {%- else %}\n {%- for content in message['content'] %}\n {%- if content['type'] == 'image' %}\n {{- '<|image|>' }}\n {%- elif content['type'] == 'text' %}\n {{- content['text'] | trim }}\n {%- endif %}\n {%- endfor %}\n {%- endif %}\n {{- \"<|eot|>\" }}\n {#- Tool case: messages has non-empty tool_call list, must from assistant #}\n {%- elif 'tool_calls' in message %}\n {#- assume tool_calls are always coming from assistant #}\n {%- if message.role == 'assistant' %}\n {{- '<|header_start|>assistant<|header_end|>\\n\\n' -}}\n {%- if message['content'] is string %}\n {{- message['content'] }}\n {%- else %}\n {%- for content in message['content'] %}\n {%- if content['type'] == 'image' %}\n {{- '<|image|>' }}\n {%- elif content['type'] == 'text' %}\n {{- content['text'] }}\n {%- endif %}\n {%- endfor %}\n {%- endif %}\n {{- \"[\" }}\n {%- for tool_call in message.tool_calls %}\n {%- if tool_call.function is defined %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {{- tool_call.name + '(' -}}\n {%- for param in tool_call.arguments %}\n {{- param + '=\"' -}}\n {{- \"%s\" | format(tool_call.arguments[param]) -}}\n {{- '\"' -}}\n {% if not loop.last %}, {% endif %}\n {%- endfor %}\n {{- ')' -}}\n {% if not loop.last %}, {% endif %}\n {%- endfor %}\n {{- \"]<|eot|>\" }}\n{%- endif %}\n{#- Tool_response case: messages are from tool_response #}\n {%- elif message.role == \"tool\" or message.role == \"ipython\" %}\n {{- \"<|header_start|>ipython<|header_end|>\\n\\n\" }}\n {%- if message.content is string %}\n {{- message.content | tojson }}\n {%- else %}\n {%- for content in message['content'] %}\n {%- if content['type'] == 'text' %}\n {{- content['text'] | tojson }}\n {%- endif %}\n {%- endfor %}\n {%- endif %}\n {{- \"<|eot|>\" }}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|header_start|>assistant<|header_end|>\\n\\n' }}\n{%- endif %}"
9100
  }