Skip to content

fix(anthropic): add support for tool_choice=none#1477

Merged
VisargD merged 1 commit into
Portkey-AI:mainfrom
ShivamB25:fix/anthropic-tool-choice-none
Dec 22, 2025
Merged

fix(anthropic): add support for tool_choice=none#1477
VisargD merged 1 commit into
Portkey-AI:mainfrom
ShivamB25:fix/anthropic-tool-choice-none

Conversation

@ShivamB25

Copy link
Copy Markdown
Contributor

Summary

  • Adds support for tool_choice="none" in the Anthropic provider

Problem

Portkey doesn't accept tool_choice="none" for Anthropic models, even though the provider already supports it since February 2025 (release notes).

Solution

Added handling for tool_choice === 'none' in the transform function to return { type: 'none' } instead of silently ignoring it.

Changes

  • Updated src/providers/anthropic/chatComplete.ts to handle the 'none' string value
  • Removed outdated comment stating "None is not supported by Anthropic"

Fixes #1474

Anthropic added support for tool_choice: {type: 'none'} in February 2025.
This change adds handling for the 'none' value in the tool_choice transform
function to return {type: 'none'} instead of silently ignoring it.

Fixes #1474
@VisargD VisargD merged commit 39cd275 into Portkey-AI:main Dec 22, 2025
1 check passed
@ShivamB25 ShivamB25 deleted the fix/anthropic-tool-choice-none branch December 22, 2025 06:33
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.

[anthropic] tool_choice=none doesn't work

2 participants