@ai-sdk/anthropic 2.0.0-beta.11 → 2.0.0-beta.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { LanguageModelV2 } from '@ai-sdk/provider';
1
+ import { LanguageModelV2, JSONSchema7, LanguageModelV2CallOptions, LanguageModelV2CallWarning } from '@ai-sdk/provider';
2
2
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
3
3
  import { Resolvable, FetchFunction } from '@ai-sdk/provider-utils';
4
4
 
@@ -172,4 +172,58 @@ declare const anthropicTools: {
172
172
  }[]>;
173
173
  };
174
174
 
175
- export { AnthropicMessagesLanguageModel, type AnthropicMessagesModelId, anthropicTools };
175
+ type AnthropicCacheControl = {
176
+ type: 'ephemeral';
177
+ };
178
+ type AnthropicTool = {
179
+ name: string;
180
+ description: string | undefined;
181
+ input_schema: JSONSchema7;
182
+ cache_control: AnthropicCacheControl | undefined;
183
+ } | {
184
+ name: string;
185
+ type: 'computer_20250124' | 'computer_20241022';
186
+ display_width_px: number;
187
+ display_height_px: number;
188
+ display_number: number;
189
+ } | {
190
+ name: string;
191
+ type: 'text_editor_20250124' | 'text_editor_20241022' | 'text_editor_20250429';
192
+ } | {
193
+ name: string;
194
+ type: 'bash_20250124' | 'bash_20241022';
195
+ } | {
196
+ type: 'web_search_20250305';
197
+ name: string;
198
+ max_uses?: number;
199
+ allowed_domains?: string[];
200
+ blocked_domains?: string[];
201
+ user_location?: {
202
+ type: 'approximate';
203
+ city?: string;
204
+ region?: string;
205
+ country?: string;
206
+ timezone?: string;
207
+ };
208
+ };
209
+ type AnthropicToolChoice = {
210
+ type: 'auto' | 'any';
211
+ disable_parallel_tool_use?: boolean;
212
+ } | {
213
+ type: 'tool';
214
+ name: string;
215
+ disable_parallel_tool_use?: boolean;
216
+ };
217
+
218
+ declare function prepareTools({ tools, toolChoice, disableParallelToolUse, }: {
219
+ tools: LanguageModelV2CallOptions['tools'];
220
+ toolChoice?: LanguageModelV2CallOptions['toolChoice'];
221
+ disableParallelToolUse?: boolean;
222
+ }): {
223
+ tools: Array<AnthropicTool> | undefined;
224
+ toolChoice: AnthropicToolChoice | undefined;
225
+ toolWarnings: LanguageModelV2CallWarning[];
226
+ betas: Set<string>;
227
+ };
228
+
229
+ export { AnthropicMessagesLanguageModel, type AnthropicMessagesModelId, anthropicTools, prepareTools };
@@ -1,4 +1,4 @@
1
- import { LanguageModelV2 } from '@ai-sdk/provider';
1
+ import { LanguageModelV2, JSONSchema7, LanguageModelV2CallOptions, LanguageModelV2CallWarning } from '@ai-sdk/provider';
2
2
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
3
3
  import { Resolvable, FetchFunction } from '@ai-sdk/provider-utils';
4
4
 
@@ -172,4 +172,58 @@ declare const anthropicTools: {
172
172
  }[]>;
173
173
  };
174
174
 
175
- export { AnthropicMessagesLanguageModel, type AnthropicMessagesModelId, anthropicTools };
175
+ type AnthropicCacheControl = {
176
+ type: 'ephemeral';
177
+ };
178
+ type AnthropicTool = {
179
+ name: string;
180
+ description: string | undefined;
181
+ input_schema: JSONSchema7;
182
+ cache_control: AnthropicCacheControl | undefined;
183
+ } | {
184
+ name: string;
185
+ type: 'computer_20250124' | 'computer_20241022';
186
+ display_width_px: number;
187
+ display_height_px: number;
188
+ display_number: number;
189
+ } | {
190
+ name: string;
191
+ type: 'text_editor_20250124' | 'text_editor_20241022' | 'text_editor_20250429';
192
+ } | {
193
+ name: string;
194
+ type: 'bash_20250124' | 'bash_20241022';
195
+ } | {
196
+ type: 'web_search_20250305';
197
+ name: string;
198
+ max_uses?: number;
199
+ allowed_domains?: string[];
200
+ blocked_domains?: string[];
201
+ user_location?: {
202
+ type: 'approximate';
203
+ city?: string;
204
+ region?: string;
205
+ country?: string;
206
+ timezone?: string;
207
+ };
208
+ };
209
+ type AnthropicToolChoice = {
210
+ type: 'auto' | 'any';
211
+ disable_parallel_tool_use?: boolean;
212
+ } | {
213
+ type: 'tool';
214
+ name: string;
215
+ disable_parallel_tool_use?: boolean;
216
+ };
217
+
218
+ declare function prepareTools({ tools, toolChoice, disableParallelToolUse, }: {
219
+ tools: LanguageModelV2CallOptions['tools'];
220
+ toolChoice?: LanguageModelV2CallOptions['toolChoice'];
221
+ disableParallelToolUse?: boolean;
222
+ }): {
223
+ tools: Array<AnthropicTool> | undefined;
224
+ toolChoice: AnthropicToolChoice | undefined;
225
+ toolWarnings: LanguageModelV2CallWarning[];
226
+ betas: Set<string>;
227
+ };
228
+
229
+ export { AnthropicMessagesLanguageModel, type AnthropicMessagesModelId, anthropicTools, prepareTools };
@@ -31,7 +31,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
31
31
  var internal_exports = {};
32
32
  __export(internal_exports, {
33
33
  AnthropicMessagesLanguageModel: () => AnthropicMessagesLanguageModel,
34
- anthropicTools: () => anthropicTools
34
+ anthropicTools: () => anthropicTools,
35
+ prepareTools: () => prepareTools
35
36
  });
36
37
  module.exports = __toCommonJS(internal_exports);
37
38
 
@@ -1715,7 +1716,7 @@ var bash_20241022 = (0, import_provider_utils5.createProviderDefinedToolFactory)
1715
1716
  var import_provider_utils6 = require("@ai-sdk/provider-utils");
1716
1717
  var import_v46 = __toESM(require("zod/v4"));
1717
1718
  var bash_20250124 = (0, import_provider_utils6.createProviderDefinedToolFactory)({
1718
- id: "anthropic.bashTool_20250124",
1719
+ id: "anthropic.bash_20250124",
1719
1720
  name: "bash",
1720
1721
  inputSchema: import_v46.default.object({
1721
1722
  command: import_v46.default.string(),
@@ -1898,6 +1899,7 @@ var anthropicTools = {
1898
1899
  // Annotate the CommonJS export names for ESM import in node:
1899
1900
  0 && (module.exports = {
1900
1901
  AnthropicMessagesLanguageModel,
1901
- anthropicTools
1902
+ anthropicTools,
1903
+ prepareTools
1902
1904
  });
1903
1905
  //# sourceMappingURL=index.js.map