You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"{%- if messages[0].content is string and messages[0].role == 'system' -%}"
3705
+
"{{- messages[0].content -}}"
3706
+
"{%- elif messages[0].role == 'system' -%}"
3707
+
"{%- if 'text' in messages[0].content -%}"
3708
+
"{{- messages[0].content.text -}}"
3709
+
"{%- else -%}"
3710
+
"{{- 'You are a helpful assistant.' -}}"
3711
+
"{%- endif -%}"
3712
+
"{%- endif -%}"
3713
+
"{%- if tools -%}"
3714
+
"{{- '\n\n' -}}"
3715
+
"{{- '# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>' -}}"
3716
+
"{%- for tool in tools -%}"
3717
+
"{{- '\n' -}}"
3718
+
"{{- tool | tojson -}}"
3719
+
"{%- endfor -%}"
3720
+
"{{- '\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <arguments-json-object>}\n</tool_call>\n\nYou can also return a response for the user alongside a function call:\n<response-for-user>\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <arguments-json-object>}\n</tool_call>' -}}"
3721
+
"{%- endif -%}"
3722
+
"{{- '<|im_end|>\n' -}}"
3723
+
"{%- set image_count = namespace(value=0) -%}"
3724
+
#"{%- set video_count = namespace(value=0) -%}"
3725
+
"{%- for message in messages -%}"
3726
+
"{%- if message.role == 'tool' -%}"
3727
+
"{{- '<|im_start|>user\n<tool_response>\n' -}}"
3728
+
"{%- elif message.role != 'system' -%}"
3729
+
"{{- '<|im_start|>' + message.role + '\n' -}}"
3730
+
"{%- endif -%}"
3731
+
"{%- if message.content is string and message.role != 'system' -%}"
3732
+
"{{- message.content -}}"
3733
+
"{%- elif message.role != 'system' -%}"
3734
+
"{%- for content in message.content -%}"
3735
+
"{%- if 'image_url' in content -%}"
3736
+
"{%- set image_count.value = image_count.value + 1 -%}"
3737
+
"{%- if add_vision_id -%}"
3738
+
"{{- 'Picture ' -}}"
3739
+
"{{- image_count.value | string -}}"
3740
+
"{{- ': ' -}}"
3741
+
"{%- endif -%}"
3742
+
"{{- '<|vision_start|>' -}}"
3743
+
"{%- if content.image_url is string -%}"
3744
+
"{{- content.image_url -}}"
3745
+
"{%- else -%}"
3746
+
"{{- content.image_url.url -}}"
3747
+
"{%- endif -%}"
3748
+
"{{- '<|vision_end|>' -}}"
3749
+
"{%- endif -%}"
3750
+
# Video not supported yet
3751
+
"{%- if 'text' in content -%}"
3752
+
"{{- content.text -}}"
3753
+
"{%- endif -%}"
3754
+
"{%- endfor -%}"
3755
+
"{%- endif -%}"
3756
+
"{%- if message.role == 'assistant' -%}"
3757
+
"{%- if message.tool_calls -%}"
3758
+
"{%- for tool_call in message.tool_calls -%}"
3759
+
"{%- if (loop.first and message.content) or (not loop.first) -%}"
0 commit comments