Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 9079a99

Browse files
stainless-app[bot]stainless-bot
authored andcommittedOct 3, 2024·
feat(api): support disabling parallel tool use (#674)
1 parent a03414e commit 9079a99

File tree

5 files changed

+75
-9
lines changed

5 files changed

+75
-9
lines changed
 

‎.stats.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 3
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic-fb94a03f85580f7eacef034518becfb463502e6d74b0f7932f6153239de23a5b.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic-209cf750b141ebe030a31486ce555fa23b87436cd4235e997b989dfe70dd1b0b.yml

‎src/anthropic/types/beta/prompt_caching/message_create_params.py

+21
Original file line numberDiff line numberDiff line change
@@ -275,17 +275,38 @@ class Metadata(TypedDict, total=False):
275275
class ToolChoiceToolChoiceAuto(TypedDict, total=False):
276276
type: Required[Literal["auto"]]
277277

278+
disable_parallel_tool_use: bool
279+
"""Whether to disable parallel tool use.
280+
281+
Defaults to `false`. If set to `true`, the model will output at most one tool
282+
use.
283+
"""
284+
278285

279286
class ToolChoiceToolChoiceAny(TypedDict, total=False):
280287
type: Required[Literal["any"]]
281288

289+
disable_parallel_tool_use: bool
290+
"""Whether to disable parallel tool use.
291+
292+
Defaults to `false`. If set to `true`, the model will output exactly one tool
293+
use.
294+
"""
295+
282296

283297
class ToolChoiceToolChoiceTool(TypedDict, total=False):
284298
name: Required[str]
285299
"""The name of the tool to use."""
286300

287301
type: Required[Literal["tool"]]
288302

303+
disable_parallel_tool_use: bool
304+
"""Whether to disable parallel tool use.
305+
306+
Defaults to `false`. If set to `true`, the model will output exactly one tool
307+
use.
308+
"""
309+
289310

290311
ToolChoice: TypeAlias = Union[ToolChoiceToolChoiceAuto, ToolChoiceToolChoiceAny, ToolChoiceToolChoiceTool]
291312

‎src/anthropic/types/message_create_params.py

+21
Original file line numberDiff line numberDiff line change
@@ -275,17 +275,38 @@ class Metadata(TypedDict, total=False):
275275
class ToolChoiceToolChoiceAuto(TypedDict, total=False):
276276
type: Required[Literal["auto"]]
277277

278+
disable_parallel_tool_use: bool
279+
"""Whether to disable parallel tool use.
280+
281+
Defaults to `false`. If set to `true`, the model will output at most one tool
282+
use.
283+
"""
284+
278285

279286
class ToolChoiceToolChoiceAny(TypedDict, total=False):
280287
type: Required[Literal["any"]]
281288

289+
disable_parallel_tool_use: bool
290+
"""Whether to disable parallel tool use.
291+
292+
Defaults to `false`. If set to `true`, the model will output exactly one tool
293+
use.
294+
"""
295+
282296

283297
class ToolChoiceToolChoiceTool(TypedDict, total=False):
284298
name: Required[str]
285299
"""The name of the tool to use."""
286300

287301
type: Required[Literal["tool"]]
288302

303+
disable_parallel_tool_use: bool
304+
"""Whether to disable parallel tool use.
305+
306+
Defaults to `false`. If set to `true`, the model will output exactly one tool
307+
use.
308+
"""
309+
289310

290311
ToolChoice: TypeAlias = Union[ToolChoiceToolChoiceAuto, ToolChoiceToolChoiceAny, ToolChoiceToolChoiceTool]
291312

‎tests/api_resources/beta/prompt_caching/test_messages.py

+16-4
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@ def test_method_create_with_all_params_overload_1(self, client: Anthropic) -> No
5353
}
5454
],
5555
temperature=1,
56-
tool_choice={"type": "auto"},
56+
tool_choice={
57+
"type": "auto",
58+
"disable_parallel_tool_use": True,
59+
},
5760
tools=[
5861
{
5962
"input_schema": {
@@ -190,7 +193,10 @@ def test_method_create_with_all_params_overload_2(self, client: Anthropic) -> No
190193
}
191194
],
192195
temperature=1,
193-
tool_choice={"type": "auto"},
196+
tool_choice={
197+
"type": "auto",
198+
"disable_parallel_tool_use": True,
199+
},
194200
tools=[
195201
{
196202
"input_schema": {
@@ -331,7 +337,10 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn
331337
}
332338
],
333339
temperature=1,
334-
tool_choice={"type": "auto"},
340+
tool_choice={
341+
"type": "auto",
342+
"disable_parallel_tool_use": True,
343+
},
335344
tools=[
336345
{
337346
"input_schema": {
@@ -468,7 +477,10 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn
468477
}
469478
],
470479
temperature=1,
471-
tool_choice={"type": "auto"},
480+
tool_choice={
481+
"type": "auto",
482+
"disable_parallel_tool_use": True,
483+
},
472484
tools=[
473485
{
474486
"input_schema": {

‎tests/api_resources/test_messages.py

+16-4
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@ def test_method_create_with_all_params_overload_1(self, client: Anthropic) -> No
5353
}
5454
],
5555
temperature=1,
56-
tool_choice={"type": "auto"},
56+
tool_choice={
57+
"type": "auto",
58+
"disable_parallel_tool_use": True,
59+
},
5760
tools=[
5861
{
5962
"input_schema": {
@@ -186,7 +189,10 @@ def test_method_create_with_all_params_overload_2(self, client: Anthropic) -> No
186189
}
187190
],
188191
temperature=1,
189-
tool_choice={"type": "auto"},
192+
tool_choice={
193+
"type": "auto",
194+
"disable_parallel_tool_use": True,
195+
},
190196
tools=[
191197
{
192198
"input_schema": {
@@ -333,7 +339,10 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn
333339
}
334340
],
335341
temperature=1,
336-
tool_choice={"type": "auto"},
342+
tool_choice={
343+
"type": "auto",
344+
"disable_parallel_tool_use": True,
345+
},
337346
tools=[
338347
{
339348
"input_schema": {
@@ -466,7 +475,10 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn
466475
}
467476
],
468477
temperature=1,
469-
tool_choice={"type": "auto"},
478+
tool_choice={
479+
"type": "auto",
480+
"disable_parallel_tool_use": True,
481+
},
470482
tools=[
471483
{
472484
"input_schema": {

0 commit comments

Comments
 (0)
Please sign in to comment.