Skip to content

Commit 4618d3e

Browse files
feat(api): support disabling parallel tool use (#540)
1 parent 556d460 commit 4618d3e

File tree

5 files changed

+51
-3
lines changed

5 files changed

+51
-3
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: 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/resources/beta/prompt-caching/messages.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,13 +583,29 @@ export namespace MessageCreateParams {
583583
*/
584584
export interface ToolChoiceAuto {
585585
type: 'auto';
586+
587+
/**
588+
* Whether to disable parallel tool use.
589+
*
590+
* Defaults to `false`. If set to `true`, the model will output at most one tool
591+
* use.
592+
*/
593+
disable_parallel_tool_use?: boolean;
586594
}
587595

588596
/**
589597
* The model will use any available tools.
590598
*/
591599
export interface ToolChoiceAny {
592600
type: 'any';
601+
602+
/**
603+
* Whether to disable parallel tool use.
604+
*
605+
* Defaults to `false`. If set to `true`, the model will output exactly one tool
606+
* use.
607+
*/
608+
disable_parallel_tool_use?: boolean;
593609
}
594610

595611
/**
@@ -602,6 +618,14 @@ export namespace MessageCreateParams {
602618
name: string;
603619

604620
type: 'tool';
621+
622+
/**
623+
* Whether to disable parallel tool use.
624+
*
625+
* Defaults to `false`. If set to `true`, the model will output exactly one tool
626+
* use.
627+
*/
628+
disable_parallel_tool_use?: boolean;
605629
}
606630

607631
export type MessageCreateParamsNonStreaming = PromptCachingMessagesAPI.MessageCreateParamsNonStreaming;

src/resources/messages.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -690,13 +690,29 @@ export namespace MessageCreateParams {
690690
*/
691691
export interface ToolChoiceAuto {
692692
type: 'auto';
693+
694+
/**
695+
* Whether to disable parallel tool use.
696+
*
697+
* Defaults to `false`. If set to `true`, the model will output at most one tool
698+
* use.
699+
*/
700+
disable_parallel_tool_use?: boolean;
693701
}
694702

695703
/**
696704
* The model will use any available tools.
697705
*/
698706
export interface ToolChoiceAny {
699707
type: 'any';
708+
709+
/**
710+
* Whether to disable parallel tool use.
711+
*
712+
* Defaults to `false`. If set to `true`, the model will output exactly one tool
713+
* use.
714+
*/
715+
disable_parallel_tool_use?: boolean;
700716
}
701717

702718
/**
@@ -709,6 +725,14 @@ export namespace MessageCreateParams {
709725
name: string;
710726

711727
type: 'tool';
728+
729+
/**
730+
* Whether to disable parallel tool use.
731+
*
732+
* Defaults to `false`. If set to `true`, the model will output exactly one tool
733+
* use.
734+
*/
735+
disable_parallel_tool_use?: boolean;
712736
}
713737

714738
export type MessageCreateParamsNonStreaming = MessagesAPI.MessageCreateParamsNonStreaming;

tests/api-resources/beta/prompt-caching/messages.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ describe('resource messages', () => {
3434
stream: false,
3535
system: [{ text: "Today's date is 2024-06-01.", type: 'text', cache_control: { type: 'ephemeral' } }],
3636
temperature: 1,
37-
tool_choice: { type: 'auto' },
37+
tool_choice: { type: 'auto', disable_parallel_tool_use: true },
3838
tools: [
3939
{
4040
input_schema: {

tests/api-resources/messages.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ describe('resource messages', () => {
3434
stream: false,
3535
system: [{ text: "Today's date is 2024-06-01.", type: 'text' }],
3636
temperature: 1,
37-
tool_choice: { type: 'auto' },
37+
tool_choice: { type: 'auto', disable_parallel_tool_use: true },
3838
tools: [
3939
{
4040
input_schema: {

0 commit comments

Comments
 (0)