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
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:
Post-Processing Outputs:
Use a script to parse the model’s responses into structured formats (e.g., JSON).
Example:
importjsonresponse=model.generate("Extract the following data as JSON: ...")
structured_data=json.loads(response)
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: ...
Custom Wrapper:
Build a custom wrapper around the model to simulate function calling behavior.
Example:
defcall_function(model, function_name, args):
prompt=f"Call function {function_name} with args {args} and return the result."returnmodel.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.
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.
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.
---- 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: ***@***.***>
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.
Activity
FORNDODAper commentedon Jan 21, 2025
x2
('x2' stands for 'yeah, i would like to know that too')
reatang commentedon Jan 21, 2025
x2 + 1
flyfish101 commentedon Jan 21, 2025
x2 + 2
liberty-rapid commentedon Jan 21, 2025
x2 + 3
lzl-mt commentedon Jan 21, 2025
x2 + 4
juanjopc commentedon Jan 21, 2025
x2 + 5
engalisabry commentedon 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
Future Plans
Timeline
Workarounds for Now
If you need structured outputs or function-like behavior in the meantime, here are some workarounds:
Post-Processing Outputs:
Prompt Engineering:
Custom Wrapper:
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
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.
ibndias commentedon Jan 22, 2025
Use R1 as the master brain for tool decision / plan, and rewrite the output in structure with another model.
jacobpretorius commentedon 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.
Add function calling and structured outputs support
Chrisbattarbee commentedon Jan 22, 2025
Also looking for this
feliks912 commentedon Jan 23, 2025
Bump, definitely bump
jayeew commentedon Jan 23, 2025
When will R1 support agent?
letscagefdn commentedon Jan 23, 2025
response_format: { type: 'json_object' }
54 remaining items
TonyGeez commentedon 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".
flamezhang commentedon Apr 28, 2025
x2 + 6
aaronvg commentedon Apr 29, 2025
note this still works with v3!
BradKML commentedon 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 cline/cline#3845
Also, cross-reference to some of the weird v3 issues deepseek-ai/DeepSeek-V3#826 deepseek-ai/DeepSeek-V3#302
chunlea commentedon 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?
flamezhang commentedon May 29, 2025
BradKML commentedon 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?
r1di commentedon May 30, 2025
nope, still issues(tested in cursor).
aleksei-melinic commentedon May 30, 2025
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 thereasoning_content
CoT often seem to not align in their decision making at all.