diff --git a/api.md b/api.md
index 45ddce7e..43ecede8 100644
--- a/api.md
+++ b/api.md
@@ -29,6 +29,10 @@ Types:
- TextBlockParam
- TextDelta
- Tool
+- ToolChoice
+- ToolChoiceAny
+- ToolChoiceAuto
+- ToolChoiceTool
- ToolResultBlockParam
- ToolUseBlock
- ToolUseBlockParam
diff --git a/src/index.ts b/src/index.ts
index 9fee1352..9f16770d 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -282,6 +282,10 @@ export namespace Anthropic {
export import TextBlockParam = API.TextBlockParam;
export import TextDelta = API.TextDelta;
export import Tool = API.Tool;
+ export import ToolChoice = API.ToolChoice;
+ export import ToolChoiceAny = API.ToolChoiceAny;
+ export import ToolChoiceAuto = API.ToolChoiceAuto;
+ export import ToolChoiceTool = API.ToolChoiceTool;
export import ToolResultBlockParam = API.ToolResultBlockParam;
export import ToolUseBlock = API.ToolUseBlock;
export import ToolUseBlockParam = API.ToolUseBlockParam;
diff --git a/src/resources/beta/prompt-caching/messages.ts b/src/resources/beta/prompt-caching/messages.ts
index 4668d11d..2febad1e 100644
--- a/src/resources/beta/prompt-caching/messages.ts
+++ b/src/resources/beta/prompt-caching/messages.ts
@@ -461,10 +461,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.
*/
- tool_choice?:
- | MessageCreateParams.ToolChoiceAuto
- | MessageCreateParams.ToolChoiceAny
- | MessageCreateParams.ToolChoiceTool;
+ tool_choice?: MessagesAPI.ToolChoice;
/**
* Definitions of tools that the model may use.
@@ -579,54 +576,19 @@ export namespace MessageCreateParams {
}
/**
- * The model will automatically decide whether to use tools.
+ * @deprecated use `Anthropic.Messages.ToolChoiceAuto` instead
*/
- export interface ToolChoiceAuto {
- type: 'auto';
-
- /**
- * Whether to disable parallel tool use.
- *
- * Defaults to `false`. If set to `true`, the model will output at most one tool
- * use.
- */
- disable_parallel_tool_use?: boolean;
- }
+ export type ToolChoiceAuto = MessagesAPI.ToolChoiceAuto;
/**
- * The model will use any available tools.
+ * @deprecated use `Anthropic.Messages.ToolChoiceAny` instead
*/
- export interface ToolChoiceAny {
- type: 'any';
-
- /**
- * Whether to disable parallel tool use.
- *
- * Defaults to `false`. If set to `true`, the model will output exactly one tool
- * use.
- */
- disable_parallel_tool_use?: boolean;
- }
+ export type ToolChoiceAny = MessagesAPI.ToolChoiceAny;
/**
- * The model will use the specified tool with `tool_choice.name`.
+ * @deprecated use `Anthropic.Messages.ToolChoiceTool` instead
*/
- export interface ToolChoiceTool {
- /**
- * The name of the tool to use.
- */
- name: string;
-
- type: 'tool';
-
- /**
- * Whether to disable parallel tool use.
- *
- * Defaults to `false`. If set to `true`, the model will output exactly one tool
- * use.
- */
- disable_parallel_tool_use?: boolean;
- }
+ export type ToolChoiceTool = MessagesAPI.ToolChoiceTool;
export type MessageCreateParamsNonStreaming = PromptCachingMessagesAPI.MessageCreateParamsNonStreaming;
export type MessageCreateParamsStreaming = PromptCachingMessagesAPI.MessageCreateParamsStreaming;
diff --git a/src/resources/index.ts b/src/resources/index.ts
index ec588e8c..3775f5c4 100644
--- a/src/resources/index.ts
+++ b/src/resources/index.ts
@@ -35,6 +35,10 @@ export {
TextBlockParam,
TextDelta,
Tool,
+ ToolChoice,
+ ToolChoiceAny,
+ ToolChoiceAuto,
+ ToolChoiceTool,
ToolResultBlockParam,
ToolUseBlock,
ToolUseBlockParam,
diff --git a/src/resources/messages.ts b/src/resources/messages.ts
index 9c5e46d7..fa0bdc84 100644
--- a/src/resources/messages.ts
+++ b/src/resources/messages.ts
@@ -365,6 +365,62 @@ export namespace Tool {
}
}
+/**
+ * How the model should use the provided tools. The model can use a specific tool,
+ * any available tool, or decide by itself.
+ */
+export type ToolChoice = ToolChoiceAuto | ToolChoiceAny | ToolChoiceTool;
+
+/**
+ * The model will use any available tools.
+ */
+export interface ToolChoiceAny {
+ type: 'any';
+
+ /**
+ * Whether to disable parallel tool use.
+ *
+ * Defaults to `false`. If set to `true`, the model will output exactly one tool
+ * use.
+ */
+ disable_parallel_tool_use?: boolean;
+}
+
+/**
+ * The model will automatically decide whether to use tools.
+ */
+export interface ToolChoiceAuto {
+ type: 'auto';
+
+ /**
+ * Whether to disable parallel tool use.
+ *
+ * Defaults to `false`. If set to `true`, the model will output at most one tool
+ * use.
+ */
+ disable_parallel_tool_use?: boolean;
+}
+
+/**
+ * The model will use the specified tool with `tool_choice.name`.
+ */
+export interface ToolChoiceTool {
+ /**
+ * The name of the tool to use.
+ */
+ name: string;
+
+ type: 'tool';
+
+ /**
+ * Whether to disable parallel tool use.
+ *
+ * Defaults to `false`. If set to `true`, the model will output exactly one tool
+ * use.
+ */
+ disable_parallel_tool_use?: boolean;
+}
+
export interface ToolResultBlockParam {
tool_use_id: string;
@@ -568,10 +624,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.
*/
- tool_choice?:
- | MessageCreateParams.ToolChoiceAuto
- | MessageCreateParams.ToolChoiceAny
- | MessageCreateParams.ToolChoiceTool;
+ tool_choice?: ToolChoice;
/**
* Definitions of tools that the model may use.
@@ -686,54 +739,19 @@ export namespace MessageCreateParams {
}
/**
- * The model will automatically decide whether to use tools.
+ * @deprecated use `Anthropic.Messages.ToolChoiceAuto` instead
*/
- export interface ToolChoiceAuto {
- type: 'auto';
-
- /**
- * Whether to disable parallel tool use.
- *
- * Defaults to `false`. If set to `true`, the model will output at most one tool
- * use.
- */
- disable_parallel_tool_use?: boolean;
- }
+ export type ToolChoiceAuto = MessagesAPI.ToolChoiceAuto;
/**
- * The model will use any available tools.
+ * @deprecated use `Anthropic.Messages.ToolChoiceAny` instead
*/
- export interface ToolChoiceAny {
- type: 'any';
-
- /**
- * Whether to disable parallel tool use.
- *
- * Defaults to `false`. If set to `true`, the model will output exactly one tool
- * use.
- */
- disable_parallel_tool_use?: boolean;
- }
+ export type ToolChoiceAny = MessagesAPI.ToolChoiceAny;
/**
- * The model will use the specified tool with `tool_choice.name`.
+ * @deprecated use `Anthropic.Messages.ToolChoiceTool` instead
*/
- export interface ToolChoiceTool {
- /**
- * The name of the tool to use.
- */
- name: string;
-
- type: 'tool';
-
- /**
- * Whether to disable parallel tool use.
- *
- * Defaults to `false`. If set to `true`, the model will output exactly one tool
- * use.
- */
- disable_parallel_tool_use?: boolean;
- }
+ export type ToolChoiceTool = MessagesAPI.ToolChoiceTool;
export type MessageCreateParamsNonStreaming = MessagesAPI.MessageCreateParamsNonStreaming;
export type MessageCreateParamsStreaming = MessagesAPI.MessageCreateParamsStreaming;
@@ -788,6 +806,10 @@ export namespace Messages {
export import TextBlockParam = MessagesAPI.TextBlockParam;
export import TextDelta = MessagesAPI.TextDelta;
export import Tool = MessagesAPI.Tool;
+ export import ToolChoice = MessagesAPI.ToolChoice;
+ export import ToolChoiceAny = MessagesAPI.ToolChoiceAny;
+ export import ToolChoiceAuto = MessagesAPI.ToolChoiceAuto;
+ export import ToolChoiceTool = MessagesAPI.ToolChoiceTool;
export import ToolResultBlockParam = MessagesAPI.ToolResultBlockParam;
export import ToolUseBlock = MessagesAPI.ToolUseBlock;
export import ToolUseBlockParam = MessagesAPI.ToolUseBlockParam;