ai 7.0.0-beta.21 → 7.0.0-beta.22
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/CHANGELOG.md +7 -0
- package/dist/index.js +41 -37
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +41 -37
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +1 -1
- package/dist/internal/index.mjs +1 -1
- package/docs/03-ai-sdk-core/16-mcp-tools.mdx +6 -0
- package/docs/03-ai-sdk-core/35-image-generation.mdx +1 -1
- package/docs/03-ai-sdk-core/40-middleware.mdx +13 -13
- package/docs/03-ai-sdk-core/55-testing.mdx +10 -10
- package/docs/03-ai-sdk-core/65-event-listeners.mdx +1 -1
- package/docs/06-advanced/04-caching.mdx +10 -10
- package/docs/07-reference/01-ai-sdk-core/01-generate-text.mdx +3 -3
- package/docs/07-reference/01-ai-sdk-core/02-stream-text.mdx +3 -3
- package/docs/07-reference/01-ai-sdk-core/10-generate-image.mdx +1 -1
- package/docs/07-reference/01-ai-sdk-core/11-transcribe.mdx +1 -1
- package/docs/07-reference/01-ai-sdk-core/12-generate-speech.mdx +1 -1
- package/docs/07-reference/01-ai-sdk-core/13-generate-video.mdx +1 -1
- package/docs/07-reference/01-ai-sdk-core/16-tool-loop-agent.mdx +1 -1
- package/docs/07-reference/01-ai-sdk-core/23-create-mcp-client.mdx +7 -0
- package/docs/07-reference/01-ai-sdk-core/30-model-message.mdx +2 -2
- package/docs/07-reference/01-ai-sdk-core/60-wrap-language-model.mdx +4 -4
- package/docs/07-reference/01-ai-sdk-core/61-wrap-image-model.mdx +4 -4
- package/docs/07-reference/01-ai-sdk-core/65-language-model-v2-middleware.mdx +9 -9
- package/docs/07-reference/01-ai-sdk-core/66-extract-reasoning-middleware.mdx +1 -1
- package/docs/07-reference/01-ai-sdk-core/68-default-settings-middleware.mdx +1 -1
- package/docs/08-migration-guides/23-migration-guide-7-0.mdx +29 -0
- package/docs/09-troubleshooting/30-model-is-not-assignable-to-type.mdx +1 -1
- package/package.json +2 -2
- package/src/generate-text/create-stream-text-part-transform.ts +64 -12
- package/src/generate-text/run-tools-transformation.ts +34 -53
- package/src/telemetry/open-telemetry-integration.ts +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1268,7 +1268,7 @@ import {
|
|
|
1268
1268
|
} from "@ai-sdk/provider-utils";
|
|
1269
1269
|
|
|
1270
1270
|
// src/version.ts
|
|
1271
|
-
var VERSION = true ? "7.0.0-beta.
|
|
1271
|
+
var VERSION = true ? "7.0.0-beta.22" : "0.0.0-test";
|
|
1272
1272
|
|
|
1273
1273
|
// src/util/download/download.ts
|
|
1274
1274
|
var download = async ({
|
|
@@ -6411,15 +6411,38 @@ function createStitchableStream() {
|
|
|
6411
6411
|
function createStreamTextPartTransform() {
|
|
6412
6412
|
return new TransformStream({
|
|
6413
6413
|
async transform(chunk, controller) {
|
|
6414
|
-
|
|
6415
|
-
|
|
6416
|
-
|
|
6417
|
-
|
|
6418
|
-
|
|
6419
|
-
|
|
6420
|
-
|
|
6421
|
-
|
|
6422
|
-
|
|
6414
|
+
switch (chunk.type) {
|
|
6415
|
+
case "text-delta":
|
|
6416
|
+
controller.enqueue({
|
|
6417
|
+
type: "text-delta",
|
|
6418
|
+
id: chunk.id,
|
|
6419
|
+
text: chunk.delta,
|
|
6420
|
+
providerMetadata: chunk.providerMetadata
|
|
6421
|
+
});
|
|
6422
|
+
break;
|
|
6423
|
+
case "reasoning-delta":
|
|
6424
|
+
controller.enqueue({
|
|
6425
|
+
type: "reasoning-delta",
|
|
6426
|
+
id: chunk.id,
|
|
6427
|
+
text: chunk.delta,
|
|
6428
|
+
providerMetadata: chunk.providerMetadata
|
|
6429
|
+
});
|
|
6430
|
+
break;
|
|
6431
|
+
case "file":
|
|
6432
|
+
case "reasoning-file": {
|
|
6433
|
+
controller.enqueue({
|
|
6434
|
+
type: chunk.type,
|
|
6435
|
+
file: new DefaultGeneratedFileWithType({
|
|
6436
|
+
data: chunk.data,
|
|
6437
|
+
mediaType: chunk.mediaType
|
|
6438
|
+
}),
|
|
6439
|
+
providerMetadata: chunk.providerMetadata
|
|
6440
|
+
});
|
|
6441
|
+
break;
|
|
6442
|
+
}
|
|
6443
|
+
default:
|
|
6444
|
+
controller.enqueue(chunk);
|
|
6445
|
+
break;
|
|
6423
6446
|
}
|
|
6424
6447
|
}
|
|
6425
6448
|
});
|
|
@@ -6475,10 +6498,13 @@ function runToolsTransformation({
|
|
|
6475
6498
|
case "text-delta":
|
|
6476
6499
|
case "text-end":
|
|
6477
6500
|
case "reasoning-start":
|
|
6501
|
+
case "reasoning-delta":
|
|
6478
6502
|
case "reasoning-end":
|
|
6479
6503
|
case "tool-input-start":
|
|
6480
6504
|
case "tool-input-delta":
|
|
6481
6505
|
case "tool-input-end":
|
|
6506
|
+
case "file":
|
|
6507
|
+
case "reasoning-file":
|
|
6482
6508
|
case "source":
|
|
6483
6509
|
case "response-metadata":
|
|
6484
6510
|
case "error":
|
|
@@ -6486,26 +6512,6 @@ function runToolsTransformation({
|
|
|
6486
6512
|
controller.enqueue(chunk);
|
|
6487
6513
|
break;
|
|
6488
6514
|
}
|
|
6489
|
-
case "reasoning-delta":
|
|
6490
|
-
controller.enqueue({
|
|
6491
|
-
type: "reasoning-delta",
|
|
6492
|
-
id: chunk.id,
|
|
6493
|
-
text: chunk.delta,
|
|
6494
|
-
providerMetadata: chunk.providerMetadata
|
|
6495
|
-
});
|
|
6496
|
-
break;
|
|
6497
|
-
case "file":
|
|
6498
|
-
case "reasoning-file": {
|
|
6499
|
-
controller.enqueue({
|
|
6500
|
-
type: chunk.type,
|
|
6501
|
-
file: new DefaultGeneratedFileWithType({
|
|
6502
|
-
data: chunk.data,
|
|
6503
|
-
mediaType: chunk.mediaType
|
|
6504
|
-
}),
|
|
6505
|
-
...chunk.providerMetadata != null ? { providerMetadata: chunk.providerMetadata } : {}
|
|
6506
|
-
});
|
|
6507
|
-
break;
|
|
6508
|
-
}
|
|
6509
6515
|
case "finish": {
|
|
6510
6516
|
finishChunk = {
|
|
6511
6517
|
type: "finish",
|
|
@@ -6624,8 +6630,8 @@ function runToolsTransformation({
|
|
|
6624
6630
|
}
|
|
6625
6631
|
case "tool-result": {
|
|
6626
6632
|
const toolName = chunk.toolName;
|
|
6627
|
-
|
|
6628
|
-
|
|
6633
|
+
controller.enqueue(
|
|
6634
|
+
chunk.isError ? {
|
|
6629
6635
|
type: "tool-error",
|
|
6630
6636
|
toolCallId: chunk.toolCallId,
|
|
6631
6637
|
toolName,
|
|
@@ -6634,9 +6640,7 @@ function runToolsTransformation({
|
|
|
6634
6640
|
error: chunk.result,
|
|
6635
6641
|
dynamic: chunk.dynamic,
|
|
6636
6642
|
...chunk.providerMetadata != null ? { providerMetadata: chunk.providerMetadata } : {}
|
|
6637
|
-
}
|
|
6638
|
-
} else {
|
|
6639
|
-
controller.enqueue({
|
|
6643
|
+
} : {
|
|
6640
6644
|
type: "tool-result",
|
|
6641
6645
|
toolCallId: chunk.toolCallId,
|
|
6642
6646
|
toolName,
|
|
@@ -6645,8 +6649,8 @@ function runToolsTransformation({
|
|
|
6645
6649
|
providerExecuted: true,
|
|
6646
6650
|
dynamic: chunk.dynamic,
|
|
6647
6651
|
...chunk.providerMetadata != null ? { providerMetadata: chunk.providerMetadata } : {}
|
|
6648
|
-
}
|
|
6649
|
-
|
|
6652
|
+
}
|
|
6653
|
+
);
|
|
6650
6654
|
break;
|
|
6651
6655
|
}
|
|
6652
6656
|
default: {
|