[GH-ISSUE #345] How to build tools call system prompt? #266

Closed
opened 2026-10-26 21:18:12 +00:00 by bsakaguchi · 3 comments
Owner

Originally created by @zhaocc1106 on GitHub (Feb 9, 2025).
Original GitHub issue: https://github.com/deepseek-ai/DeepSeek-R1/issues/345

How to build tools call system prompt for function call? Like qwen2.5 tokenizer_config.json:

{%- if tools %}\n    
	{{- '<|im_start|>system\\n' }}\n    
	{%- if messages[0]['role'] == 'system' %}\n        
		{{- messages[0]['content'] }}\n    
	{%- else %}\n        
		{{- 'You are Qwen, created by Alibaba Cloud. You are a helpful assistant.' }}\n    
	{%- endif %}\n    
	{{- \"\\n\\n# 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>\" }}\n    
	{%- for tool in tools %}\n        
		{{- \"\\n\" }}\n        
		{{- tool | tojson }}\n    
	{%- endfor %}\n    
	{{- \"\\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\\\": <args-json-object>}\\n</tool_call><|im_end|>\\n\" }}\n

I have not found tools parsing in DeepSeek-R1-Distill-Qwen-32B tokenizer_config.json

Originally created by @zhaocc1106 on GitHub (Feb 9, 2025). Original GitHub issue: https://github.com/deepseek-ai/DeepSeek-R1/issues/345 How to build tools call system prompt for function call? Like qwen2.5 [tokenizer_config.json](https://huggingface.co/Qwen/Qwen2.5-7B-Instruct/blob/main/tokenizer_config.json#L198): ``` {%- if tools %}\n {{- '<|im_start|>system\\n' }}\n {%- if messages[0]['role'] == 'system' %}\n {{- messages[0]['content'] }}\n {%- else %}\n {{- 'You are Qwen, created by Alibaba Cloud. You are a helpful assistant.' }}\n {%- endif %}\n {{- \"\\n\\n# 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>\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\\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\\\": <args-json-object>}\\n</tool_call><|im_end|>\\n\" }}\n ``` I have not found tools parsing in DeepSeek-R1-Distill-Qwen-32B [tokenizer_config.json](https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Qwen-32B/blob/main/tokenizer_config.json#L34)
bsakaguchi 2026-10-26 21:18:12 +00:00
Author
Owner

@deepsicker commented on GitHub (Feb 10, 2025):

you need langchain https://www.yuque.com/unreal/gpynrn/qxkg1bmxdpq3iumw

<!-- gh-comment-id:2646912343 --> @deepsicker commented on GitHub (Feb 10, 2025): you need langchain https://www.yuque.com/unreal/gpynrn/qxkg1bmxdpq3iumw
Author
Owner

@github-actions[bot] commented on GitHub (Mar 25, 2025):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe this issue is still relevant, please leave a comment to keep it open. Thank you for your contributions!

<!-- gh-comment-id:2749699202 --> @github-actions[bot] commented on GitHub (Mar 25, 2025): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe this issue is still relevant, please leave a comment to keep it open. Thank you for your contributions!
Author
Owner

@github-actions[bot] commented on GitHub (Apr 30, 2025):

false

<!-- gh-comment-id:2840500049 --> @github-actions[bot] commented on GitHub (Apr 30, 2025): false
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
deepseek-ai/DeepSeek-R1#266
No description provided.