Skip to content

fix: support multiple parallel tool calls in DeepSeek V3 parser (#989) - #1365

Merged
teknium1 merged 1 commit into
NousResearch:mainfrom
mr-emmett-one:fix/deepseek-multi-tool-calls-989
Mar 15, 2026
Merged

fix: support multiple parallel tool calls in DeepSeek V3 parser (#989)#1365
teknium1 merged 1 commit into
NousResearch:mainfrom
mr-emmett-one:fix/deepseek-multi-tool-calls-989

Conversation

@mr-emmett-one

Copy link
Copy Markdown
Contributor

What does this PR do?

This PR fixes a limitation in the DeepSeek V3 parser where only the first tool call was being captured.

Changes included:

  • Refactored the regex pattern to handle varied whitespace and newlines for better robustness.
  • Replaced the logic to iterate through ALL tool call blocks using finditer instead of stopping at the first match.
  • Ensured full extraction of multiple tool calls, enabling complex parallel agentic workflows.
  • Added error logging for failed parsing attempts to aid debugging.

Related Issue

Fixes #989

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)

How has this been tested?

  • Verified with multi-tool call sequences to ensure all actions are correctly parsed into ChatCompletionMessageToolCall objects.

…Research#989)

- Refactored regex pattern to handle varied whitespace and newlines for better robustness.
- Replaced logic to iterate through all tool call blocks using finditer instead of stopping at the first match.
- Ensured full extraction of multiple tool calls for complex agentic workflows.
- Added error logging for failed parsing attempts.
@teknium1
teknium1 merged commit 15bf0b4 into NousResearch:main Mar 15, 2026
angelburgosrosado pushed a commit to angelburgosrosado/hermes-agent that referenced this pull request Apr 27, 2026
…multi-tool-calls-989

fix: support multiple parallel tool calls in DeepSeek V3 parser (NousResearch#989)
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
…multi-tool-calls-989

fix: support multiple parallel tool calls in DeepSeek V3 parser (NousResearch#989)
waefrebeorn pushed a commit to waefrebeorn/slermes that referenced this pull request Jul 2, 2026
…multi-tool-calls-989

fix: support multiple parallel tool calls in DeepSeek V3 parser (NousResearch#989)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DeepSeek V3 parser drops tool calls when model returns multiple

2 participants