Image-Text-to-Text
Transformers
Safetensors
English
qwen3_5
gptq
int4
4-bit precision
qwen3.5
quantization
agentic-coding
reasoning
conversational
Instructions to use malvavisc0/Qwable-9B-Claude-Fable-5-GPTQ-Int4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use malvavisc0/Qwable-9B-Claude-Fable-5-GPTQ-Int4 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="malvavisc0/Qwable-9B-Claude-Fable-5-GPTQ-Int4") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("malvavisc0/Qwable-9B-Claude-Fable-5-GPTQ-Int4") model = AutoModelForMultimodalLM.from_pretrained("malvavisc0/Qwable-9B-Claude-Fable-5-GPTQ-Int4", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use malvavisc0/Qwable-9B-Claude-Fable-5-GPTQ-Int4 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "malvavisc0/Qwable-9B-Claude-Fable-5-GPTQ-Int4" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "malvavisc0/Qwable-9B-Claude-Fable-5-GPTQ-Int4", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/malvavisc0/Qwable-9B-Claude-Fable-5-GPTQ-Int4
- SGLang
How to use malvavisc0/Qwable-9B-Claude-Fable-5-GPTQ-Int4 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "malvavisc0/Qwable-9B-Claude-Fable-5-GPTQ-Int4" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "malvavisc0/Qwable-9B-Claude-Fable-5-GPTQ-Int4", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "malvavisc0/Qwable-9B-Claude-Fable-5-GPTQ-Int4" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "malvavisc0/Qwable-9B-Claude-Fable-5-GPTQ-Int4", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use malvavisc0/Qwable-9B-Claude-Fable-5-GPTQ-Int4 with Docker Model Runner:
docker model run hf.co/malvavisc0/Qwable-9B-Claude-Fable-5-GPTQ-Int4
Update chat_template.jinja
Browse files- chat_template.jinja +63 -61
chat_template.jinja
CHANGED
|
@@ -1,11 +1,17 @@
|
|
| 1 |
-
{%- set template_version = "qwen3.
|
| 2 |
{%- set _tool_format = tool_call_format if tool_call_format is defined else 'xml' %}
|
| 3 |
{%- set image_count = namespace(value=0) %}
|
| 4 |
{%- set video_count = namespace(value=0) %}
|
| 5 |
{%- set add_vision_id = add_vision_id if add_vision_id is defined else false %}
|
| 6 |
{%- set enable_thinking = enable_thinking if enable_thinking is defined else true %}
|
| 7 |
{%- set auto_disable_thinking_with_tools = auto_disable_thinking_with_tools if auto_disable_thinking_with_tools is defined else false %}
|
| 8 |
-
{%-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
{%- set max_tool_arg_chars = max_tool_arg_chars if max_tool_arg_chars is defined else 0 %}
|
| 10 |
{%- set max_tool_response_chars = max_tool_response_chars if max_tool_response_chars is defined else 0 %}
|
| 11 |
{%- set _has_tools = (tools is defined and tools and tools is iterable and tools is not mapping) %}
|
|
@@ -13,6 +19,45 @@
|
|
| 13 |
{%- if auto_disable_thinking_with_tools and _has_tools %}
|
| 14 |
{%- set ns_state.thinking = false %}
|
| 15 |
{%- endif %}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
{%- macro render_content(content, do_vision_count, is_system_content=false) %}
|
| 17 |
{%- if content is string %}
|
| 18 |
{{- content }}
|
|
@@ -71,76 +116,36 @@
|
|
| 71 |
{%- if _sys_msg is not none %}
|
| 72 |
{%- set _sc = render_content(_sys_msg.content, false, true) | trim %}
|
| 73 |
{%- if '<|think_off|>' in _sc %}
|
| 74 |
-
{%- set ns_state.thinking = false %}
|
| 75 |
{%- set _sc = _sc.split('<|think_off|>') | join('') | trim %}
|
| 76 |
{%- elif '<|think_on|>' in _sc %}
|
| 77 |
-
{%- set ns_state.thinking = true %}
|
| 78 |
{%- set _sc = _sc.split('<|think_on|>') | join('') | trim %}
|
| 79 |
{%- endif %}
|
| 80 |
{%- endif %}
|
| 81 |
{%- if _has_tools %}
|
| 82 |
{{- '<|im_start|>system\n' }}
|
|
|
|
|
|
|
|
|
|
| 83 |
{{- '# Tools\n\nYou have access to the following functions:\n\n<tools>' }}
|
| 84 |
{%- for tool in tools %}
|
| 85 |
{{- '\n' }}
|
| 86 |
{{- tool | tojson }}
|
| 87 |
{%- endfor %}
|
| 88 |
{{- '\n</tools>' }}
|
| 89 |
-
{%-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
{
|
| 93 |
-
|
| 94 |
-
Brief explanation of tool call
|
| 95 |
-
</think>
|
| 96 |
-
<tool_call>
|
| 97 |
-
{"name": "example_function_name", "arguments": {"example_parameter_1": "value_1", "example_parameter_2": "This is the value for the second parameter"}}
|
| 98 |
-
</tool_call>
|
| 99 |
-
{%- else %}
|
| 100 |
-
<think>
|
| 101 |
-
Brief explanation of tool call
|
| 102 |
-
</think>
|
| 103 |
-
<tool_call>
|
| 104 |
-
<function=example_function_name>
|
| 105 |
-
<parameter=example_parameter_1>
|
| 106 |
-
value_1
|
| 107 |
-
</parameter>
|
| 108 |
-
<parameter=example_parameter_2>
|
| 109 |
-
This is the value for the second parameter
|
| 110 |
-
that can span
|
| 111 |
-
multiple lines
|
| 112 |
-
</parameter>
|
| 113 |
-
</function>
|
| 114 |
-
</tool_call>
|
| 115 |
-
{%- endif %}
|
| 116 |
-
|
| 117 |
-
<IMPORTANT>
|
| 118 |
-
Reminder:
|
| 119 |
-
- You can use the <think></think> block to plan your next tool call OR to synthesize data and formulate your final response to the user.
|
| 120 |
-
- ALL explanation and reasoning MUST be placed strictly inside the <think></think> block.
|
| 121 |
-
{%- if _tool_format == 'json' %}
|
| 122 |
-
- Function calls MUST follow the specified format: a single JSON object with "name" and "arguments" keys inside <tool_call></tool_call> XML tags.
|
| 123 |
-
{%- else %}
|
| 124 |
-
- Function calls MUST follow the specified format: an inner <function=...></function> block must be nested within <tool_call></tool_call> XML tags.
|
| 125 |
-
{%- endif %}
|
| 126 |
-
- If you choose to call a tool, you MUST output the <tool_call> block IMMEDIATELY after thinking, with NO conversational text before it.
|
| 127 |
-
{%- if _tool_format == 'json' %}
|
| 128 |
-
- The <tool_call> tag MUST be at the very beginning of a new line, with NO spaces or indentation before it.
|
| 129 |
-
{%- else %}
|
| 130 |
-
- The <tool_call> and <function> tags MUST be at the very beginning of a new line, with NO spaces or indentation before them.
|
| 131 |
-
{%- endif %}
|
| 132 |
-
- To call multiple functions, output a separate, completely closed <tool_call></tool_call> block for EACH function. Do NOT nest <tool_call> blocks.
|
| 133 |
-
- If you have all necessary data, provide your final answer directly to the user without any tool call.
|
| 134 |
-
</IMPORTANT>
|
| 135 |
-
{%- endset %}
|
| 136 |
-
{{- '\n\n' ~ tool_instructions | trim }}
|
| 137 |
{%- if _sc %}
|
| 138 |
{{- '\n\n' + _sc }}
|
| 139 |
{%- endif %}
|
| 140 |
{{- '<|im_end|>\n' }}
|
| 141 |
{%- else %}
|
| 142 |
{%- if _sc %}
|
| 143 |
-
{{- '<|im_start|>system\n' + _sc + '<|im_end|>\n' }}
|
|
|
|
|
|
|
| 144 |
{%- endif %}
|
| 145 |
{%- endif %}
|
| 146 |
{%- set _last_idx = _msgs | length - 1 %}
|
|
@@ -168,10 +173,8 @@ Reminder:
|
|
| 168 |
{%- set content = render_content(message.content, true, is_system) | trim %}
|
| 169 |
{%- if is_system or message.role == 'user' %}
|
| 170 |
{%- if '<|think_off|>' in content %}
|
| 171 |
-
{%- set ns_state.thinking = false %}
|
| 172 |
{%- set content = content.split('<|think_off|>') | join('') | trim %}
|
| 173 |
{%- elif '<|think_on|>' in content %}
|
| 174 |
-
{%- set ns_state.thinking = true %}
|
| 175 |
{%- set content = content.split('<|think_on|>') | join('') | trim %}
|
| 176 |
{%- endif %}
|
| 177 |
{%- endif %}
|
|
@@ -235,6 +238,7 @@ Reminder:
|
|
| 235 |
{%- else %}
|
| 236 |
{%- set tc = tool_call %}
|
| 237 |
{%- endif %}
|
|
|
|
| 238 |
{%- if _tool_format == 'json' %}
|
| 239 |
{%- if not loop.first or content | trim %}
|
| 240 |
{{- '\n\n' }}
|
|
@@ -247,16 +251,16 @@ Reminder:
|
|
| 247 |
{%- set _args = tc.arguments %}
|
| 248 |
{%- endif %}
|
| 249 |
{%- endif %}
|
| 250 |
-
{{- '<tool_call>\n{"name": ' }}{{-
|
| 251 |
{%- else %}
|
| 252 |
{%- if loop.first %}
|
| 253 |
{%- if content | trim %}
|
| 254 |
-
{{- '\n\n<tool_call>\n<function=' +
|
| 255 |
{%- else %}
|
| 256 |
-
{{- '<tool_call>\n<function=' +
|
| 257 |
{%- endif %}
|
| 258 |
{%- else %}
|
| 259 |
-
{{- '\n\n<tool_call>\n<function=' +
|
| 260 |
{%- endif %}
|
| 261 |
{%- if tc.arguments is defined and tc.arguments is not none %}
|
| 262 |
{%- if tc.arguments is mapping %}
|
|
@@ -321,8 +325,6 @@ Reminder:
|
|
| 321 |
{{- '<|im_start|>assistant\n' }}
|
| 322 |
{%- if not ns_state.thinking %}
|
| 323 |
{{- '<think>\n\n</think>\n\n' }}
|
| 324 |
-
{%- elif ns2.consecutive_failures >= 2 %}
|
| 325 |
-
{{- '<think>\n\n</think>\n\n' }}
|
| 326 |
{%- else %}
|
| 327 |
{{- '<think>\n' }}
|
| 328 |
{%- endif %}
|
|
|
|
| 1 |
+
{%- set template_version = "qwen3.8-froggeric-v22" %}
|
| 2 |
{%- set _tool_format = tool_call_format if tool_call_format is defined else 'xml' %}
|
| 3 |
{%- set image_count = namespace(value=0) %}
|
| 4 |
{%- set video_count = namespace(value=0) %}
|
| 5 |
{%- set add_vision_id = add_vision_id if add_vision_id is defined else false %}
|
| 6 |
{%- set enable_thinking = enable_thinking if enable_thinking is defined else true %}
|
| 7 |
{%- set auto_disable_thinking_with_tools = auto_disable_thinking_with_tools if auto_disable_thinking_with_tools is defined else false %}
|
| 8 |
+
{%- if preserve_reasoning is defined and preserve_reasoning is not none %}
|
| 9 |
+
{%- set _preserve_thinking = preserve_reasoning %}
|
| 10 |
+
{%- elif preserve_thinking is defined and preserve_thinking is not none %}
|
| 11 |
+
{%- set _preserve_thinking = preserve_thinking %}
|
| 12 |
+
{%- else %}
|
| 13 |
+
{%- set _preserve_thinking = true %}
|
| 14 |
+
{%- endif %}
|
| 15 |
{%- set max_tool_arg_chars = max_tool_arg_chars if max_tool_arg_chars is defined else 0 %}
|
| 16 |
{%- set max_tool_response_chars = max_tool_response_chars if max_tool_response_chars is defined else 0 %}
|
| 17 |
{%- set _has_tools = (tools is defined and tools and tools is iterable and tools is not mapping) %}
|
|
|
|
| 19 |
{%- if auto_disable_thinking_with_tools and _has_tools %}
|
| 20 |
{%- set ns_state.thinking = false %}
|
| 21 |
{%- endif %}
|
| 22 |
+
{%- for msg in messages %}
|
| 23 |
+
{%- if msg.role == 'system' or msg.role == 'developer' or msg.role == 'user' %}
|
| 24 |
+
{%- if msg.content is string %}
|
| 25 |
+
{%- if '<|think_off|>' in msg.content %}
|
| 26 |
+
{%- set ns_state.thinking = false %}
|
| 27 |
+
{%- elif '<|think_on|>' in msg.content %}
|
| 28 |
+
{%- set ns_state.thinking = true %}
|
| 29 |
+
{%- endif %}
|
| 30 |
+
{%- elif msg.content is iterable and msg.content is not mapping %}
|
| 31 |
+
{%- for item in msg.content %}
|
| 32 |
+
{%- if item is mapping and 'text' in item and item.text is string %}
|
| 33 |
+
{%- if '<|think_off|>' in item.text %}
|
| 34 |
+
{%- set ns_state.thinking = false %}
|
| 35 |
+
{%- elif '<|think_on|>' in item.text %}
|
| 36 |
+
{%- set ns_state.thinking = true %}
|
| 37 |
+
{%- endif %}
|
| 38 |
+
{%- endif %}
|
| 39 |
+
{%- endfor %}
|
| 40 |
+
{%- endif %}
|
| 41 |
+
{%- endif %}
|
| 42 |
+
{%- endfor %}
|
| 43 |
+
{%- set _effort_raw = reasoning_effort if reasoning_effort is defined else 'xhigh' %}
|
| 44 |
+
{%- if _effort_raw == 'high' or _effort_raw == 'xhigh' %}
|
| 45 |
+
{%- set _reasoning_effort = 'xhigh' %}
|
| 46 |
+
{%- elif _effort_raw == 'low' %}
|
| 47 |
+
{%- set _reasoning_effort = 'low' %}
|
| 48 |
+
{%- elif _effort_raw == 'medium' %}
|
| 49 |
+
{%- set _reasoning_effort = 'medium' %}
|
| 50 |
+
{%- else %}
|
| 51 |
+
{%- set _reasoning_effort = 'xhigh' %}
|
| 52 |
+
{%- endif %}
|
| 53 |
+
{%- set reasoning_instructions = '' %}
|
| 54 |
+
{%- if ns_state.thinking %}
|
| 55 |
+
{%- if _reasoning_effort == 'xhigh' %}
|
| 56 |
+
{%- set reasoning_instructions = 'Reasoning effort is set to xhigh. Please think carefully through the task, validate key assumptions, consider plausible alternatives, and prioritize correctness, consistency, and clarity in the final answer.' %}
|
| 57 |
+
{%- elif _reasoning_effort == 'low' %}
|
| 58 |
+
{%- set reasoning_instructions = 'Reasoning effort is set to low. Keep your thinking brief and focused, moving directly to the conclusion without unnecessary elaboration.' %}
|
| 59 |
+
{%- endif %}
|
| 60 |
+
{%- endif %}
|
| 61 |
{%- macro render_content(content, do_vision_count, is_system_content=false) %}
|
| 62 |
{%- if content is string %}
|
| 63 |
{{- content }}
|
|
|
|
| 116 |
{%- if _sys_msg is not none %}
|
| 117 |
{%- set _sc = render_content(_sys_msg.content, false, true) | trim %}
|
| 118 |
{%- if '<|think_off|>' in _sc %}
|
|
|
|
| 119 |
{%- set _sc = _sc.split('<|think_off|>') | join('') | trim %}
|
| 120 |
{%- elif '<|think_on|>' in _sc %}
|
|
|
|
| 121 |
{%- set _sc = _sc.split('<|think_on|>') | join('') | trim %}
|
| 122 |
{%- endif %}
|
| 123 |
{%- endif %}
|
| 124 |
{%- if _has_tools %}
|
| 125 |
{{- '<|im_start|>system\n' }}
|
| 126 |
+
{%- if reasoning_instructions %}
|
| 127 |
+
{{- reasoning_instructions + '\n\n' }}
|
| 128 |
+
{%- endif %}
|
| 129 |
{{- '# Tools\n\nYou have access to the following functions:\n\n<tools>' }}
|
| 130 |
{%- for tool in tools %}
|
| 131 |
{{- '\n' }}
|
| 132 |
{{- tool | tojson }}
|
| 133 |
{%- endfor %}
|
| 134 |
{{- '\n</tools>' }}
|
| 135 |
+
{%- if _tool_format == 'json' %}
|
| 136 |
+
{{- '\n\nIf you choose to call a function ONLY reply in the following format with NO suffix:\n\n<think>\nBrief explanation of tool call\n</think>\n<tool_call>\n{"name": "example_function_name", "arguments": {"example_parameter_1": "value_1", "example_parameter_2": "This is the value for the second parameter"}}\n</tool_call>\n\n<IMPORTANT>\nReminder:\n- You can use the <think></think> block to plan your next tool call OR to synthesize data and formulate your final response to the user.\n- ALL explanation and reasoning MUST be placed strictly inside the <think></think> block.\n- Function calls MUST follow the specified format: a single JSON object with "name" and "arguments" keys inside <tool_call></tool_call> XML tags.\n- If you choose to call a tool, you MUST output the <tool_call> block IMMEDIATELY after thinking, with NO conversational text before it.\n- The <tool_call> tag MUST be at the very beginning of a new line, with NO spaces or indentation before it.\n- To call multiple functions, output a separate, completely closed <tool_call></tool_call> block for EACH function. Do NOT nest <tool_call> blocks.\n- If you have all necessary data, provide your final answer directly to the user without any tool call.\n</IMPORTANT>' }}
|
| 137 |
+
{%- else %}
|
| 138 |
+
{{- '\n\nIf you choose to call a function ONLY reply in the following format with NO suffix:\n\n<think>\nBrief explanation of tool call\n</think>\n<tool_call>\n<function=example_function_name>\n<parameter=example_parameter_1>\nvalue_1\n</parameter>\n<parameter=example_parameter_2>\nThis is the value for the second parameter\nthat can span\nmultiple lines\n</parameter>\n</function>\n</tool_call>\n\n<IMPORTANT>\nReminder:\n- You can use the <think></think> block to plan your next tool call OR to synthesize data and formulate your final response to the user.\n- ALL explanation and reasoning MUST be placed strictly inside the <think></think> block.\n- Function calls MUST follow the specified format: an inner <function=...></function> block must be nested within <tool_call></tool_call> XML tags.\n- If you choose to call a tool, you MUST output the <tool_call> block IMMEDIATELY after thinking, with NO conversational text before it.\n- The <tool_call> and <function> tags MUST be at the very beginning of a new line, with NO spaces or indentation before them.\n- To call multiple functions, output a separate, completely closed <tool_call></tool_call> block for EACH function. Do NOT nest <tool_call> blocks.\n- If you have all necessary data, provide your final answer directly to the user without any tool call.\n</IMPORTANT>' }}
|
| 139 |
+
{%- endif %}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 140 |
{%- if _sc %}
|
| 141 |
{{- '\n\n' + _sc }}
|
| 142 |
{%- endif %}
|
| 143 |
{{- '<|im_end|>\n' }}
|
| 144 |
{%- else %}
|
| 145 |
{%- if _sc %}
|
| 146 |
+
{{- '<|im_start|>system\n' + (reasoning_instructions + '\n\n' if reasoning_instructions else '') + _sc + '<|im_end|>\n' }}
|
| 147 |
+
{%- elif reasoning_instructions %}
|
| 148 |
+
{{- '<|im_start|>system\n' + reasoning_instructions + '<|im_end|>\n' }}
|
| 149 |
{%- endif %}
|
| 150 |
{%- endif %}
|
| 151 |
{%- set _last_idx = _msgs | length - 1 %}
|
|
|
|
| 173 |
{%- set content = render_content(message.content, true, is_system) | trim %}
|
| 174 |
{%- if is_system or message.role == 'user' %}
|
| 175 |
{%- if '<|think_off|>' in content %}
|
|
|
|
| 176 |
{%- set content = content.split('<|think_off|>') | join('') | trim %}
|
| 177 |
{%- elif '<|think_on|>' in content %}
|
|
|
|
| 178 |
{%- set content = content.split('<|think_on|>') | join('') | trim %}
|
| 179 |
{%- endif %}
|
| 180 |
{%- endif %}
|
|
|
|
| 238 |
{%- else %}
|
| 239 |
{%- set tc = tool_call %}
|
| 240 |
{%- endif %}
|
| 241 |
+
{%- set tc_name = tc.name if (tc.name is defined and tc.name is not none) else '' %}
|
| 242 |
{%- if _tool_format == 'json' %}
|
| 243 |
{%- if not loop.first or content | trim %}
|
| 244 |
{{- '\n\n' }}
|
|
|
|
| 251 |
{%- set _args = tc.arguments %}
|
| 252 |
{%- endif %}
|
| 253 |
{%- endif %}
|
| 254 |
+
{{- '<tool_call>\n{"name": ' }}{{- tc_name | tojson }}{{- ', "arguments": ' }}{{- _args }}{{- '}\n</tool_call>' }}
|
| 255 |
{%- else %}
|
| 256 |
{%- if loop.first %}
|
| 257 |
{%- if content | trim %}
|
| 258 |
+
{{- '\n\n<tool_call>\n<function=' + tc_name + '>\n' }}
|
| 259 |
{%- else %}
|
| 260 |
+
{{- '<tool_call>\n<function=' + tc_name + '>\n' }}
|
| 261 |
{%- endif %}
|
| 262 |
{%- else %}
|
| 263 |
+
{{- '\n\n<tool_call>\n<function=' + tc_name + '>\n' }}
|
| 264 |
{%- endif %}
|
| 265 |
{%- if tc.arguments is defined and tc.arguments is not none %}
|
| 266 |
{%- if tc.arguments is mapping %}
|
|
|
|
| 325 |
{{- '<|im_start|>assistant\n' }}
|
| 326 |
{%- if not ns_state.thinking %}
|
| 327 |
{{- '<think>\n\n</think>\n\n' }}
|
|
|
|
|
|
|
| 328 |
{%- else %}
|
| 329 |
{{- '<think>\n' }}
|
| 330 |
{%- endif %}
|