Skip to content

Commit

Permalink
feat(api): add support for disabling tool calls (#701)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] committed Feb 28, 2025
1 parent 05e33b7 commit 1602b51
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 21
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic-129d8719c17bc9ea6e310a63400f60e7ad3ef828e54265eb8a8035684187210b.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic-fd7537a41646cd9253c04f350436c5471e4762750fce8ca8f1909a3052d98608.yml
2 changes: 2 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ Types:
- <code><a href="./src/resources/messages/messages.ts">ToolChoice</a></code>
- <code><a href="./src/resources/messages/messages.ts">ToolChoiceAny</a></code>
- <code><a href="./src/resources/messages/messages.ts">ToolChoiceAuto</a></code>
- <code><a href="./src/resources/messages/messages.ts">ToolChoiceNone</a></code>
- <code><a href="./src/resources/messages/messages.ts">ToolChoiceTool</a></code>
- <code><a href="./src/resources/messages/messages.ts">ToolResultBlockParam</a></code>
- <code><a href="./src/resources/messages/messages.ts">ToolTextEditor20250124</a></code>
Expand Down Expand Up @@ -212,6 +213,7 @@ Types:
- <code><a href="./src/resources/beta/messages/messages.ts">BetaToolChoice</a></code>
- <code><a href="./src/resources/beta/messages/messages.ts">BetaToolChoiceAny</a></code>
- <code><a href="./src/resources/beta/messages/messages.ts">BetaToolChoiceAuto</a></code>
- <code><a href="./src/resources/beta/messages/messages.ts">BetaToolChoiceNone</a></code>
- <code><a href="./src/resources/beta/messages/messages.ts">BetaToolChoiceTool</a></code>
- <code><a href="./src/resources/beta/messages/messages.ts">BetaToolComputerUse20241022</a></code>
- <code><a href="./src/resources/beta/messages/messages.ts">BetaToolComputerUse20250124</a></code>
Expand Down
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ import {
ToolChoice,
ToolChoiceAny,
ToolChoiceAuto,
ToolChoiceNone,
ToolChoiceTool,
ToolResultBlockParam,
ToolTextEditor20250124,
Expand Down Expand Up @@ -408,6 +409,7 @@ export declare namespace Anthropic {
type ToolChoice as ToolChoice,
type ToolChoiceAny as ToolChoiceAny,
type ToolChoiceAuto as ToolChoiceAuto,
type ToolChoiceNone as ToolChoiceNone,
type ToolChoiceTool as ToolChoiceTool,
type ToolResultBlockParam as ToolResultBlockParam,
type ToolTextEditor20250124 as ToolTextEditor20250124,
Expand Down
2 changes: 2 additions & 0 deletions src/resources/beta/beta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import {
BetaToolChoice,
BetaToolChoiceAny,
BetaToolChoiceAuto,
BetaToolChoiceNone,
BetaToolChoiceTool,
BetaToolComputerUse20241022,
BetaToolComputerUse20250124,
Expand Down Expand Up @@ -242,6 +243,7 @@ export declare namespace Beta {
type BetaToolChoice as BetaToolChoice,
type BetaToolChoiceAny as BetaToolChoiceAny,
type BetaToolChoiceAuto as BetaToolChoiceAuto,
type BetaToolChoiceNone as BetaToolChoiceNone,
type BetaToolChoiceTool as BetaToolChoiceTool,
type BetaToolComputerUse20241022 as BetaToolComputerUse20241022,
type BetaToolComputerUse20250124 as BetaToolComputerUse20250124,
Expand Down
1 change: 1 addition & 0 deletions src/resources/beta/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export {
type BetaToolChoice,
type BetaToolChoiceAny,
type BetaToolChoiceAuto,
type BetaToolChoiceNone,
type BetaToolChoiceTool,
type BetaToolComputerUse20241022,
type BetaToolComputerUse20250124,
Expand Down
1 change: 1 addition & 0 deletions src/resources/beta/messages/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export {
type BetaToolChoice,
type BetaToolChoiceAny,
type BetaToolChoiceAuto,
type BetaToolChoiceNone,
type BetaToolChoiceTool,
type BetaToolComputerUse20241022,
type BetaToolComputerUse20250124,
Expand Down
16 changes: 12 additions & 4 deletions src/resources/beta/messages/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -701,9 +701,9 @@ export interface BetaToolBash20250124 {

/**
* How the model should use the provided tools. The model can use a specific tool,
* any available tool, or decide by itself.
* any available tool, decide by itself, or not use tools at all.
*/
export type BetaToolChoice = BetaToolChoiceAuto | BetaToolChoiceAny | BetaToolChoiceTool;
export type BetaToolChoice = BetaToolChoiceAuto | BetaToolChoiceAny | BetaToolChoiceTool | BetaToolChoiceNone;

/**
* The model will use any available tools.
Expand Down Expand Up @@ -735,6 +735,13 @@ export interface BetaToolChoiceAuto {
disable_parallel_tool_use?: boolean;
}

/**
* The model will not be allowed to use tools.
*/
export interface BetaToolChoiceNone {
type: 'none';
}

/**
* The model will use the specified tool with `tool_choice.name`.
*/
Expand Down Expand Up @@ -1088,7 +1095,7 @@ export interface MessageCreateParamsBase {

/**
* Body param: How the model should use the provided tools. The model can use a
* specific tool, any available tool, or decide by itself.
* specific tool, any available tool, decide by itself, or not use tools at all.
*/
tool_choice?: BetaToolChoice;

Expand Down Expand Up @@ -1344,7 +1351,7 @@ export interface MessageCountTokensParams {

/**
* Body param: How the model should use the provided tools. The model can use a
* specific tool, any available tool, or decide by itself.
* specific tool, any available tool, decide by itself, or not use tools at all.
*/
tool_choice?: BetaToolChoice;

Expand Down Expand Up @@ -1491,6 +1498,7 @@ export declare namespace Messages {
type BetaToolChoice as BetaToolChoice,
type BetaToolChoiceAny as BetaToolChoiceAny,
type BetaToolChoiceAuto as BetaToolChoiceAuto,
type BetaToolChoiceNone as BetaToolChoiceNone,
type BetaToolChoiceTool as BetaToolChoiceTool,
type BetaToolComputerUse20241022 as BetaToolComputerUse20241022,
type BetaToolComputerUse20250124 as BetaToolComputerUse20250124,
Expand Down
1 change: 1 addition & 0 deletions src/resources/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export {
type ToolChoice,
type ToolChoiceAny,
type ToolChoiceAuto,
type ToolChoiceNone,
type ToolChoiceTool,
type ToolResultBlockParam,
type ToolTextEditor20250124,
Expand Down
1 change: 1 addition & 0 deletions src/resources/messages/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export {
type ToolChoice,
type ToolChoiceAny,
type ToolChoiceAuto,
type ToolChoiceNone,
type ToolChoiceTool,
type ToolResultBlockParam,
type ToolTextEditor20250124,
Expand Down
16 changes: 12 additions & 4 deletions src/resources/messages/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -696,9 +696,9 @@ export interface ToolBash20250124 {

/**
* How the model should use the provided tools. The model can use a specific tool,
* any available tool, or decide by itself.
* any available tool, decide by itself, or not use tools at all.
*/
export type ToolChoice = ToolChoiceAuto | ToolChoiceAny | ToolChoiceTool;
export type ToolChoice = ToolChoiceAuto | ToolChoiceAny | ToolChoiceTool | ToolChoiceNone;

/**
* The model will use any available tools.
Expand Down Expand Up @@ -730,6 +730,13 @@ export interface ToolChoiceAuto {
disable_parallel_tool_use?: boolean;
}

/**
* The model will not be allowed to use tools.
*/
export interface ToolChoiceNone {
type: 'none';
}

/**
* The model will use the specified tool with `tool_choice.name`.
*/
Expand Down Expand Up @@ -1006,7 +1013,7 @@ export interface MessageCreateParamsBase {

/**
* How the model should use the provided tools. The model can use a specific tool,
* any available tool, or decide by itself.
* any available tool, decide by itself, or not use tools at all.
*/
tool_choice?: ToolChoice;

Expand Down Expand Up @@ -1277,7 +1284,7 @@ export interface MessageCountTokensParams {

/**
* How the model should use the provided tools. The model can use a specific tool,
* any available tool, or decide by itself.
* any available tool, decide by itself, or not use tools at all.
*/
tool_choice?: ToolChoice;

Expand Down Expand Up @@ -1420,6 +1427,7 @@ export declare namespace Messages {
type ToolChoice as ToolChoice,
type ToolChoiceAny as ToolChoiceAny,
type ToolChoiceAuto as ToolChoiceAuto,
type ToolChoiceNone as ToolChoiceNone,
type ToolChoiceTool as ToolChoiceTool,
type ToolResultBlockParam as ToolResultBlockParam,
type ToolTextEditor20250124 as ToolTextEditor20250124,
Expand Down

0 comments on commit 1602b51

Please # to comment.