Skip to content

Commit bfde3d2

Browse files
feat(api): add support for disabling tool calls (#888)
1 parent 4d3ec5e commit bfde3d2

14 files changed

+57
-23
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 21
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic-129d8719c17bc9ea6e310a63400f60e7ad3ef828e54265eb8a8035684187210b.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic-fd7537a41646cd9253c04f350436c5471e4762750fce8ca8f1909a3052d98608.yml

api.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ from anthropic.types import (
8181
ToolChoice,
8282
ToolChoiceAny,
8383
ToolChoiceAuto,
84+
ToolChoiceNone,
8485
ToolChoiceTool,
8586
ToolResultBlockParam,
8687
ToolTextEditor20250124,
@@ -230,6 +231,7 @@ from anthropic.types.beta import (
230231
BetaToolChoice,
231232
BetaToolChoiceAny,
232233
BetaToolChoiceAuto,
234+
BetaToolChoiceNone,
233235
BetaToolChoiceTool,
234236
BetaToolComputerUse20241022,
235237
BetaToolComputerUse20250124,

src/anthropic/resources/beta/messages/messages.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ def create(
256256
for details.
257257
258258
tool_choice: How the model should use the provided tools. The model can use a specific tool,
259-
any available tool, or decide by itself.
259+
any available tool, decide by itself, or not use tools at all.
260260
261261
tools: Definitions of tools that the model may use.
262262
@@ -535,7 +535,7 @@ def create(
535535
for details.
536536
537537
tool_choice: How the model should use the provided tools. The model can use a specific tool,
538-
any available tool, or decide by itself.
538+
any available tool, decide by itself, or not use tools at all.
539539
540540
tools: Definitions of tools that the model may use.
541541
@@ -814,7 +814,7 @@ def create(
814814
for details.
815815
816816
tool_choice: How the model should use the provided tools. The model can use a specific tool,
817-
any available tool, or decide by itself.
817+
any available tool, decide by itself, or not use tools at all.
818818
819819
tools: Definitions of tools that the model may use.
820820
@@ -1177,7 +1177,7 @@ def count_tokens(
11771177
for details.
11781178
11791179
tool_choice: How the model should use the provided tools. The model can use a specific tool,
1180-
any available tool, or decide by itself.
1180+
any available tool, decide by itself, or not use tools at all.
11811181
11821182
tools: Definitions of tools that the model may use.
11831183
@@ -1491,7 +1491,7 @@ async def create(
14911491
for details.
14921492
14931493
tool_choice: How the model should use the provided tools. The model can use a specific tool,
1494-
any available tool, or decide by itself.
1494+
any available tool, decide by itself, or not use tools at all.
14951495
14961496
tools: Definitions of tools that the model may use.
14971497
@@ -1770,7 +1770,7 @@ async def create(
17701770
for details.
17711771
17721772
tool_choice: How the model should use the provided tools. The model can use a specific tool,
1773-
any available tool, or decide by itself.
1773+
any available tool, decide by itself, or not use tools at all.
17741774
17751775
tools: Definitions of tools that the model may use.
17761776
@@ -2049,7 +2049,7 @@ async def create(
20492049
for details.
20502050
20512051
tool_choice: How the model should use the provided tools. The model can use a specific tool,
2052-
any available tool, or decide by itself.
2052+
any available tool, decide by itself, or not use tools at all.
20532053
20542054
tools: Definitions of tools that the model may use.
20552055
@@ -2410,7 +2410,7 @@ async def count_tokens(
24102410
for details.
24112411
24122412
tool_choice: How the model should use the provided tools. The model can use a specific tool,
2413-
any available tool, or decide by itself.
2413+
any available tool, decide by itself, or not use tools at all.
24142414
24152415
tools: Definitions of tools that the model may use.
24162416

src/anthropic/resources/messages/messages.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ def create(
264264
for details.
265265
266266
tool_choice: How the model should use the provided tools. The model can use a specific tool,
267-
any available tool, or decide by itself.
267+
any available tool, decide by itself, or not use tools at all.
268268
269269
tools: Definitions of tools that the model may use.
270270
@@ -540,7 +540,7 @@ def create(
540540
for details.
541541
542542
tool_choice: How the model should use the provided tools. The model can use a specific tool,
543-
any available tool, or decide by itself.
543+
any available tool, decide by itself, or not use tools at all.
544544
545545
tools: Definitions of tools that the model may use.
546546
@@ -816,7 +816,7 @@ def create(
816816
for details.
817817
818818
tool_choice: How the model should use the provided tools. The model can use a specific tool,
819-
any available tool, or decide by itself.
819+
any available tool, decide by itself, or not use tools at all.
820820
821821
tools: Definitions of tools that the model may use.
822822
@@ -1176,7 +1176,7 @@ def count_tokens(
11761176
for details.
11771177
11781178
tool_choice: How the model should use the provided tools. The model can use a specific tool,
1179-
any available tool, or decide by itself.
1179+
any available tool, decide by itself, or not use tools at all.
11801180
11811181
tools: Definitions of tools that the model may use.
11821182
@@ -1476,7 +1476,7 @@ async def create(
14761476
for details.
14771477
14781478
tool_choice: How the model should use the provided tools. The model can use a specific tool,
1479-
any available tool, or decide by itself.
1479+
any available tool, decide by itself, or not use tools at all.
14801480
14811481
tools: Definitions of tools that the model may use.
14821482
@@ -1752,7 +1752,7 @@ async def create(
17521752
for details.
17531753
17541754
tool_choice: How the model should use the provided tools. The model can use a specific tool,
1755-
any available tool, or decide by itself.
1755+
any available tool, decide by itself, or not use tools at all.
17561756
17571757
tools: Definitions of tools that the model may use.
17581758
@@ -2028,7 +2028,7 @@ async def create(
20282028
for details.
20292029
20302030
tool_choice: How the model should use the provided tools. The model can use a specific tool,
2031-
any available tool, or decide by itself.
2031+
any available tool, decide by itself, or not use tools at all.
20322032
20332033
tools: Definitions of tools that the model may use.
20342034
@@ -2387,7 +2387,7 @@ async def count_tokens(
23872387
for details.
23882388
23892389
tool_choice: How the model should use the provided tools. The model can use a specific tool,
2390-
any available tool, or decide by itself.
2390+
any available tool, decide by itself, or not use tools at all.
23912391
23922392
tools: Definitions of tools that the model may use.
23932393

src/anthropic/types/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
from .citations_config_param import CitationsConfigParam as CitationsConfigParam
6969
from .raw_message_stop_event import RawMessageStopEvent as RawMessageStopEvent
7070
from .tool_choice_auto_param import ToolChoiceAutoParam as ToolChoiceAutoParam
71+
from .tool_choice_none_param import ToolChoiceNoneParam as ToolChoiceNoneParam
7172
from .tool_choice_tool_param import ToolChoiceToolParam as ToolChoiceToolParam
7273
from .url_image_source_param import URLImageSourceParam as URLImageSourceParam
7374
from .base64_pdf_source_param import Base64PDFSourceParam as Base64PDFSourceParam

src/anthropic/types/beta/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
from .beta_citations_config_param import BetaCitationsConfigParam as BetaCitationsConfigParam
4040
from .beta_raw_message_stop_event import BetaRawMessageStopEvent as BetaRawMessageStopEvent
4141
from .beta_tool_choice_auto_param import BetaToolChoiceAutoParam as BetaToolChoiceAutoParam
42+
from .beta_tool_choice_none_param import BetaToolChoiceNoneParam as BetaToolChoiceNoneParam
4243
from .beta_tool_choice_tool_param import BetaToolChoiceToolParam as BetaToolChoiceToolParam
4344
from .beta_url_image_source_param import BetaURLImageSourceParam as BetaURLImageSourceParam
4445
from .message_count_tokens_params import MessageCountTokensParams as MessageCountTokensParams
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing_extensions import Literal, Required, TypedDict
6+
7+
__all__ = ["BetaToolChoiceNoneParam"]
8+
9+
10+
class BetaToolChoiceNoneParam(TypedDict, total=False):
11+
type: Required[Literal["none"]]

src/anthropic/types/beta/beta_tool_choice_param.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@
77

88
from .beta_tool_choice_any_param import BetaToolChoiceAnyParam
99
from .beta_tool_choice_auto_param import BetaToolChoiceAutoParam
10+
from .beta_tool_choice_none_param import BetaToolChoiceNoneParam
1011
from .beta_tool_choice_tool_param import BetaToolChoiceToolParam
1112

1213
__all__ = ["BetaToolChoiceParam"]
1314

14-
BetaToolChoiceParam: TypeAlias = Union[BetaToolChoiceAutoParam, BetaToolChoiceAnyParam, BetaToolChoiceToolParam]
15+
BetaToolChoiceParam: TypeAlias = Union[
16+
BetaToolChoiceAutoParam, BetaToolChoiceAnyParam, BetaToolChoiceToolParam, BetaToolChoiceNoneParam
17+
]

src/anthropic/types/beta/message_count_tokens_params.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ class MessageCountTokensParams(TypedDict, total=False):
143143
tool_choice: BetaToolChoiceParam
144144
"""How the model should use the provided tools.
145145
146-
The model can use a specific tool, any available tool, or decide by itself.
146+
The model can use a specific tool, any available tool, decide by itself, or not
147+
use tools at all.
147148
"""
148149

149150
tools: Iterable[Tool]

src/anthropic/types/beta/message_create_params.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,8 @@ class MessageCreateParamsBase(TypedDict, total=False):
174174
tool_choice: BetaToolChoiceParam
175175
"""How the model should use the provided tools.
176176
177-
The model can use a specific tool, any available tool, or decide by itself.
177+
The model can use a specific tool, any available tool, decide by itself, or not
178+
use tools at all.
178179
"""
179180

180181
tools: Iterable[BetaToolUnionParam]

0 commit comments

Comments
 (0)