Skip to content

Conversation

adase11
Copy link
Contributor

@adase11 adase11 commented Oct 15, 2025

This pull request resolves #4635 by adding support for the tool_choice parameter in the Anthropic API.

Anthropic docs: https://docs.claude.com/en/api/messages#body-tool-choice

@adase11 adase11 force-pushed the GH-4635-anthropic-tool-choice branch from 5553b08 to 9528741 Compare October 15, 2025 17:00
@adase11 adase11 marked this pull request as ready for review October 15, 2025 17:04
@tzolov tzolov self-assigned this Oct 16, 2025
tzolov added a commit that referenced this pull request Oct 16, 2025
Add support for Anthropic's tool_choice parameter, allowing fine-grained
control over how the model uses provided tools. This feature enables users
to force, prevent, or influence tool usage behavior.

- Add ToolChoice interface with four implementations: ToolChoiceAuto,
  ToolChoiceAny, ToolChoiceTool, and ToolChoiceNone
- Add toolChoice field to AnthropicChatOptions with builder support
- Add toolChoice parameter to ChatCompletionRequest
- Create StringToToolChoiceConverter for property binding from JSON strings
- Add integration tests for all tool choice modes
- Add documentation with usage examples

Signed-off-by: Austin Dase <[email protected]>
Co-authored-by: Christian Tzolov <[email protected]>
@tzolov
Copy link
Contributor

tzolov commented Oct 16, 2025

Thank you @adase11
I've added a StringToToolChoiceConverter for property binding from JSON strings. We should support declarative (e.g. properties) along with programing interface

@tzolov tzolov added this to the 1.1.0.M4 milestone Oct 16, 2025
@tzolov
Copy link
Contributor

tzolov commented Oct 16, 2025

Rebased, added StringToToolChoiceConverter and merged at 0f75982

@tzolov tzolov closed this Oct 16, 2025
@adase11
Copy link
Contributor Author

adase11 commented Oct 16, 2025

Awesome thanks @tzolov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add ToolChoice Support for Anthropic API

3 participants