@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 7cdba98edf
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 7, 07:45 UTC

[BugFix] Support tool_choice=none in the Anthropic API (#35835)

Signed-off-by: ZhongsJie <zhongsjie@gmail.com> Co-authored-by: Chauncey <chaunceyjiang@gmail.com>

ShiJie Zhong committed Mar 4, 2026 at 13:24 UTC 7cdba98edf15f695d74f50a0fbe6882eb393f5cf
2 files changed +3 -1
vllm/entrypoints/anthropic/protocol.py
+1 -1
@@ -77,7 +77,7 @@ class AnthropicTool(BaseModel):
77 class AnthropicToolChoice(BaseModel):
78 """Tool Choice definition"""
79
80 - type: Literal["auto", "any", "tool"]
80 + type: Literal["auto", "any", "tool", "none"]
81 name: str | None = None
82
83 @model_validator(mode="after")
vllm/entrypoints/anthropic/serving.py
+2
@@ -349,6 +349,8 @@ class AnthropicServingMessages(OpenAIServingChat):
349 req.tool_choice = "auto"
350 elif tool_choice_type == "any":
351 req.tool_choice = "required"
352 + elif tool_choice_type == "none":
353 + req.tool_choice = "none"
354 elif tool_choice_type == "tool":
355 req.tool_choice = ChatCompletionNamedToolChoiceParam.model_validate(
356 {