ai 7.0.0-beta.21 → 7.0.0-beta.23
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 +16 -0
- package/dist/index.js +44 -41
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +44 -41
- 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 +3 -3
- package/src/generate-text/create-stream-text-part-transform.ts +64 -12
- package/src/generate-text/run-tools-transformation.ts +35 -58
- 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.23" : "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
|
});
|
|
@@ -6454,7 +6477,6 @@ function runToolsTransformation({
|
|
|
6454
6477
|
}
|
|
6455
6478
|
});
|
|
6456
6479
|
const outstandingToolResults = /* @__PURE__ */ new Set();
|
|
6457
|
-
const toolInputs = /* @__PURE__ */ new Map();
|
|
6458
6480
|
const toolCallsByToolCallId = /* @__PURE__ */ new Map();
|
|
6459
6481
|
let canClose = false;
|
|
6460
6482
|
let finishChunk = void 0;
|
|
@@ -6468,6 +6490,7 @@ function runToolsTransformation({
|
|
|
6468
6490
|
}
|
|
6469
6491
|
const forwardStream = new TransformStream({
|
|
6470
6492
|
async transform(chunk, controller) {
|
|
6493
|
+
var _a21, _b;
|
|
6471
6494
|
const chunkType = chunk.type;
|
|
6472
6495
|
switch (chunkType) {
|
|
6473
6496
|
case "stream-start":
|
|
@@ -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",
|
|
@@ -6584,7 +6590,6 @@ function runToolsTransformation({
|
|
|
6584
6590
|
});
|
|
6585
6591
|
break;
|
|
6586
6592
|
}
|
|
6587
|
-
toolInputs.set(toolCall.toolCallId, toolCall.input);
|
|
6588
6593
|
if (tool2.execute != null && toolCall.providerExecuted !== true) {
|
|
6589
6594
|
const toolExecutionId = generateId2();
|
|
6590
6595
|
outstandingToolResults.add(toolExecutionId);
|
|
@@ -6624,29 +6629,27 @@ function runToolsTransformation({
|
|
|
6624
6629
|
}
|
|
6625
6630
|
case "tool-result": {
|
|
6626
6631
|
const toolName = chunk.toolName;
|
|
6627
|
-
|
|
6628
|
-
|
|
6632
|
+
controller.enqueue(
|
|
6633
|
+
chunk.isError ? {
|
|
6629
6634
|
type: "tool-error",
|
|
6630
6635
|
toolCallId: chunk.toolCallId,
|
|
6631
6636
|
toolName,
|
|
6632
|
-
input:
|
|
6637
|
+
input: (_a21 = toolCallsByToolCallId.get(chunk.toolCallId)) == null ? void 0 : _a21.input,
|
|
6633
6638
|
providerExecuted: true,
|
|
6634
6639
|
error: chunk.result,
|
|
6635
6640
|
dynamic: chunk.dynamic,
|
|
6636
6641
|
...chunk.providerMetadata != null ? { providerMetadata: chunk.providerMetadata } : {}
|
|
6637
|
-
}
|
|
6638
|
-
} else {
|
|
6639
|
-
controller.enqueue({
|
|
6642
|
+
} : {
|
|
6640
6643
|
type: "tool-result",
|
|
6641
6644
|
toolCallId: chunk.toolCallId,
|
|
6642
6645
|
toolName,
|
|
6643
|
-
input:
|
|
6646
|
+
input: (_b = toolCallsByToolCallId.get(chunk.toolCallId)) == null ? void 0 : _b.input,
|
|
6644
6647
|
output: chunk.result,
|
|
6645
6648
|
providerExecuted: true,
|
|
6646
6649
|
dynamic: chunk.dynamic,
|
|
6647
6650
|
...chunk.providerMetadata != null ? { providerMetadata: chunk.providerMetadata } : {}
|
|
6648
|
-
}
|
|
6649
|
-
|
|
6651
|
+
}
|
|
6652
|
+
);
|
|
6650
6653
|
break;
|
|
6651
6654
|
}
|
|
6652
6655
|
default: {
|