ai 4.0.0-canary.1 → 4.0.0-canary.3

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai",
3
- "version": "4.0.0-canary.1",
3
+ "version": "4.0.0-canary.3",
4
4
  "description": "AI SDK by Vercel - The AI Toolkit for TypeScript and JavaScript",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": false,
@@ -40,10 +40,10 @@
40
40
  }
41
41
  },
42
42
  "dependencies": {
43
- "@ai-sdk/provider": "0.0.26",
44
- "@ai-sdk/provider-utils": "1.0.22",
45
- "@ai-sdk/react": "1.0.0-canary.1",
46
- "@ai-sdk/ui-utils": "1.0.0-canary.1",
43
+ "@ai-sdk/provider": "1.0.0-canary.0",
44
+ "@ai-sdk/provider-utils": "2.0.0-canary.1",
45
+ "@ai-sdk/react": "1.0.0-canary.3",
46
+ "@ai-sdk/ui-utils": "1.0.0-canary.3",
47
47
  "@opentelemetry/api": "1.9.0",
48
48
  "eventsource-parser": "1.1.2",
49
49
  "jsondiffpatch": "0.6.0",
@@ -437,7 +437,7 @@ It can be a user message, an assistant message, or a tool message.
437
437
  type CoreMessage = CoreSystemMessage | CoreUserMessage | CoreAssistantMessage | CoreToolMessage;
438
438
 
439
439
  type UIMessage = {
440
- role: 'system' | 'user' | 'assistant' | 'function' | 'data' | 'tool';
440
+ role: 'system' | 'user' | 'assistant' | 'data';
441
441
  content: string;
442
442
  toolInvocations?: ToolInvocation[];
443
443
  experimental_attachments?: Attachment[];
@@ -435,7 +435,7 @@ It can be a user message, an assistant message, or a tool message.
435
435
  type CoreMessage = CoreSystemMessage | CoreUserMessage | CoreAssistantMessage | CoreToolMessage;
436
436
 
437
437
  type UIMessage = {
438
- role: 'system' | 'user' | 'assistant' | 'function' | 'data' | 'tool';
438
+ role: 'system' | 'user' | 'assistant' | 'data';
439
439
  content: string;
440
440
  toolInvocations?: ToolInvocation[];
441
441
  experimental_attachments?: Attachment[];
@@ -236,25 +236,6 @@ var DownloadError = class extends AISDKError {
236
236
  static isInstance(error) {
237
237
  return AISDKError.hasMarker(error, marker);
238
238
  }
239
- /**
240
- * @deprecated use `isInstance` instead
241
- */
242
- static isDownloadError(error) {
243
- return error instanceof Error && error.name === name && typeof error.url === "string" && (error.statusCode == null || typeof error.statusCode === "number") && (error.statusText == null || typeof error.statusText === "string");
244
- }
245
- /**
246
- * @deprecated Do not use this method. It will be removed in the next major version.
247
- */
248
- toJSON() {
249
- return {
250
- name: this.name,
251
- message: this.message,
252
- url: this.url,
253
- statusCode: this.statusCode,
254
- statusText: this.statusText,
255
- cause: this.cause
256
- };
257
- }
258
239
  };
259
240
  _a = symbol;
260
241
 
@@ -327,24 +308,6 @@ var InvalidDataContentError = class extends AISDKError2 {
327
308
  static isInstance(error) {
328
309
  return AISDKError2.hasMarker(error, marker2);
329
310
  }
330
- /**
331
- * @deprecated use `isInstance` instead
332
- */
333
- static isInvalidDataContentError(error) {
334
- return error instanceof Error && error.name === name2 && error.content != null;
335
- }
336
- /**
337
- * @deprecated Do not use this method. It will be removed in the next major version.
338
- */
339
- toJSON() {
340
- return {
341
- name: this.name,
342
- message: this.message,
343
- stack: this.stack,
344
- cause: this.cause,
345
- content: this.content
346
- };
347
- }
348
311
  };
349
312
  _a2 = symbol2;
350
313
 
@@ -418,23 +381,6 @@ var InvalidMessageRoleError = class extends AISDKError3 {
418
381
  static isInstance(error) {
419
382
  return AISDKError3.hasMarker(error, marker3);
420
383
  }
421
- /**
422
- * @deprecated use `isInstance` instead
423
- */
424
- static isInvalidMessageRoleError(error) {
425
- return error instanceof Error && error.name === name3 && typeof error.role === "string";
426
- }
427
- /**
428
- * @deprecated Do not use this method. It will be removed in the next major version.
429
- */
430
- toJSON() {
431
- return {
432
- name: this.name,
433
- message: this.message,
434
- stack: this.stack,
435
- role: this.role
436
- };
437
- }
438
384
  };
439
385
  _a3 = symbol3;
440
386
 
@@ -662,21 +608,6 @@ var InvalidArgumentError = class extends AISDKError4 {
662
608
  static isInstance(error) {
663
609
  return AISDKError4.hasMarker(error, marker4);
664
610
  }
665
- /**
666
- * @deprecated use `isInstance` instead
667
- */
668
- static isInvalidArgumentError(error) {
669
- return error instanceof Error && error.name === name4 && typeof error.parameter === "string" && typeof error.value === "string";
670
- }
671
- toJSON() {
672
- return {
673
- name: this.name,
674
- message: this.message,
675
- stack: this.stack,
676
- parameter: this.parameter,
677
- value: this.value
678
- };
679
- }
680
611
  };
681
612
  _a4 = symbol4;
682
613
 
@@ -1161,9 +1092,7 @@ function convertToCoreMessages(messages, options) {
1161
1092
  });
1162
1093
  break;
1163
1094
  }
1164
- case "function":
1165
- case "data":
1166
- case "tool": {
1095
+ case "data": {
1167
1096
  break;
1168
1097
  }
1169
1098
  default: {
@@ -1288,19 +1217,6 @@ var InvalidToolArgumentsError = class extends AISDKError6 {
1288
1217
  static isInvalidToolArgumentsError(error) {
1289
1218
  return error instanceof Error && error.name === name6 && typeof error.toolName === "string" && typeof error.toolArgs === "string";
1290
1219
  }
1291
- /**
1292
- * @deprecated Do not use this method. It will be removed in the next major version.
1293
- */
1294
- toJSON() {
1295
- return {
1296
- name: this.name,
1297
- message: this.message,
1298
- cause: this.cause,
1299
- stack: this.stack,
1300
- toolName: this.toolName,
1301
- toolArgs: this.toolArgs
1302
- };
1303
- }
1304
1220
  };
1305
1221
  _a6 = symbol6;
1306
1222
 
@@ -1324,24 +1240,6 @@ var NoSuchToolError = class extends AISDKError7 {
1324
1240
  static isInstance(error) {
1325
1241
  return AISDKError7.hasMarker(error, marker7);
1326
1242
  }
1327
- /**
1328
- * @deprecated use `isInstance` instead
1329
- */
1330
- static isNoSuchToolError(error) {
1331
- return error instanceof Error && error.name === name7 && "toolName" in error && error.toolName != void 0 && typeof error.name === "string";
1332
- }
1333
- /**
1334
- * @deprecated Do not use this method. It will be removed in the next major version.
1335
- */
1336
- toJSON() {
1337
- return {
1338
- name: this.name,
1339
- message: this.message,
1340
- stack: this.stack,
1341
- toolName: this.toolName,
1342
- availableTools: this.availableTools
1343
- };
1344
- }
1345
1243
  };
1346
1244
  _a7 = symbol7;
1347
1245
 
@@ -1385,24 +1283,6 @@ var RetryError = class extends AISDKError8 {
1385
1283
  static isInstance(error) {
1386
1284
  return AISDKError8.hasMarker(error, marker8);
1387
1285
  }
1388
- /**
1389
- * @deprecated use `isInstance` instead
1390
- */
1391
- static isRetryError(error) {
1392
- return error instanceof Error && error.name === name8 && typeof error.reason === "string" && Array.isArray(error.errors);
1393
- }
1394
- /**
1395
- * @deprecated Do not use this method. It will be removed in the next major version.
1396
- */
1397
- toJSON() {
1398
- return {
1399
- name: this.name,
1400
- message: this.message,
1401
- reason: this.reason,
1402
- lastError: this.lastError,
1403
- errors: this.errors
1404
- };
1405
- }
1406
1286
  };
1407
1287
  _a8 = symbol8;
1408
1288
 
@@ -1440,7 +1320,7 @@ async function _retryWithExponentialBackoff(f, {
1440
1320
  errors: newErrors
1441
1321
  });
1442
1322
  }
1443
- if (error instanceof Error && APICallError.isAPICallError(error) && error.isRetryable === true && tryNumber <= maxRetries) {
1323
+ if (error instanceof Error && APICallError.isInstance(error) && error.isRetryable === true && tryNumber <= maxRetries) {
1444
1324
  await delay(delayInMs);
1445
1325
  return _retryWithExponentialBackoff(
1446
1326
  f,