Skip to content

Conversation

@Scra3
Copy link
Member

@Scra3 Scra3 commented Jan 26, 2026

Add parallel_tool_calls parameter to DispatchBody to match OpenAI API. When set to false, the model will call at most one tool per request.

Definition of Done

General

  • Write an explicit title for the Pull Request, following Conventional Commits specification
  • Test manually the implemented changes
  • Validate the code quality (indentation, syntax, style, simplicity, readability)

Security

  • Consider the security impact of the changes made

Add parallel_tool_calls parameter to DispatchBody to match OpenAI API.
When set to false, the model will call at most one tool per request.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@qltysh
Copy link

qltysh bot commented Jan 26, 2026

All good ✅

@qltysh
Copy link

qltysh bot commented Jan 26, 2026

Qlty

Coverage Impact

This PR will not change total coverage.

🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

Simplify dispatch() by inlining the tools binding logic directly,
removing unnecessary method indirection for simple null check.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
}
}

private bindToolsIfNeeded(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

simplify by adding a one liner

Comment on lines +108 to +116
tool_choice: toolChoice,
parallel_tool_calls: parallelToolCalls,
} = body;

const enrichedTools = this.enrichToolDefinitions(tools);
const model = this.bindToolsIfNeeded(this.chatModel, enrichedTools, toolChoice);
const model = enrichedTools?.length
? this.chatModel.bindTools(enrichedTools, {
tool_choice: toolChoice,
parallel_tool_calls: parallelToolCalls,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
tool_choice: toolChoice,
parallel_tool_calls: parallelToolCalls,
} = body;
const enrichedTools = this.enrichToolDefinitions(tools);
const model = this.bindToolsIfNeeded(this.chatModel, enrichedTools, toolChoice);
const model = enrichedTools?.length
? this.chatModel.bindTools(enrichedTools, {
tool_choice: toolChoice,
parallel_tool_calls: parallelToolCalls,
// eslint-disable-next-line @typescript-eslint/naming-convention
const { tools, messages, tool_choice, parallel_tool_calls } = body;
const enrichedTools = this.enrichToolDefinitions(tools);
const model = enrichedTools?.length
? this.chatModel.bindTools(enrichedTools, {
tool_choice,
parallel_tool_calls,

@Scra3 Scra3 merged commit ed3d091 into main Jan 27, 2026
31 of 32 checks passed
@Scra3 Scra3 deleted the feat/ai-proxy-parallel-tool-calls branch January 27, 2026 12:21
forest-bot added a commit that referenced this pull request Jan 27, 2026
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.

4 participants