[GH-ISSUE #9] Function calling #9

Closed
opened 2026-10-26 21:10:06 +00:00 by bsakaguchi · 70 comments
Owner

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

When will R1 support function calling and structured outputs? Thanks

Originally created by @sigren on GitHub (Jan 20, 2025). Original GitHub issue: https://github.com/deepseek-ai/DeepSeek-R1/issues/9 When will R1 support function calling and structured outputs? Thanks
bsakaguchi 2026-10-26 21:10:06 +00:00
Author
Owner

@FORNDODAper commented on GitHub (Jan 21, 2025):

x2
('x2' stands for 'yeah, i would like to know that too')

<!-- gh-comment-id:2603389340 --> @FORNDODAper commented on GitHub (Jan 21, 2025): **x2** _('x2' stands for 'yeah, i would like to know that too')_
Author
Owner

@reatang commented on GitHub (Jan 21, 2025):

x2 + 1

<!-- gh-comment-id:2603781699 --> @reatang commented on GitHub (Jan 21, 2025): x2 + 1
Author
Owner

@flyfish101 commented on GitHub (Jan 21, 2025):

x2 + 2

<!-- gh-comment-id:2603821125 --> @flyfish101 commented on GitHub (Jan 21, 2025): x2 + 2
Author
Owner

@ghost commented on GitHub (Jan 21, 2025):

x2 + 3

<!-- gh-comment-id:2604115648 --> @ghost commented on GitHub (Jan 21, 2025): x2 + 3
Author
Owner

@lzl-mt commented on GitHub (Jan 21, 2025):

x2 + 4

<!-- gh-comment-id:2604182211 --> @lzl-mt commented on GitHub (Jan 21, 2025): x2 + 4
Author
Owner

@juanjopc commented on GitHub (Jan 21, 2025):

x2 + 5

<!-- gh-comment-id:2604589037 --> @juanjopc commented on GitHub (Jan 21, 2025): x2 + 5
Author
Owner

@engalisabry commented on GitHub (Jan 21, 2025):

Response to Issue #9: Function Calling and Structured Outputs

Thank you for your question and for the community’s interest in this feature! Below, I’ve addressed the current status and future plans for function calling and structured outputs in DeepSeek R1.


Current Status

  • As of now, DeepSeek R1 does not natively support function calling or structured outputs.
  • The model is primarily optimized for reasoning-heavy tasks (e.g., math, code, and STEM) and follows a conversational format.

Future Plans

  • We recognize the importance of function calling and structured outputs for many use cases, such as API integrations, automation, and data extraction.
  • We are actively exploring ways to add support for these features in future updates. This includes:
    • Extending the model’s capabilities to handle structured data formats (e.g., JSON, XML).
    • Adding support for function calling to enable seamless integration with external tools and APIs.

Timeline

  • While we don’t have a specific release date yet, we aim to roll out these features in the next major update.
  • We will keep the community updated on our progress through GitHub announcements and release notes.

Workarounds for Now

If you need structured outputs or function-like behavior in the meantime, here are some workarounds:

  1. Post-Processing Outputs:

    • Use a script to parse the model’s responses into structured formats (e.g., JSON).
    • Example:
      import json
      
      response = model.generate("Extract the following data as JSON: ...")
      structured_data = json.loads(response)
      
  2. Prompt Engineering:

    • Design prompts to guide the model to produce outputs in a specific format.
    • Example:
      Extract the following information and format it as JSON:
      - Name: ...
      - Age: ...
      - Location: ...
      
  3. Custom Wrapper:

    • Build a custom wrapper around the model to simulate function calling behavior.
    • Example:
      def call_function(model, function_name, args):
          prompt = f"Call function {function_name} with args {args} and return the result."
          return model.generate(prompt)
      

Community Feedback

We appreciate the enthusiasm from the community (x2 + 5 and counting!). Your feedback is invaluable in shaping the future of DeepSeek R1. If you have specific use cases or feature requests related to function calling and structured outputs, please share them in this thread.


Next Steps

  • We will prioritize this feature based on community demand and provide updates as development progresses.
  • Stay tuned for announcements and feel free to contribute ideas or suggestions!

Thank you for your patience and support as we work to make DeepSeek R1 even better! Let us know if you have further questions or need additional assistance.

<!-- gh-comment-id:2604747754 --> @engalisabry commented on GitHub (Jan 21, 2025): ### **Response to Issue #9: Function Calling and Structured Outputs** Thank you for your question and for the community’s interest in this feature! Below, I’ve addressed the current status and future plans for **function calling** and **structured outputs** in DeepSeek R1. --- #### **Current Status** - As of now, **DeepSeek R1 does not natively support function calling or structured outputs**. - The model is primarily optimized for **reasoning-heavy tasks** (e.g., math, code, and STEM) and follows a conversational format. --- #### **Future Plans** - We recognize the importance of **function calling** and **structured outputs** for many use cases, such as API integrations, automation, and data extraction. - We are actively exploring ways to add support for these features in future updates. This includes: - Extending the model’s capabilities to handle structured data formats (e.g., JSON, XML). - Adding support for function calling to enable seamless integration with external tools and APIs. --- #### **Timeline** - While we don’t have a specific release date yet, we aim to roll out these features in the **next major update**. - We will keep the community updated on our progress through GitHub announcements and release notes. --- #### **Workarounds for Now** If you need structured outputs or function-like behavior in the meantime, here are some workarounds: 1. **Post-Processing Outputs:** - Use a script to parse the model’s responses into structured formats (e.g., JSON). - Example: ```python import json response = model.generate("Extract the following data as JSON: ...") structured_data = json.loads(response) ``` 2. **Prompt Engineering:** - Design prompts to guide the model to produce outputs in a specific format. - Example: ``` Extract the following information and format it as JSON: - Name: ... - Age: ... - Location: ... ``` 3. **Custom Wrapper:** - Build a custom wrapper around the model to simulate function calling behavior. - Example: ```python def call_function(model, function_name, args): prompt = f"Call function {function_name} with args {args} and return the result." return model.generate(prompt) ``` --- #### **Community Feedback** We appreciate the enthusiasm from the community (x2 + 5 and counting!). Your feedback is invaluable in shaping the future of DeepSeek R1. If you have specific use cases or feature requests related to function calling and structured outputs, please share them in this thread. --- #### **Next Steps** - We will prioritize this feature based on community demand and provide updates as development progresses. - Stay tuned for announcements and feel free to contribute ideas or suggestions! --- Thank you for your patience and support as we work to make DeepSeek R1 even better! Let us know if you have further questions or need additional assistance.
Author
Owner

@ibndias commented on GitHub (Jan 22, 2025):

Use R1 as the master brain for tool decision / plan, and rewrite the output in structure with another model.

<!-- gh-comment-id:2606624963 --> @ibndias commented on GitHub (Jan 22, 2025): Use R1 as the master brain for tool decision / plan, and rewrite the output in structure with another model.
Author
Owner

@jacobpretorius commented on GitHub (Jan 22, 2025):

I would really like the model to support structured output, such as JSON. For now, no matter how much I tell it to only output JSON it is not consistent. I don't mind the section I think that is useful and very easy to remove with some string handling, but it needs to adhere to JSON output if asked in its final response.

<!-- gh-comment-id:2607615312 --> @jacobpretorius commented on GitHub (Jan 22, 2025): I would really like the model to support structured output, such as JSON. For now, no matter how much I tell it to only output JSON it is not consistent. I don't mind the <think> section I think that is useful and very easy to remove with some string handling, but it needs to adhere to JSON output if asked in its final response.
Author
Owner

@Chrisbattarbee commented on GitHub (Jan 22, 2025):

Also looking for this

<!-- gh-comment-id:2608408909 --> @Chrisbattarbee commented on GitHub (Jan 22, 2025): Also looking for this
Author
Owner

@feliks912 commented on GitHub (Jan 23, 2025):

Bump, definitely bump

<!-- gh-comment-id:2608552438 --> @feliks912 commented on GitHub (Jan 23, 2025): Bump, definitely bump
Author
Owner

@jayeew commented on GitHub (Jan 23, 2025):

When will R1 support agent?

<!-- gh-comment-id:2608678271 --> @jayeew commented on GitHub (Jan 23, 2025): When will R1 support agent?
Author
Owner

@letscagefdn commented on GitHub (Jan 23, 2025):

response_format: { type: 'json_object' }

<!-- gh-comment-id:2609897417 --> @letscagefdn commented on GitHub (Jan 23, 2025): response_format: { type: 'json_object' }
Author
Owner

@bgarnr commented on GitHub (Jan 24, 2025):

Thank you. I look forward to having a provider that allows my Microsoft Semantic Kernel powered application to use Deepseek as an alternative for auto function calling.

<!-- gh-comment-id:2612154079 --> @bgarnr commented on GitHub (Jan 24, 2025): Thank you. I look forward to having a provider that allows my Microsoft Semantic Kernel powered application to use Deepseek as an alternative for auto function calling.
Author
Owner

@Dey-Sumit commented on GitHub (Jan 24, 2025):

x2

<!-- gh-comment-id:2613392727 --> @Dey-Sumit commented on GitHub (Jan 24, 2025): x2
Author
Owner

@justinlietz93 commented on GitHub (Jan 25, 2025):

https://github.com/justinlietz93/agent_tools

I built a suite of tools and a wrapper for deepseek reasoner to use, check it out

<!-- gh-comment-id:2613819094 --> @justinlietz93 commented on GitHub (Jan 25, 2025): https://github.com/justinlietz93/agent_tools I built a suite of tools and a wrapper for deepseek reasoner to use, check it out
Author
Owner

@enemchy commented on GitHub (Jan 25, 2025):

My application automates code generation using file operations via functional calls. Currently, integrating R1 requires significant refactoring due to the lack of function calling support, even though this feature is already standardized in most models (OpenAI, Anthropic, Mistral, etc.). To migrate from other models to R1, I must rewrite critical components of the application, which increases transition costs and error risks. Without function calling support, developers are forced to adopt less efficient workarounds or delay adopting R1, despite its exceptional code generation capabilities.

Accelerating the development of function calling for R1 will lower the entry barrier for communities relying on industry-standard approaches.

<!-- gh-comment-id:2613997007 --> @enemchy commented on GitHub (Jan 25, 2025): My application automates code generation using file operations via functional calls. Currently, integrating R1 requires significant refactoring due to the lack of function calling support, even though this feature is already standardized in most models (OpenAI, Anthropic, Mistral, etc.). To migrate from other models to R1, I must rewrite critical components of the application, which increases transition costs and error risks. Without function calling support, developers are forced to adopt less efficient workarounds or delay adopting R1, despite its exceptional code generation capabilities. Accelerating the development of function calling for R1 will lower the entry barrier for communities relying on industry-standard approaches.
Author
Owner

@justinlietz93 commented on GitHub (Jan 25, 2025):

My application automates code generation using file operations via functional calls. Currently, integrating R1 requires significant refactoring due to the lack of function calling support, even though this feature is already standardized in most models (OpenAI, Anthropic, Mistral, etc.). To migrate from other models to R1, I must rewrite critical components of the application, which increases transition costs and error risks. Without function calling support, developers are forced to adopt less efficient workarounds or delay adopting R1, despite its exceptional code generation capabilities.

Accelerating the development of function calling for R1 will lower the entry barrier for communities relying on industry-standard approaches.

Can you please email me, feel free to look at my agent_tools repo, I have powerful tools for Deepseek R1 and I’m improving them daily. Jlietz93@gmail.com, I have more contact links on my github

<!-- gh-comment-id:2614091669 --> @justinlietz93 commented on GitHub (Jan 25, 2025): > My application automates code generation using file operations via functional calls. Currently, integrating R1 requires significant refactoring due to the lack of function calling support, even though this feature is already standardized in most models (OpenAI, Anthropic, Mistral, etc.). To migrate from other models to R1, I must rewrite critical components of the application, which increases transition costs and error risks. Without function calling support, developers are forced to adopt less efficient workarounds or delay adopting R1, despite its exceptional code generation capabilities. > > Accelerating the development of function calling for R1 will lower the entry barrier for communities relying on industry-standard approaches. Can you please email me, feel free to look at my agent_tools repo, I have powerful tools for Deepseek R1 and I’m improving them daily. Jlietz93@gmail.com, I have more contact links on my github
Author
Owner

@phpmac commented on GitHub (Jan 26, 2025):

go

<!-- gh-comment-id:2614282518 --> @phpmac commented on GitHub (Jan 26, 2025): go
Author
Owner

@vepicurean commented on GitHub (Jan 26, 2025):

Agree with the original feature request ( function calling and structured outputs standard features on a API now), without structured outputs, it's nearly impossible to achieve targeted data accuracy levels for many applications. When needing data accuracy of 99.999% on large volumes ( hundreds of thousands of records), structured outputs made a huge difference in the accuracy of my responses for unstructured ( document store) database queries using o1-mini.

Function calling, yes, I could do the workaround as suggested), but given the time and effort I already put into the development of the autonomous agent back end programming, I'd prefer not to go backwards and put in workarounds to use R1 when hopefully my existing code using function calling will be adequate when the R series of models and the DeepSeek API can in fact support function calling - hopefully the DeepSeek function calling and structured outputs performance will be just as good as on the OpenAI API using o1 and gpt-4o.

<!-- gh-comment-id:2614419562 --> @vepicurean commented on GitHub (Jan 26, 2025): Agree with the original feature request ( function calling and structured outputs standard features on a API now), without structured outputs, it's nearly impossible to achieve targeted data accuracy levels for many applications. When needing data accuracy of 99.999% on large volumes ( hundreds of thousands of records), structured outputs made a huge difference in the accuracy of my responses for unstructured ( document store) database queries using o1-mini. Function calling, yes, I could do the workaround as suggested), but given the time and effort I already put into the development of the autonomous agent back end programming, I'd prefer not to go backwards and put in workarounds to use R1 when hopefully my existing code using function calling will be adequate when the R series of models and the DeepSeek API can in fact support function calling - hopefully the DeepSeek function calling and structured outputs performance will be just as good as on the OpenAI API using o1 and gpt-4o.
Author
Owner

@abylikhsanov commented on GitHub (Jan 26, 2025):

x2

<!-- gh-comment-id:2614526588 --> @abylikhsanov commented on GitHub (Jan 26, 2025): x2
Author
Owner

@aaronvg commented on GitHub (Jan 27, 2025):

We got function-calling to work with R1 using our framework BAML: https://www.boundaryml.com/blog/deepseek-r1-function-calling . We haven't had any issues making it spit out structured data.

It doesn't need tool-apis or whatnot, we just serialize types into the prompt in an efficient way, and parse the output using a custom JSON parser to handle missing quotes etc.

Let us know if you do. Here is our open-source repo: https://github.com/BoundaryML/baml

<!-- gh-comment-id:2614887435 --> @aaronvg commented on GitHub (Jan 27, 2025): We got function-calling to work with R1 using our framework BAML: https://www.boundaryml.com/blog/deepseek-r1-function-calling . We haven't had any issues making it spit out structured data. It doesn't need tool-apis or whatnot, we just serialize types into the prompt in an efficient way, and parse the output using a custom JSON parser to handle missing quotes etc. Let us know if you do. Here is our open-source repo: https://github.com/BoundaryML/baml
Author
Owner

@dickens88 commented on GitHub (Jan 27, 2025):

I'm also looking forward

<!-- gh-comment-id:2615674993 --> @dickens88 commented on GitHub (Jan 27, 2025): I'm also looking forward
Author
Owner

@justinlietz93 commented on GitHub (Jan 27, 2025):

We got function-calling to work with R1 using our framework BAML: https://www.boundaryml.com/blog/deepseek-r1-function-calling . We haven't had any issues making it spit out structured data.

It doesn't need tool-apis or whatnot, we just serialize types into the prompt in an efficient way, and parse the output using a custom JSON parser to handle missing quotes etc.

Let us know if you do. Here is our open-source repo: https://github.com/BoundaryML/baml

Awesome I’m going to take a look, because I’ve been building something for the same idea, to allow any LLM to use any tool

<!-- gh-comment-id:2616134050 --> @justinlietz93 commented on GitHub (Jan 27, 2025): > We got function-calling to work with R1 using our framework BAML: https://www.boundaryml.com/blog/deepseek-r1-function-calling . We haven't had any issues making it spit out structured data. > > It doesn't need tool-apis or whatnot, we just serialize types into the prompt in an efficient way, and parse the output using a custom JSON parser to handle missing quotes etc. > > Let us know if you do. Here is our open-source repo: https://github.com/BoundaryML/baml Awesome I’m going to take a look, because I’ve been building something for the same idea, to allow any LLM to use any tool
Author
Owner

@MehdiBukhari commented on GitHub (Jan 29, 2025):

Looking forward deep seek with function calling

<!-- gh-comment-id:2620688643 --> @MehdiBukhari commented on GitHub (Jan 29, 2025): Looking forward deep seek with function calling
Author
Owner

@jenyss commented on GitHub (Jan 29, 2025):

+1

<!-- gh-comment-id:2621256587 --> @jenyss commented on GitHub (Jan 29, 2025): +1
Author
Owner

@thorwebdev commented on GitHub (Jan 30, 2025):

In case this is helpful for others, looks like the Qwen-32B distillation https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Qwen-32B/discussions/7 has support for function calling.

<!-- gh-comment-id:2623882350 --> @thorwebdev commented on GitHub (Jan 30, 2025): In case this is helpful for others, looks like the Qwen-32B distillation https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Qwen-32B/discussions/7 has support for function calling.
Author
Owner

@danruggi commented on GitHub (Jan 30, 2025):

Asking for
"response_format": {'type': 'json_object' }
too

Thanks for the effort

<!-- gh-comment-id:2625459075 --> @danruggi commented on GitHub (Jan 30, 2025): Asking for "response_format": {'type': 'json_object' } too Thanks for the effort
Author
Owner

@krasserm commented on GitHub (Feb 6, 2025):

One possible alternative to builtin function calling via JSON is to leverage DeepSeek-R1's strong coding capabilities and let the model generate code actions in Python. I experimented with this approach and found that it outperforms Claude 3.5 Sonnet on agentic tasks by a large margin (65.5% vs 53.1% on a GAIA validation subset). I used freeact as agent scaffold.

<!-- gh-comment-id:2639064456 --> @krasserm commented on GitHub (Feb 6, 2025): One possible alternative to builtin function calling via JSON is to leverage DeepSeek-R1's strong coding capabilities and let the model generate *code actions* in Python. I [experimented with this approach](https://krasserm.github.io/2025/02/05/deepseek-r1-agent/) and found that it outperforms Claude 3.5 Sonnet on agentic tasks by a large margin (65.5% vs 53.1% on a GAIA validation subset). I used [freeact](https://github.com/gradion-ai/freeact) as agent scaffold.
Author
Owner

@sammcj commented on GitHub (Feb 9, 2025):

I've spent the past week testing DeepSeek R1 with Cline, Roo Coder and a number of other agentic coding tools using a combination of templates and prompting methods. While R1 is clearly a very capable model in general - in reality it's not practical to use (especially in production) due to it's lack of tool/function calling.

I believe what we need is a battle-tested template or fine tune from DeepSeek to enable reliable tool/function calling.

<!-- gh-comment-id:2646596620 --> @sammcj commented on GitHub (Feb 9, 2025): I've spent the past week testing DeepSeek R1 with Cline, Roo Coder and a number of other agentic coding tools using a combination of templates and prompting methods. While R1 is clearly a very capable model in general - in reality it's not practical to use (especially in production) due to it's lack of tool/function calling. I believe what we need is a battle-tested template or fine tune from DeepSeek to enable reliable tool/function calling.
Author
Owner

@thiner commented on GitHub (Feb 11, 2025):

DeepSeek just updated chat template in https://hf-mirror.com/deepseek-ai/DeepSeek-R1/blob/main/tokenizer_config.json two days ago. I think there is problem with the built-in template which blocks function call previously. You may update the chat template and try again.

<!-- gh-comment-id:2650046689 --> @thiner commented on GitHub (Feb 11, 2025): DeepSeek just updated chat template in https://hf-mirror.com/deepseek-ai/DeepSeek-R1/blob/main/tokenizer_config.json two days ago. I think there is problem with the built-in template which blocks function call previously. You may update the chat template and try again.
Author
Owner

@feedback9999 commented on GitHub (Feb 11, 2025):

view it on GitHub

---Original---
From: @.>
Date: Tue, Feb 11, 2025 15:52 PM
To: @.
>;
Cc: @.***>;
Subject: Re: [deepseek-ai/DeepSeek-R1] Function calling (Issue #9)

DeepSeek just updated chat template in https://hf-mirror.com/deepseek-ai/DeepSeek-R1/blob/main/tokenizer_config.json two days ago. I think there is problem with the built-in template which blocks function call previously. You may update the chat template and try again.

—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: @.***>

<!-- gh-comment-id:2650187364 --> @feedback9999 commented on GitHub (Feb 11, 2025): view it on GitHub ---Original--- From: ***@***.***&gt; Date: Tue, Feb 11, 2025 15:52 PM To: ***@***.***&gt;; Cc: ***@***.***&gt;; Subject: Re: [deepseek-ai/DeepSeek-R1] Function calling (Issue #9) DeepSeek just updated chat template in https://hf-mirror.com/deepseek-ai/DeepSeek-R1/blob/main/tokenizer_config.json two days ago. I think there is problem with the built-in template which blocks function call previously. You may update the chat template and try again. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: ***@***.***&gt;
Author
Owner

@icejean commented on GitHub (Feb 14, 2025):

支持函数调用应该成为DeepSeek R1目前优先级最高的事项。
因为DeepSeek R1开源、低成本、能力与OpenAI o1相当,现在国内大部分的云厂商都接入了DeepSeek,包括R1与V3,R1目前不支持工具调用,用于深度思考推理;V3支持函数调用,用于智能体Agent。这在调用云端API的应用场景下没有问题,云厂商在云端部署两个模型,应用分别调用R1与V3两个模型就好了。
但企业内网私有化部署的情况就很不相同了,考虑到数据保密、服务稳定以及集成进企业业务系统的需求,很多稍有规模的组织会优先考虑内网私有化部署DeepSeek R1满血版,企业级的应用各种蒸馏版难以胜任,必须是满血版,这需要一定的硬件投资。因此国内的各大厂商,从三大运营商到各头部云服务商等等,都推出了DeepSeek R1一体机的解决方案,通过1台或2台服务器在内网部署,成本大约在150万到200万RMB之间。
2025将是Agent应用的爆发之年,大模型在各种应用场景中落地应用,与业务系统集成,调用业务系统的API或业务功能去执行特定的任务,将是比问题问答更常见、更有用的LLM落地应用范式,就是AI可以自动化的去完成一些任务了。所以V3这样的函数调用功能是必须的,最好也有结构化输出的功能,方便与业务系统之间的数据交换。
另一方面,R1的深度思考推理能力非常出色,在提供合符真实世界运作逻辑的计划、推理、分析等业务场景中也是必不可少的,比如在GraphRAG的应用场景中,从企业积累的大量各种Wrod、PDF、txt等各种非结构化的文档中建立知识图谱,以知识图谱来支持RAG,即GraphRAG,回答问题就比普通RAG质量要高一个档次。因为普通RAG不管怎样优化文本块切分、检索和排序的算法,它都是线性的,无法像知识图谱一样反映现实世界中实体之间的真实逻辑。R1在从非结构化文档中提取实体关系来建立知识图谱这项任务上,表现要比OpenAI gtp-4o等没有思维链的模型要高一个档次,从它输出的思维链可以看到,它会自动处理文本语义中各种千变万化的情况,你不可能穷尽列举它们硬编码到代码中,R1类的思维链模型就非常适合这样的场景。
所以,在企业内网私有化部署的场景下,R1是必须的,V3的工具调用能力也是必须的,如果R1自己就有函数调用的能力,就可以节省一套服务器硬件150~200万的投资,很多企业上线以DeepSeek为核心的AI赋能项目就会容易很多,DeepSeek的普及会更快更广。

<!-- gh-comment-id:2658624624 --> @icejean commented on GitHub (Feb 14, 2025): 支持函数调用应该成为DeepSeek R1目前优先级最高的事项。 因为DeepSeek R1开源、低成本、能力与OpenAI o1相当,现在国内大部分的云厂商都接入了DeepSeek,包括R1与V3,R1目前不支持工具调用,用于深度思考推理;V3支持函数调用,用于智能体Agent。这在调用云端API的应用场景下没有问题,云厂商在云端部署两个模型,应用分别调用R1与V3两个模型就好了。 但企业内网私有化部署的情况就很不相同了,考虑到数据保密、服务稳定以及集成进企业业务系统的需求,很多稍有规模的组织会优先考虑内网私有化部署DeepSeek R1满血版,企业级的应用各种蒸馏版难以胜任,必须是满血版,这需要一定的硬件投资。因此国内的各大厂商,从三大运营商到各头部云服务商等等,都推出了DeepSeek R1一体机的解决方案,通过1台或2台服务器在内网部署,成本大约在150万到200万RMB之间。 2025将是Agent应用的爆发之年,大模型在各种应用场景中落地应用,与业务系统集成,调用业务系统的API或业务功能去执行特定的任务,将是比问题问答更常见、更有用的LLM落地应用范式,就是AI可以自动化的去完成一些任务了。所以V3这样的函数调用功能是必须的,最好也有结构化输出的功能,方便与业务系统之间的数据交换。 另一方面,R1的深度思考推理能力非常出色,在提供合符真实世界运作逻辑的计划、推理、分析等业务场景中也是必不可少的,比如在GraphRAG的应用场景中,从企业积累的大量各种Wrod、PDF、txt等各种非结构化的文档中建立知识图谱,以知识图谱来支持RAG,即GraphRAG,回答问题就比普通RAG质量要高一个档次。因为普通RAG不管怎样优化文本块切分、检索和排序的算法,它都是线性的,无法像知识图谱一样反映现实世界中实体之间的真实逻辑。R1在从非结构化文档中提取实体关系来建立知识图谱这项任务上,表现要比OpenAI gtp-4o等没有思维链的模型要高一个档次,从它输出的思维链可以看到,它会自动处理文本语义中各种千变万化的情况,你不可能穷尽列举它们硬编码到代码中,R1类的思维链模型就非常适合这样的场景。 所以,在企业内网私有化部署的场景下,R1是必须的,V3的工具调用能力也是必须的,如果R1自己就有函数调用的能力,就可以节省一套服务器硬件150~200万的投资,很多企业上线以DeepSeek为核心的AI赋能项目就会容易很多,DeepSeek的普及会更快更广。
Author
Owner

@hello2mao commented on GitHub (Feb 14, 2025):

+1

<!-- gh-comment-id:2658680270 --> @hello2mao commented on GitHub (Feb 14, 2025): +1
Author
Owner

@KelvinQiu802 commented on GitHub (Feb 16, 2025):

+1

<!-- gh-comment-id:2661242927 --> @KelvinQiu802 commented on GitHub (Feb 16, 2025): +1
Author
Owner

@issamovitch commented on GitHub (Feb 16, 2025):

x2 + 8

<!-- gh-comment-id:2661683985 --> @issamovitch commented on GitHub (Feb 16, 2025): x2 + 8
Author
Owner

@zhangshan123 commented on GitHub (Feb 18, 2025):

x2 + 9

<!-- gh-comment-id:2664860069 --> @zhangshan123 commented on GitHub (Feb 18, 2025): x2 + 9
Author
Owner

@hyacinthus commented on GitHub (Feb 19, 2025):

x2 + 10

<!-- gh-comment-id:2668518921 --> @hyacinthus commented on GitHub (Feb 19, 2025): x2 + 10
Author
Owner

@Superskyyy commented on GitHub (Feb 21, 2025):

DeepSeek just updated chat template in hf-mirror.com/deepseek-ai/DeepSeek-R1/blob/main/tokenizer_config.json two days ago. I think there is problem with the built-in template which blocks function call previously. You may update the chat template and try again.

No, this is just a best pratice to encourage model to think. In fact adding this template will break things (frontend UI) because they don't see the starting /Think anymore and will fail to render the thinking block.

<!-- gh-comment-id:2673485914 --> @Superskyyy commented on GitHub (Feb 21, 2025): > DeepSeek just updated chat template in [hf-mirror.com/deepseek-ai/DeepSeek-R1/blob/main/tokenizer_config.json](https://hf-mirror.com/deepseek-ai/DeepSeek-R1/blob/main/tokenizer_config.json) two days ago. I think there is problem with the built-in template which blocks function call previously. You may update the chat template and try again. No, this is just a best pratice to encourage model to think. In fact adding this template will break things (frontend UI) because they don't see the starting /Think anymore and will fail to render the thinking block.
Author
Owner

@GaoDalie commented on GitHub (Feb 23, 2025):

how i fix it
https://www.youtube.com/watch?v=_OTm88z9o54

<!-- gh-comment-id:2676720749 --> @GaoDalie commented on GitHub (Feb 23, 2025): how i fix it https://www.youtube.com/watch?v=_OTm88z9o54
Author
Owner

@elliotvilhelm commented on GitHub (Feb 26, 2025):

x1

<!-- gh-comment-id:2683702723 --> @elliotvilhelm commented on GitHub (Feb 26, 2025): x1
Author
Owner

@paulluap commented on GitHub (Feb 26, 2025):

+1, any news on function calling ?

<!-- gh-comment-id:2683726303 --> @paulluap commented on GitHub (Feb 26, 2025): +1, any news on function calling ?
Author
Owner

@tianyuansun commented on GitHub (Feb 26, 2025):

+1

<!-- gh-comment-id:2684161305 --> @tianyuansun commented on GitHub (Feb 26, 2025): +1
Author
Owner

@hnlisf commented on GitHub (Feb 28, 2025):

+1

<!-- gh-comment-id:2689469865 --> @hnlisf commented on GitHub (Feb 28, 2025): +1
Author
Owner

@nbarbettini commented on GitHub (Feb 28, 2025):

You don't need to comment with +1 -- just click the 👍 on the top comment. And if you want to be subscribed to updates, click the "Subscribe" button on the right.

Otherwise all of our inboxes are flooded with "+1" messages 😉

<!-- gh-comment-id:2691247796 --> @nbarbettini commented on GitHub (Feb 28, 2025): You don't need to comment with +1 -- just click the 👍 on the top comment. And if you want to be subscribed to updates, click the "Subscribe" button on the right. Otherwise all of our inboxes are flooded with "+1" messages 😉
Author
Owner

@K0IN commented on GitHub (Feb 28, 2025):

You don't need to comment with +1 -- just click the 👍 on the top comment. And if you want to be subscribed to updates, click the "Subscribe" button on the right.

Otherwise all of our inboxes are flooded with "+1" messages 😉

+1

<!-- gh-comment-id:2691708714 --> @K0IN commented on GitHub (Feb 28, 2025): > You don't need to comment with +1 -- just click the 👍 on the top comment. And if you want to be subscribed to updates, click the "Subscribe" button on the right. > > Otherwise all of our inboxes are flooded with "+1" messages 😉 +1
Author
Owner

@zgpnuaa commented on GitHub (Mar 17, 2025):

+1 期待早日实现函数调用,将会大大增强deepseek在各种需要精确分析领域的利用率。

<!-- gh-comment-id:2728428024 --> @zgpnuaa commented on GitHub (Mar 17, 2025): +1 期待早日实现函数调用,将会大大增强deepseek在各种需要精确分析领域的利用率。
Author
Owner

@FingerLiu commented on GitHub (Mar 18, 2025):

Is this bug on the engineering side or the algorithm side?

<!-- gh-comment-id:2731520120 --> @FingerLiu commented on GitHub (Mar 18, 2025): Is this bug on the engineering side or the algorithm side?
Author
Owner

@zzzzzzzs commented on GitHub (Mar 18, 2025):

+1

<!-- gh-comment-id:2733575710 --> @zzzzzzzs commented on GitHub (Mar 18, 2025): +1
Author
Owner

@ParadeTo commented on GitHub (Mar 19, 2025):

+1

<!-- gh-comment-id:2735160735 --> @ParadeTo commented on GitHub (Mar 19, 2025): +1
Author
Owner

@oneWalker commented on GitHub (Mar 20, 2025):

Is this bug on the engineering side or the algorithm side?

I think the devs are considering the standard of it. after all, the new standard about MCP is more relevant to the feature. They may choose the MCP general standard. Of course, it's just my guess.

<!-- gh-comment-id:2740986269 --> @oneWalker commented on GitHub (Mar 20, 2025): > Is this bug on the engineering side or the algorithm side? I think the devs are considering the standard of it. after all, the new standard about MCP is more relevant to the feature. They may choose the MCP general standard. Of course, it's just my guess.
Author
Owner

@shtse8 commented on GitHub (Mar 23, 2025):

停止無意義的 +1 回應,支持的可以直接點讚就好。

Stop posting meaningless +1 replies. If you support it, just click like.

<!-- gh-comment-id:2746478506 --> @shtse8 commented on GitHub (Mar 23, 2025): 停止無意義的 +1 回應,支持的可以直接點讚就好。 Stop posting meaningless +1 replies. If you support it, just click like.
Author
Owner

@reatang commented on GitHub (Mar 27, 2025):

deepseep-v3-0324 已经到来,朋友们还是让r1做好 reasoning吧

<!-- gh-comment-id:2758414224 --> @reatang commented on GitHub (Mar 27, 2025): deepseep-v3-0324 已经到来,朋友们还是让r1做好 reasoning吧
Author
Owner

@phpmac commented on GitHub (Mar 27, 2025):

让deepseek再次伟大!

<!-- gh-comment-id:2758423564 --> @phpmac commented on GitHub (Mar 27, 2025): 让deepseek再次伟大!
Author
Owner

@TonyGeez commented on GitHub (Apr 28, 2025):

I think it will be a better approach to first fix the almost unusable function calling on V3 which is actually "support it".

<!-- gh-comment-id:2833948512 --> @TonyGeez commented on GitHub (Apr 28, 2025): I think it will be a better approach to first fix the almost unusable function calling on V3 which is actually "support it".
Author
Owner

@flamezhang commented on GitHub (Apr 28, 2025):

x2 + 6

<!-- gh-comment-id:2835016853 --> @flamezhang commented on GitHub (Apr 28, 2025): x2 + 6
Author
Owner

@aaronvg commented on GitHub (Apr 29, 2025):

We got function-calling to work with R1 using our framework BAML: https://www.boundaryml.com/blog/deepseek-r1-function-calling . We haven't had any issues making it spit out structured data.

It doesn't need tool-apis or whatnot, we just serialize types into the prompt in an efficient way, and parse the output using a custom JSON parser to handle missing quotes etc.

Let us know if you do. Here is our open-source repo: https://github.com/BoundaryML/baml

note this still works with v3!

<!-- gh-comment-id:2839971547 --> @aaronvg commented on GitHub (Apr 29, 2025): > We got function-calling to work with R1 using our framework BAML: https://www.boundaryml.com/blog/deepseek-r1-function-calling . We haven't had any issues making it spit out structured data. > > It doesn't need tool-apis or whatnot, we just serialize types into the prompt in an efficient way, and parse the output using a custom JSON parser to handle missing quotes etc. > > Let us know if you do. Here is our open-source repo: https://github.com/BoundaryML/baml note this still works with v3!
Author
Owner

@BradKML commented on GitHub (May 27, 2025):

Can someone help out here? Especially for @aaronvg please make them work with agent coding tools for both debugging and feature development in more complex codebases https://github.com/cline/cline/discussions/3845
Also, cross-reference to some of the weird v3 issues https://github.com/deepseek-ai/DeepSeek-V3/issues/826 https://github.com/deepseek-ai/DeepSeek-V3/issues/302

<!-- gh-comment-id:2911122928 --> @BradKML commented on GitHub (May 27, 2025): Can someone help out here? Especially for @aaronvg please make them work with agent coding tools for both debugging and feature development in more complex codebases https://github.com/cline/cline/discussions/3845 Also, cross-reference to some of the weird v3 issues https://github.com/deepseek-ai/DeepSeek-V3/issues/826 https://github.com/deepseek-ai/DeepSeek-V3/issues/302
Author
Owner

@chunlea commented on GitHub (May 29, 2025):

https://api-docs.deepseek.com/news/news250528 mentioned the new DeepSeek-R1-0528 release support for functional calling and JSON outputs. Can we assume this issue has been done?

<!-- gh-comment-id:2919515961 --> @chunlea commented on GitHub (May 29, 2025): https://api-docs.deepseek.com/news/news250528 mentioned the new DeepSeek-R1-0528 release support for functional calling and JSON outputs. Can we assume this issue has been done?
Author
Owner

@flamezhang commented on GitHub (May 29, 2025):

No, the stability is not very good. Sometimes the function call will not be executed.

---- Replied Message ----
| From | @.> |
| Date | 05/29/2025 22:05 |
| To | deepseek-ai/DeepSeek-R1 @.
> |
| Cc | flame @.>,
Comment @.
> |
| Subject | Re: [deepseek-ai/DeepSeek-R1] Function calling (Issue #9) |
chunlea left a comment (deepseek-ai/DeepSeek-R1#9)

https://api-docs.deepseek.com/news/news250528 mentioned the new DeepSeek-R1-0528 release support for functional calling and JSON outputs. Can we assume this issue has been done?

—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: @.***>

<!-- gh-comment-id:2919890535 --> @flamezhang commented on GitHub (May 29, 2025): No, the stability is not very good. Sometimes the function call will not be executed. ---- Replied Message ---- | From | ***@***.***> | | Date | 05/29/2025 22:05 | | To | deepseek-ai/DeepSeek-R1 ***@***.***> | | Cc | flame ***@***.***>, Comment ***@***.***> | | Subject | Re: [deepseek-ai/DeepSeek-R1] Function calling (Issue #9) | chunlea left a comment (deepseek-ai/DeepSeek-R1#9) https://api-docs.deepseek.com/news/news250528 mentioned the new DeepSeek-R1-0528 release support for functional calling and JSON outputs. Can we assume this issue has been done? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: ***@***.***>
Author
Owner

@BradKML commented on GitHub (May 30, 2025):

Noted with thanks,are there any root cause for this with Ollama or OpenRouter, with RooCode / Cline or other IDEs, and maybe tools like OpenHands?

<!-- gh-comment-id:2921005773 --> @BradKML commented on GitHub (May 30, 2025): Noted with thanks,are there any root cause for this with Ollama or OpenRouter, with RooCode / Cline or other IDEs, and maybe tools like OpenHands?
Author
Owner

@r1di commented on GitHub (May 30, 2025):

https://api-docs.deepseek.com/news/news250528 mentioned the new DeepSeek-R1-0528 release support for functional calling and JSON outputs. Can we assume this issue has been done?

nope, still issues(tested in cursor).

<!-- gh-comment-id:2922725554 --> @r1di commented on GitHub (May 30, 2025): > https://api-docs.deepseek.com/news/news250528 mentioned the new DeepSeek-R1-0528 release support for functional calling and JSON outputs. Can we assume this issue has been done? nope, still issues(tested in cursor).
Author
Owner

@alertzcomp commented on GitHub (May 30, 2025):

No, the stability is not very good. Sometimes the function call will not be executed.
…

I've also got different scores/results in "tool_calls" vs "reasoning_content". Do you know if function call is executed after or before reasoning?

UPD. Day later.

Ok as per https://api-docs.deepseek.com/guides/reasoning_model it does use "reasoning_content" for "content" where function call happens.

Speaking about the function calling itself the tool_choice is not supported but out of 300 calls I've got 6 one time retry attempts where there were no function calls done. So just implement retry and this issue could be called done 👍🏻

The only issue is that it seems that function calling of the content and the reasoning_content CoT often seem to not align in their decision making at all.

<!-- gh-comment-id:2923283645 --> @alertzcomp commented on GitHub (May 30, 2025): > No, the stability is not very good. Sometimes the function call will not be executed. > […](#) I've also got different scores/results in "tool_calls" vs "reasoning_content". Do you know if function call is executed after or before reasoning? **UPD. Day later.** Ok as per https://api-docs.deepseek.com/guides/reasoning_model it does use "reasoning_content" for "content" where function call happens. Speaking about the function calling itself the `tool_choice` is not supported but out of 300 calls I've got 6 one time retry attempts where there were no function calls done. So just implement retry and this issue could be called done 👍🏻 The only issue is that it seems that function calling of the `content` and the `reasoning_content` CoT often seem to not align in their decision making at all.
Author
Owner

@github-actions[bot] commented on GitHub (Jul 2, 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:3025892307 --> @github-actions[bot] commented on GitHub (Jul 2, 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

@Kayra commented on GitHub (Jul 11, 2025):

@engalisabry Any update on this? I'm hoping to use r1 as an NLP API and having consistent JSON output is critical, thanks!

For others still looking, there's an alternative here that "works" (your mileage may vary) with ollama: https://ollama.com/MFDoom/deepseek-r1-tool-calling

<!-- gh-comment-id:3062216010 --> @Kayra commented on GitHub (Jul 11, 2025): @engalisabry Any update on this? I'm hoping to use r1 as an NLP API and having consistent JSON output is critical, thanks! For others still looking, there's an alternative here that "works" (your mileage may vary) with ollama: https://ollama.com/MFDoom/deepseek-r1-tool-calling
Author
Owner

@github-actions[bot] commented on GitHub (Aug 11, 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:3172988853 --> @github-actions[bot] commented on GitHub (Aug 11, 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

@BradKML commented on GitHub (Aug 11, 2025):

Keep this up, native function calling Should still be important, and @Kayra please check the other config-makers as well https://github.com/RooCodeInc/Roo-Code/discussions/1508#discussioncomment-13291453

<!-- gh-comment-id:3173073853 --> @BradKML commented on GitHub (Aug 11, 2025): Keep this up, native function calling Should still be important, and @Kayra please check the other config-makers as well https://github.com/RooCodeInc/Roo-Code/discussions/1508#discussioncomment-13291453
Author
Owner

@edenreich commented on GitHub (Aug 20, 2025):

When would this be implemented, I need it for the CLI.

https://github.com/inference-gateway/cli/issues/84

Also would be cool to know when the API call is happening with tools being passed to deepseek-reasoner model does it fall back to deepseek-chat? or is it actually running deepseek-reasoner with tool calling and we just don't see the reasoning_content?

<!-- gh-comment-id:3206595838 --> @edenreich commented on GitHub (Aug 20, 2025): When would this be implemented, I need it for the CLI. https://github.com/inference-gateway/cli/issues/84 Also would be cool to know when the API call is happening with tools being passed to deepseek-reasoner model does it fall back to deepseek-chat? or is it actually running deepseek-reasoner with tool calling and we just don't see the reasoning_content?
Author
Owner

@github-actions[bot] commented on GitHub (Oct 17, 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:3413303499 --> @github-actions[bot] commented on GitHub (Oct 17, 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 (Oct 31, 2025):

false

<!-- gh-comment-id:3470764784 --> @github-actions[bot] commented on GitHub (Oct 31, 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#9
No description provided.