ai 3.0.18 → 3.0.19

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,24 @@
1
- type JsonSchema = Record<string, unknown>;
1
+ import { JSONSchema7 } from 'json-schema';
2
+
3
+ /**
4
+ A tool has a name, a description, and a set of parameters.
5
+
6
+ Note: this is **not** the user-facing tool definition. The AI SDK methods will
7
+ map the user-facing tool definitions to this format.
8
+ */
9
+ type LanguageModelV1FunctionTool = {
10
+ /**
11
+ The type of the tool. Only functions for now, but this gives us room to
12
+ add more specific tool types in the future and use a discriminated union.
13
+ */
14
+ type: 'function';
15
+ /**
16
+ The name of the tool. Unique within this model call.
17
+ */
18
+ name: string;
19
+ description?: string;
20
+ parameters: JSONSchema7;
21
+ };
2
22
 
3
23
  type LanguageModelV1CallSettings = {
4
24
  /**
@@ -54,26 +74,6 @@ type LanguageModelV1CallSettings = {
54
74
  abortSignal?: AbortSignal;
55
75
  };
56
76
 
57
- /**
58
- * A tool has a name, a description, and a set of parameters.
59
- *
60
- * Note: this is **not** the user-facing tool definition. The AI SDK methods will
61
- * map the user-facing tool definitions to this format.
62
- */
63
- type LanguageModelV1FunctionTool = {
64
- /**
65
- * The type of the tool. Only functions for now, but this gives us room to
66
- * add more specific tool types in the future and use a discriminated union.
67
- */
68
- type: 'function';
69
- /**
70
- * The name of the tool. Unique within this model call.
71
- */
72
- name: string;
73
- description?: string;
74
- parameters: JsonSchema;
75
- };
76
-
77
77
  /**
78
78
  * A prompt is a list of messages.
79
79
  *
@@ -151,7 +151,7 @@ type LanguageModelV1CallOptions = LanguageModelV1CallSettings & {
151
151
  type: 'object-json';
152
152
  } | {
153
153
  type: 'object-grammar';
154
- schema: JsonSchema;
154
+ schema: JSONSchema7;
155
155
  } | {
156
156
  type: 'object-tool';
157
157
  tool: LanguageModelV1FunctionTool;
@@ -1,4 +1,24 @@
1
- type JsonSchema = Record<string, unknown>;
1
+ import { JSONSchema7 } from 'json-schema';
2
+
3
+ /**
4
+ A tool has a name, a description, and a set of parameters.
5
+
6
+ Note: this is **not** the user-facing tool definition. The AI SDK methods will
7
+ map the user-facing tool definitions to this format.
8
+ */
9
+ type LanguageModelV1FunctionTool = {
10
+ /**
11
+ The type of the tool. Only functions for now, but this gives us room to
12
+ add more specific tool types in the future and use a discriminated union.
13
+ */
14
+ type: 'function';
15
+ /**
16
+ The name of the tool. Unique within this model call.
17
+ */
18
+ name: string;
19
+ description?: string;
20
+ parameters: JSONSchema7;
21
+ };
2
22
 
3
23
  type LanguageModelV1CallSettings = {
4
24
  /**
@@ -54,26 +74,6 @@ type LanguageModelV1CallSettings = {
54
74
  abortSignal?: AbortSignal;
55
75
  };
56
76
 
57
- /**
58
- * A tool has a name, a description, and a set of parameters.
59
- *
60
- * Note: this is **not** the user-facing tool definition. The AI SDK methods will
61
- * map the user-facing tool definitions to this format.
62
- */
63
- type LanguageModelV1FunctionTool = {
64
- /**
65
- * The type of the tool. Only functions for now, but this gives us room to
66
- * add more specific tool types in the future and use a discriminated union.
67
- */
68
- type: 'function';
69
- /**
70
- * The name of the tool. Unique within this model call.
71
- */
72
- name: string;
73
- description?: string;
74
- parameters: JsonSchema;
75
- };
76
-
77
77
  /**
78
78
  * A prompt is a list of messages.
79
79
  *
@@ -151,7 +151,7 @@ type LanguageModelV1CallOptions = LanguageModelV1CallSettings & {
151
151
  type: 'object-json';
152
152
  } | {
153
153
  type: 'object-grammar';
154
- schema: JsonSchema;
154
+ schema: JSONSchema7;
155
155
  } | {
156
156
  type: 'object-tool';
157
157
  tool: LanguageModelV1FunctionTool;
@@ -1,4 +1,24 @@
1
- type JsonSchema = Record<string, unknown>;
1
+ import { JSONSchema7 } from 'json-schema';
2
+
3
+ /**
4
+ A tool has a name, a description, and a set of parameters.
5
+
6
+ Note: this is **not** the user-facing tool definition. The AI SDK methods will
7
+ map the user-facing tool definitions to this format.
8
+ */
9
+ type LanguageModelV1FunctionTool = {
10
+ /**
11
+ The type of the tool. Only functions for now, but this gives us room to
12
+ add more specific tool types in the future and use a discriminated union.
13
+ */
14
+ type: 'function';
15
+ /**
16
+ The name of the tool. Unique within this model call.
17
+ */
18
+ name: string;
19
+ description?: string;
20
+ parameters: JSONSchema7;
21
+ };
2
22
 
3
23
  type LanguageModelV1CallSettings = {
4
24
  /**
@@ -54,26 +74,6 @@ type LanguageModelV1CallSettings = {
54
74
  abortSignal?: AbortSignal;
55
75
  };
56
76
 
57
- /**
58
- * A tool has a name, a description, and a set of parameters.
59
- *
60
- * Note: this is **not** the user-facing tool definition. The AI SDK methods will
61
- * map the user-facing tool definitions to this format.
62
- */
63
- type LanguageModelV1FunctionTool = {
64
- /**
65
- * The type of the tool. Only functions for now, but this gives us room to
66
- * add more specific tool types in the future and use a discriminated union.
67
- */
68
- type: 'function';
69
- /**
70
- * The name of the tool. Unique within this model call.
71
- */
72
- name: string;
73
- description?: string;
74
- parameters: JsonSchema;
75
- };
76
-
77
77
  /**
78
78
  * A prompt is a list of messages.
79
79
  *
@@ -151,7 +151,7 @@ type LanguageModelV1CallOptions = LanguageModelV1CallSettings & {
151
151
  type: 'object-json';
152
152
  } | {
153
153
  type: 'object-grammar';
154
- schema: JsonSchema;
154
+ schema: JSONSchema7;
155
155
  } | {
156
156
  type: 'object-tool';
157
157
  tool: LanguageModelV1FunctionTool;
@@ -1,4 +1,24 @@
1
- type JsonSchema = Record<string, unknown>;
1
+ import { JSONSchema7 } from 'json-schema';
2
+
3
+ /**
4
+ A tool has a name, a description, and a set of parameters.
5
+
6
+ Note: this is **not** the user-facing tool definition. The AI SDK methods will
7
+ map the user-facing tool definitions to this format.
8
+ */
9
+ type LanguageModelV1FunctionTool = {
10
+ /**
11
+ The type of the tool. Only functions for now, but this gives us room to
12
+ add more specific tool types in the future and use a discriminated union.
13
+ */
14
+ type: 'function';
15
+ /**
16
+ The name of the tool. Unique within this model call.
17
+ */
18
+ name: string;
19
+ description?: string;
20
+ parameters: JSONSchema7;
21
+ };
2
22
 
3
23
  type LanguageModelV1CallSettings = {
4
24
  /**
@@ -54,26 +74,6 @@ type LanguageModelV1CallSettings = {
54
74
  abortSignal?: AbortSignal;
55
75
  };
56
76
 
57
- /**
58
- * A tool has a name, a description, and a set of parameters.
59
- *
60
- * Note: this is **not** the user-facing tool definition. The AI SDK methods will
61
- * map the user-facing tool definitions to this format.
62
- */
63
- type LanguageModelV1FunctionTool = {
64
- /**
65
- * The type of the tool. Only functions for now, but this gives us room to
66
- * add more specific tool types in the future and use a discriminated union.
67
- */
68
- type: 'function';
69
- /**
70
- * The name of the tool. Unique within this model call.
71
- */
72
- name: string;
73
- description?: string;
74
- parameters: JsonSchema;
75
- };
76
-
77
77
  /**
78
78
  * A prompt is a list of messages.
79
79
  *
@@ -151,7 +151,7 @@ type LanguageModelV1CallOptions = LanguageModelV1CallSettings & {
151
151
  type: 'object-json';
152
152
  } | {
153
153
  type: 'object-grammar';
154
- schema: JsonSchema;
154
+ schema: JSONSchema7;
155
155
  } | {
156
156
  type: 'object-tool';
157
157
  tool: LanguageModelV1FunctionTool;
@@ -1,4 +1,24 @@
1
- type JsonSchema = Record<string, unknown>;
1
+ import { JSONSchema7 } from 'json-schema';
2
+
3
+ /**
4
+ A tool has a name, a description, and a set of parameters.
5
+
6
+ Note: this is **not** the user-facing tool definition. The AI SDK methods will
7
+ map the user-facing tool definitions to this format.
8
+ */
9
+ type LanguageModelV1FunctionTool = {
10
+ /**
11
+ The type of the tool. Only functions for now, but this gives us room to
12
+ add more specific tool types in the future and use a discriminated union.
13
+ */
14
+ type: 'function';
15
+ /**
16
+ The name of the tool. Unique within this model call.
17
+ */
18
+ name: string;
19
+ description?: string;
20
+ parameters: JSONSchema7;
21
+ };
2
22
 
3
23
  type LanguageModelV1CallSettings = {
4
24
  /**
@@ -54,26 +74,6 @@ type LanguageModelV1CallSettings = {
54
74
  abortSignal?: AbortSignal;
55
75
  };
56
76
 
57
- /**
58
- * A tool has a name, a description, and a set of parameters.
59
- *
60
- * Note: this is **not** the user-facing tool definition. The AI SDK methods will
61
- * map the user-facing tool definitions to this format.
62
- */
63
- type LanguageModelV1FunctionTool = {
64
- /**
65
- * The type of the tool. Only functions for now, but this gives us room to
66
- * add more specific tool types in the future and use a discriminated union.
67
- */
68
- type: 'function';
69
- /**
70
- * The name of the tool. Unique within this model call.
71
- */
72
- name: string;
73
- description?: string;
74
- parameters: JsonSchema;
75
- };
76
-
77
77
  /**
78
78
  * A prompt is a list of messages.
79
79
  *
@@ -151,7 +151,7 @@ type LanguageModelV1CallOptions = LanguageModelV1CallSettings & {
151
151
  type: 'object-json';
152
152
  } | {
153
153
  type: 'object-grammar';
154
- schema: JsonSchema;
154
+ schema: JSONSchema7;
155
155
  } | {
156
156
  type: 'object-tool';
157
157
  tool: LanguageModelV1FunctionTool;
@@ -1,4 +1,24 @@
1
- type JsonSchema = Record<string, unknown>;
1
+ import { JSONSchema7 } from 'json-schema';
2
+
3
+ /**
4
+ A tool has a name, a description, and a set of parameters.
5
+
6
+ Note: this is **not** the user-facing tool definition. The AI SDK methods will
7
+ map the user-facing tool definitions to this format.
8
+ */
9
+ type LanguageModelV1FunctionTool = {
10
+ /**
11
+ The type of the tool. Only functions for now, but this gives us room to
12
+ add more specific tool types in the future and use a discriminated union.
13
+ */
14
+ type: 'function';
15
+ /**
16
+ The name of the tool. Unique within this model call.
17
+ */
18
+ name: string;
19
+ description?: string;
20
+ parameters: JSONSchema7;
21
+ };
2
22
 
3
23
  type LanguageModelV1CallSettings = {
4
24
  /**
@@ -54,26 +74,6 @@ type LanguageModelV1CallSettings = {
54
74
  abortSignal?: AbortSignal;
55
75
  };
56
76
 
57
- /**
58
- * A tool has a name, a description, and a set of parameters.
59
- *
60
- * Note: this is **not** the user-facing tool definition. The AI SDK methods will
61
- * map the user-facing tool definitions to this format.
62
- */
63
- type LanguageModelV1FunctionTool = {
64
- /**
65
- * The type of the tool. Only functions for now, but this gives us room to
66
- * add more specific tool types in the future and use a discriminated union.
67
- */
68
- type: 'function';
69
- /**
70
- * The name of the tool. Unique within this model call.
71
- */
72
- name: string;
73
- description?: string;
74
- parameters: JsonSchema;
75
- };
76
-
77
77
  /**
78
78
  * A prompt is a list of messages.
79
79
  *
@@ -151,7 +151,7 @@ type LanguageModelV1CallOptions = LanguageModelV1CallSettings & {
151
151
  type: 'object-json';
152
152
  } | {
153
153
  type: 'object-grammar';
154
- schema: JsonSchema;
154
+ schema: JSONSchema7;
155
155
  } | {
156
156
  type: 'object-tool';
157
157
  tool: LanguageModelV1FunctionTool;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai",
3
- "version": "3.0.18",
3
+ "version": "3.0.19",
4
4
  "license": "Apache-2.0",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/index.js",
@@ -90,16 +90,18 @@
90
90
  }
91
91
  },
92
92
  "dependencies": {
93
+ "@types/json-schema": "7.0.15",
93
94
  "secure-json-parse": "2.7.0",
94
95
  "eventsource-parser": "1.1.2",
95
- "jsondiffpatch": "^0.6.0",
96
+ "jsondiffpatch": "0.6.0",
97
+ "json-schema": "0.4.0",
96
98
  "nanoid": "3.3.6",
97
99
  "solid-swr-store": "0.10.7",
98
100
  "sswr": "2.0.0",
99
101
  "swr": "2.2.0",
100
102
  "swr-store": "0.10.6",
101
103
  "swrv": "1.0.4",
102
- "zod-to-json-schema": "^3.22.4"
104
+ "zod-to-json-schema": "3.22.5"
103
105
  },
104
106
  "devDependencies": {
105
107
  "@anthropic-ai/sdk": "0.18.0",
@@ -1,3 +1,4 @@
1
+ import { JSONSchema7 } from 'json-schema';
1
2
  import * as zod from 'zod';
2
3
  import { ZodSchema } from 'zod';
3
4
 
@@ -176,9 +177,11 @@ declare class NoResponseBodyError extends Error {
176
177
 
177
178
  declare class NoSuchToolError extends Error {
178
179
  readonly toolName: string;
179
- constructor({ message, toolName }: {
180
- message: string;
180
+ readonly availableTools: string[] | undefined;
181
+ constructor({ toolName, availableTools, message, }: {
181
182
  toolName: string;
183
+ availableTools?: string[] | undefined;
184
+ message?: string;
182
185
  });
183
186
  static isNoSuchToolError(error: unknown): error is NoSuchToolError;
184
187
  toJSON(): {
@@ -186,6 +189,7 @@ declare class NoSuchToolError extends Error {
186
189
  message: string;
187
190
  stack: string | undefined;
188
191
  toolName: string;
192
+ availableTools: string[] | undefined;
189
193
  };
190
194
  }
191
195
 
@@ -209,6 +213,47 @@ declare class RetryError extends Error {
209
213
  };
210
214
  }
211
215
 
216
+ /**
217
+ A tool has a name, a description, and a set of parameters.
218
+
219
+ Note: this is **not** the user-facing tool definition. The AI SDK methods will
220
+ map the user-facing tool definitions to this format.
221
+ */
222
+ type LanguageModelV1FunctionTool = {
223
+ /**
224
+ The type of the tool. Only functions for now, but this gives us room to
225
+ add more specific tool types in the future and use a discriminated union.
226
+ */
227
+ type: 'function';
228
+ /**
229
+ The name of the tool. Unique within this model call.
230
+ */
231
+ name: string;
232
+ description?: string;
233
+ parameters: JSONSchema7;
234
+ };
235
+
236
+ declare class ToolCallParseError extends Error {
237
+ readonly cause: unknown;
238
+ readonly text: string;
239
+ readonly tools: LanguageModelV1FunctionTool[];
240
+ constructor({ cause, text, tools, message, }: {
241
+ cause: unknown;
242
+ text: string;
243
+ tools: LanguageModelV1FunctionTool[];
244
+ message?: string;
245
+ });
246
+ static isToolCallParseError(error: unknown): error is ToolCallParseError;
247
+ toJSON(): {
248
+ name: string;
249
+ message: string;
250
+ stack: string | undefined;
251
+ cause: unknown;
252
+ text: string;
253
+ tools: LanguageModelV1FunctionTool[];
254
+ };
255
+ }
256
+
212
257
  declare class TypeValidationError extends Error {
213
258
  readonly value: unknown;
214
259
  readonly cause: unknown;
@@ -243,7 +288,26 @@ declare class UnsupportedFunctionalityError extends Error {
243
288
  };
244
289
  }
245
290
 
246
- type JsonSchema = Record<string, unknown>;
291
+ declare class UnsupportedJSONSchemaError extends Error {
292
+ readonly provider: string;
293
+ readonly reason: string;
294
+ readonly schema: unknown;
295
+ constructor({ provider, schema, reason, message, }: {
296
+ provider: string;
297
+ schema: unknown;
298
+ reason: string;
299
+ message?: string;
300
+ });
301
+ static isUnsupportedJSONSchemaError(error: unknown): error is UnsupportedJSONSchemaError;
302
+ toJSON(): {
303
+ name: string;
304
+ message: string;
305
+ stack: string | undefined;
306
+ provider: string;
307
+ reason: string;
308
+ schema: unknown;
309
+ };
310
+ }
247
311
 
248
312
  type LanguageModelV1CallSettings = {
249
313
  /**
@@ -299,26 +363,6 @@ type LanguageModelV1CallSettings = {
299
363
  abortSignal?: AbortSignal;
300
364
  };
301
365
 
302
- /**
303
- * A tool has a name, a description, and a set of parameters.
304
- *
305
- * Note: this is **not** the user-facing tool definition. The AI SDK methods will
306
- * map the user-facing tool definitions to this format.
307
- */
308
- type LanguageModelV1FunctionTool = {
309
- /**
310
- * The type of the tool. Only functions for now, but this gives us room to
311
- * add more specific tool types in the future and use a discriminated union.
312
- */
313
- type: 'function';
314
- /**
315
- * The name of the tool. Unique within this model call.
316
- */
317
- name: string;
318
- description?: string;
319
- parameters: JsonSchema;
320
- };
321
-
322
366
  /**
323
367
  * A prompt is a list of messages.
324
368
  *
@@ -396,7 +440,7 @@ type LanguageModelV1CallOptions = LanguageModelV1CallSettings & {
396
440
  type: 'object-json';
397
441
  } | {
398
442
  type: 'object-grammar';
399
- schema: JsonSchema;
443
+ schema: JSONSchema7;
400
444
  } | {
401
445
  type: 'object-tool';
402
446
  tool: LanguageModelV1FunctionTool;
@@ -705,4 +749,4 @@ declare function safeValidateTypes<T>({ value, schema, }: {
705
749
  error: TypeValidationError;
706
750
  };
707
751
 
708
- export { APICallError, InvalidArgumentError, InvalidDataContentError, InvalidPromptError, InvalidResponseDataError, InvalidToolArgumentsError, JSONParseError, LanguageModelV1, LanguageModelV1CallOptions, LanguageModelV1CallWarning, LanguageModelV1FinishReason, LanguageModelV1FunctionTool, LanguageModelV1FunctionToolCall, LanguageModelV1ImagePart, LanguageModelV1Message, LanguageModelV1Prompt, LanguageModelV1StreamPart, LanguageModelV1TextPart, LanguageModelV1ToolCallPart, LanguageModelV1ToolResultPart, LoadAPIKeyError, NoResponseBodyError, NoSuchToolError, NoTextGeneratedError, ParseResult, ResponseHandler, RetryError, RetryErrorReason, TypeValidationError, UnsupportedFunctionalityError, convertBase64ToUint8Array, convertUint8ArrayToBase64, createEventSourceResponseHandler, createJsonErrorResponseHandler, createJsonResponseHandler, generateId, getErrorMessage, isParseableJson, loadApiKey, parseJSON, postJsonToApi, postToApi, safeParseJSON, safeValidateTypes, scale, validateTypes };
752
+ export { APICallError, InvalidArgumentError, InvalidDataContentError, InvalidPromptError, InvalidResponseDataError, InvalidToolArgumentsError, JSONParseError, LanguageModelV1, LanguageModelV1CallOptions, LanguageModelV1CallWarning, LanguageModelV1FinishReason, LanguageModelV1FunctionTool, LanguageModelV1FunctionToolCall, LanguageModelV1ImagePart, LanguageModelV1Message, LanguageModelV1Prompt, LanguageModelV1StreamPart, LanguageModelV1TextPart, LanguageModelV1ToolCallPart, LanguageModelV1ToolResultPart, LoadAPIKeyError, NoResponseBodyError, NoSuchToolError, NoTextGeneratedError, ParseResult, ResponseHandler, RetryError, RetryErrorReason, ToolCallParseError, TypeValidationError, UnsupportedFunctionalityError, UnsupportedJSONSchemaError, convertBase64ToUint8Array, convertUint8ArrayToBase64, createEventSourceResponseHandler, createJsonErrorResponseHandler, createJsonResponseHandler, generateId, getErrorMessage, isParseableJson, loadApiKey, parseJSON, postJsonToApi, postToApi, safeParseJSON, safeValidateTypes, scale, validateTypes };
@@ -1,3 +1,4 @@
1
+ import { JSONSchema7 } from 'json-schema';
1
2
  import * as zod from 'zod';
2
3
  import { ZodSchema } from 'zod';
3
4
 
@@ -176,9 +177,11 @@ declare class NoResponseBodyError extends Error {
176
177
 
177
178
  declare class NoSuchToolError extends Error {
178
179
  readonly toolName: string;
179
- constructor({ message, toolName }: {
180
- message: string;
180
+ readonly availableTools: string[] | undefined;
181
+ constructor({ toolName, availableTools, message, }: {
181
182
  toolName: string;
183
+ availableTools?: string[] | undefined;
184
+ message?: string;
182
185
  });
183
186
  static isNoSuchToolError(error: unknown): error is NoSuchToolError;
184
187
  toJSON(): {
@@ -186,6 +189,7 @@ declare class NoSuchToolError extends Error {
186
189
  message: string;
187
190
  stack: string | undefined;
188
191
  toolName: string;
192
+ availableTools: string[] | undefined;
189
193
  };
190
194
  }
191
195
 
@@ -209,6 +213,47 @@ declare class RetryError extends Error {
209
213
  };
210
214
  }
211
215
 
216
+ /**
217
+ A tool has a name, a description, and a set of parameters.
218
+
219
+ Note: this is **not** the user-facing tool definition. The AI SDK methods will
220
+ map the user-facing tool definitions to this format.
221
+ */
222
+ type LanguageModelV1FunctionTool = {
223
+ /**
224
+ The type of the tool. Only functions for now, but this gives us room to
225
+ add more specific tool types in the future and use a discriminated union.
226
+ */
227
+ type: 'function';
228
+ /**
229
+ The name of the tool. Unique within this model call.
230
+ */
231
+ name: string;
232
+ description?: string;
233
+ parameters: JSONSchema7;
234
+ };
235
+
236
+ declare class ToolCallParseError extends Error {
237
+ readonly cause: unknown;
238
+ readonly text: string;
239
+ readonly tools: LanguageModelV1FunctionTool[];
240
+ constructor({ cause, text, tools, message, }: {
241
+ cause: unknown;
242
+ text: string;
243
+ tools: LanguageModelV1FunctionTool[];
244
+ message?: string;
245
+ });
246
+ static isToolCallParseError(error: unknown): error is ToolCallParseError;
247
+ toJSON(): {
248
+ name: string;
249
+ message: string;
250
+ stack: string | undefined;
251
+ cause: unknown;
252
+ text: string;
253
+ tools: LanguageModelV1FunctionTool[];
254
+ };
255
+ }
256
+
212
257
  declare class TypeValidationError extends Error {
213
258
  readonly value: unknown;
214
259
  readonly cause: unknown;
@@ -243,7 +288,26 @@ declare class UnsupportedFunctionalityError extends Error {
243
288
  };
244
289
  }
245
290
 
246
- type JsonSchema = Record<string, unknown>;
291
+ declare class UnsupportedJSONSchemaError extends Error {
292
+ readonly provider: string;
293
+ readonly reason: string;
294
+ readonly schema: unknown;
295
+ constructor({ provider, schema, reason, message, }: {
296
+ provider: string;
297
+ schema: unknown;
298
+ reason: string;
299
+ message?: string;
300
+ });
301
+ static isUnsupportedJSONSchemaError(error: unknown): error is UnsupportedJSONSchemaError;
302
+ toJSON(): {
303
+ name: string;
304
+ message: string;
305
+ stack: string | undefined;
306
+ provider: string;
307
+ reason: string;
308
+ schema: unknown;
309
+ };
310
+ }
247
311
 
248
312
  type LanguageModelV1CallSettings = {
249
313
  /**
@@ -299,26 +363,6 @@ type LanguageModelV1CallSettings = {
299
363
  abortSignal?: AbortSignal;
300
364
  };
301
365
 
302
- /**
303
- * A tool has a name, a description, and a set of parameters.
304
- *
305
- * Note: this is **not** the user-facing tool definition. The AI SDK methods will
306
- * map the user-facing tool definitions to this format.
307
- */
308
- type LanguageModelV1FunctionTool = {
309
- /**
310
- * The type of the tool. Only functions for now, but this gives us room to
311
- * add more specific tool types in the future and use a discriminated union.
312
- */
313
- type: 'function';
314
- /**
315
- * The name of the tool. Unique within this model call.
316
- */
317
- name: string;
318
- description?: string;
319
- parameters: JsonSchema;
320
- };
321
-
322
366
  /**
323
367
  * A prompt is a list of messages.
324
368
  *
@@ -396,7 +440,7 @@ type LanguageModelV1CallOptions = LanguageModelV1CallSettings & {
396
440
  type: 'object-json';
397
441
  } | {
398
442
  type: 'object-grammar';
399
- schema: JsonSchema;
443
+ schema: JSONSchema7;
400
444
  } | {
401
445
  type: 'object-tool';
402
446
  tool: LanguageModelV1FunctionTool;
@@ -705,4 +749,4 @@ declare function safeValidateTypes<T>({ value, schema, }: {
705
749
  error: TypeValidationError;
706
750
  };
707
751
 
708
- export { APICallError, InvalidArgumentError, InvalidDataContentError, InvalidPromptError, InvalidResponseDataError, InvalidToolArgumentsError, JSONParseError, LanguageModelV1, LanguageModelV1CallOptions, LanguageModelV1CallWarning, LanguageModelV1FinishReason, LanguageModelV1FunctionTool, LanguageModelV1FunctionToolCall, LanguageModelV1ImagePart, LanguageModelV1Message, LanguageModelV1Prompt, LanguageModelV1StreamPart, LanguageModelV1TextPart, LanguageModelV1ToolCallPart, LanguageModelV1ToolResultPart, LoadAPIKeyError, NoResponseBodyError, NoSuchToolError, NoTextGeneratedError, ParseResult, ResponseHandler, RetryError, RetryErrorReason, TypeValidationError, UnsupportedFunctionalityError, convertBase64ToUint8Array, convertUint8ArrayToBase64, createEventSourceResponseHandler, createJsonErrorResponseHandler, createJsonResponseHandler, generateId, getErrorMessage, isParseableJson, loadApiKey, parseJSON, postJsonToApi, postToApi, safeParseJSON, safeValidateTypes, scale, validateTypes };
752
+ export { APICallError, InvalidArgumentError, InvalidDataContentError, InvalidPromptError, InvalidResponseDataError, InvalidToolArgumentsError, JSONParseError, LanguageModelV1, LanguageModelV1CallOptions, LanguageModelV1CallWarning, LanguageModelV1FinishReason, LanguageModelV1FunctionTool, LanguageModelV1FunctionToolCall, LanguageModelV1ImagePart, LanguageModelV1Message, LanguageModelV1Prompt, LanguageModelV1StreamPart, LanguageModelV1TextPart, LanguageModelV1ToolCallPart, LanguageModelV1ToolResultPart, LoadAPIKeyError, NoResponseBodyError, NoSuchToolError, NoTextGeneratedError, ParseResult, ResponseHandler, RetryError, RetryErrorReason, ToolCallParseError, TypeValidationError, UnsupportedFunctionalityError, UnsupportedJSONSchemaError, convertBase64ToUint8Array, convertUint8ArrayToBase64, createEventSourceResponseHandler, createJsonErrorResponseHandler, createJsonResponseHandler, generateId, getErrorMessage, isParseableJson, loadApiKey, parseJSON, postJsonToApi, postToApi, safeParseJSON, safeValidateTypes, scale, validateTypes };