[PR #11273] [CLOSED] template: Add deepseek with tools support #24035

Closed
opened 2026-04-19 17:20:44 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/11273
Author: @tko
Created: 7/2/2025
Status: Closed

Base: mainHead: deepseek-tools


📝 Commits (4)

  • 7993589 template: add tests for tools
  • cfbeecc template: add deepseek
  • 48d7ff9 template: reindent deepseek for better readability
  • 2d407e9 template: add tools to deepseek

📊 Changes

12 files changed (+248 additions, -1 deletions)

View changed files

template/deepseek.gotmpl (+46 -0)
template/deepseek.json (+8 -0)
📝 template/template_test.go (+137 -1)
template/testdata/command-r.gotmpl/tools-single (+22 -0)
template/testdata/command-r.gotmpl/tools-single-call (+8 -0)
template/testdata/command-r.gotmpl/tools-single-result (+3 -0)
template/testdata/deepseek.gotmpl/system-user-assistant-user (+1 -0)
template/testdata/deepseek.gotmpl/tools-single (+11 -0)
template/testdata/deepseek.gotmpl/tools-single-call (+7 -0)
template/testdata/deepseek.gotmpl/tools-single-result (+3 -0)
template/testdata/deepseek.gotmpl/user (+1 -0)
template/testdata/deepseek.gotmpl/user-assistant-user (+1 -0)

📄 Description

  • add template tests involving tools
  • add deepseek template from current model and add tools support

Addressing https://github.com/ollama/ollama/issues/10912

Using https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Qwen-32B?chat_template=default&format=true as reference for the special tokens.

Now, I don't really understand what is important in the templates and which tokens need to be included in parameters too. So:

  1. are the test cases sufficiently complex or should there be more interleaving messages?
  2. review the use of tokens, should some be included in params?
  3. template doesn't try to join consecutive tool outputs and surround them in <tools_output></tools_output> like the jinja2 seems to try. should it?

It does seem to work but I'm not qualified to evaluate how well or if something else broke (see https://github.com/ollama/ollama/issues/10912#issuecomment-2927853932)

It could be useful to have tests verifying that the tool calls do indeed get parsed as tool calls.

Is "deepseek" ok for levenshtein or should it be "deepseek-r1"?


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/11273 **Author:** [@tko](https://github.com/tko) **Created:** 7/2/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `deepseek-tools` --- ### 📝 Commits (4) - [`7993589`](https://github.com/ollama/ollama/commit/79935898dba4fce42863fa21f10a536c396131be) template: add tests for tools - [`cfbeecc`](https://github.com/ollama/ollama/commit/cfbeecc3dc7f52dc0a265ecda193b2ac102eb162) template: add deepseek - [`48d7ff9`](https://github.com/ollama/ollama/commit/48d7ff918a7136b67b8c5140f841326972d8463a) template: reindent deepseek for better readability - [`2d407e9`](https://github.com/ollama/ollama/commit/2d407e9dcda97b956ef693a8264f169ce2ed9889) template: add tools to deepseek ### 📊 Changes **12 files changed** (+248 additions, -1 deletions) <details> <summary>View changed files</summary> ➕ `template/deepseek.gotmpl` (+46 -0) ➕ `template/deepseek.json` (+8 -0) 📝 `template/template_test.go` (+137 -1) ➕ `template/testdata/command-r.gotmpl/tools-single` (+22 -0) ➕ `template/testdata/command-r.gotmpl/tools-single-call` (+8 -0) ➕ `template/testdata/command-r.gotmpl/tools-single-result` (+3 -0) ➕ `template/testdata/deepseek.gotmpl/system-user-assistant-user` (+1 -0) ➕ `template/testdata/deepseek.gotmpl/tools-single` (+11 -0) ➕ `template/testdata/deepseek.gotmpl/tools-single-call` (+7 -0) ➕ `template/testdata/deepseek.gotmpl/tools-single-result` (+3 -0) ➕ `template/testdata/deepseek.gotmpl/user` (+1 -0) ➕ `template/testdata/deepseek.gotmpl/user-assistant-user` (+1 -0) </details> ### 📄 Description * add template tests involving tools * add deepseek template from current model and add tools support Addressing https://github.com/ollama/ollama/issues/10912 Using https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Qwen-32B?chat_template=default&format=true as reference for the special tokens. Now, I don't really understand what is important in the templates and which tokens need to be included in parameters too. So: 1. are the test cases sufficiently complex or should there be more interleaving messages? 2. review the use of tokens, should some be included in params? 3. template doesn't try to join consecutive tool outputs and surround them in `<tools_output></tools_output>` like the jinja2 seems to try. should it? It does seem to work but I'm not qualified to evaluate how well or if something else broke (see https://github.com/ollama/ollama/issues/10912#issuecomment-2927853932) It could be useful to have tests verifying that the tool calls do indeed get parsed as tool calls. Is "deepseek" ok for levenshtein or should it be "deepseek-r1"? --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-19 17:20:44 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#24035