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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# ai
|
|
2
2
|
|
|
3
|
+
## 7.0.0-beta.23
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 80d4dde: fix(ai): include tool input on tool result for provider executed dynamic tools
|
|
8
|
+
- Updated dependencies [61753c3]
|
|
9
|
+
- @ai-sdk/provider-utils@5.0.0-beta.4
|
|
10
|
+
- @ai-sdk/gateway@4.0.0-beta.15
|
|
11
|
+
|
|
12
|
+
## 7.0.0-beta.22
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies [ead9144]
|
|
17
|
+
- @ai-sdk/gateway@4.0.0-beta.14
|
|
18
|
+
|
|
3
19
|
## 7.0.0-beta.21
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -1377,7 +1377,7 @@ var import_provider_utils3 = require("@ai-sdk/provider-utils");
|
|
|
1377
1377
|
var import_provider_utils4 = require("@ai-sdk/provider-utils");
|
|
1378
1378
|
|
|
1379
1379
|
// src/version.ts
|
|
1380
|
-
var VERSION = true ? "7.0.0-beta.
|
|
1380
|
+
var VERSION = true ? "7.0.0-beta.23" : "0.0.0-test";
|
|
1381
1381
|
|
|
1382
1382
|
// src/util/download/download.ts
|
|
1383
1383
|
var download = async ({
|
|
@@ -6490,15 +6490,38 @@ function createStitchableStream() {
|
|
|
6490
6490
|
function createStreamTextPartTransform() {
|
|
6491
6491
|
return new TransformStream({
|
|
6492
6492
|
async transform(chunk, controller) {
|
|
6493
|
-
|
|
6494
|
-
|
|
6495
|
-
|
|
6496
|
-
|
|
6497
|
-
|
|
6498
|
-
|
|
6499
|
-
|
|
6500
|
-
|
|
6501
|
-
|
|
6493
|
+
switch (chunk.type) {
|
|
6494
|
+
case "text-delta":
|
|
6495
|
+
controller.enqueue({
|
|
6496
|
+
type: "text-delta",
|
|
6497
|
+
id: chunk.id,
|
|
6498
|
+
text: chunk.delta,
|
|
6499
|
+
providerMetadata: chunk.providerMetadata
|
|
6500
|
+
});
|
|
6501
|
+
break;
|
|
6502
|
+
case "reasoning-delta":
|
|
6503
|
+
controller.enqueue({
|
|
6504
|
+
type: "reasoning-delta",
|
|
6505
|
+
id: chunk.id,
|
|
6506
|
+
text: chunk.delta,
|
|
6507
|
+
providerMetadata: chunk.providerMetadata
|
|
6508
|
+
});
|
|
6509
|
+
break;
|
|
6510
|
+
case "file":
|
|
6511
|
+
case "reasoning-file": {
|
|
6512
|
+
controller.enqueue({
|
|
6513
|
+
type: chunk.type,
|
|
6514
|
+
file: new DefaultGeneratedFileWithType({
|
|
6515
|
+
data: chunk.data,
|
|
6516
|
+
mediaType: chunk.mediaType
|
|
6517
|
+
}),
|
|
6518
|
+
providerMetadata: chunk.providerMetadata
|
|
6519
|
+
});
|
|
6520
|
+
break;
|
|
6521
|
+
}
|
|
6522
|
+
default:
|
|
6523
|
+
controller.enqueue(chunk);
|
|
6524
|
+
break;
|
|
6502
6525
|
}
|
|
6503
6526
|
}
|
|
6504
6527
|
});
|
|
@@ -6531,7 +6554,6 @@ function runToolsTransformation({
|
|
|
6531
6554
|
}
|
|
6532
6555
|
});
|
|
6533
6556
|
const outstandingToolResults = /* @__PURE__ */ new Set();
|
|
6534
|
-
const toolInputs = /* @__PURE__ */ new Map();
|
|
6535
6557
|
const toolCallsByToolCallId = /* @__PURE__ */ new Map();
|
|
6536
6558
|
let canClose = false;
|
|
6537
6559
|
let finishChunk = void 0;
|
|
@@ -6545,6 +6567,7 @@ function runToolsTransformation({
|
|
|
6545
6567
|
}
|
|
6546
6568
|
const forwardStream = new TransformStream({
|
|
6547
6569
|
async transform(chunk, controller) {
|
|
6570
|
+
var _a21, _b;
|
|
6548
6571
|
const chunkType = chunk.type;
|
|
6549
6572
|
switch (chunkType) {
|
|
6550
6573
|
case "stream-start":
|
|
@@ -6552,10 +6575,13 @@ function runToolsTransformation({
|
|
|
6552
6575
|
case "text-delta":
|
|
6553
6576
|
case "text-end":
|
|
6554
6577
|
case "reasoning-start":
|
|
6578
|
+
case "reasoning-delta":
|
|
6555
6579
|
case "reasoning-end":
|
|
6556
6580
|
case "tool-input-start":
|
|
6557
6581
|
case "tool-input-delta":
|
|
6558
6582
|
case "tool-input-end":
|
|
6583
|
+
case "file":
|
|
6584
|
+
case "reasoning-file":
|
|
6559
6585
|
case "source":
|
|
6560
6586
|
case "response-metadata":
|
|
6561
6587
|
case "error":
|
|
@@ -6563,26 +6589,6 @@ function runToolsTransformation({
|
|
|
6563
6589
|
controller.enqueue(chunk);
|
|
6564
6590
|
break;
|
|
6565
6591
|
}
|
|
6566
|
-
case "reasoning-delta":
|
|
6567
|
-
controller.enqueue({
|
|
6568
|
-
type: "reasoning-delta",
|
|
6569
|
-
id: chunk.id,
|
|
6570
|
-
text: chunk.delta,
|
|
6571
|
-
providerMetadata: chunk.providerMetadata
|
|
6572
|
-
});
|
|
6573
|
-
break;
|
|
6574
|
-
case "file":
|
|
6575
|
-
case "reasoning-file": {
|
|
6576
|
-
controller.enqueue({
|
|
6577
|
-
type: chunk.type,
|
|
6578
|
-
file: new DefaultGeneratedFileWithType({
|
|
6579
|
-
data: chunk.data,
|
|
6580
|
-
mediaType: chunk.mediaType
|
|
6581
|
-
}),
|
|
6582
|
-
...chunk.providerMetadata != null ? { providerMetadata: chunk.providerMetadata } : {}
|
|
6583
|
-
});
|
|
6584
|
-
break;
|
|
6585
|
-
}
|
|
6586
6592
|
case "finish": {
|
|
6587
6593
|
finishChunk = {
|
|
6588
6594
|
type: "finish",
|
|
@@ -6661,7 +6667,6 @@ function runToolsTransformation({
|
|
|
6661
6667
|
});
|
|
6662
6668
|
break;
|
|
6663
6669
|
}
|
|
6664
|
-
toolInputs.set(toolCall.toolCallId, toolCall.input);
|
|
6665
6670
|
if (tool2.execute != null && toolCall.providerExecuted !== true) {
|
|
6666
6671
|
const toolExecutionId = generateId2();
|
|
6667
6672
|
outstandingToolResults.add(toolExecutionId);
|
|
@@ -6701,29 +6706,27 @@ function runToolsTransformation({
|
|
|
6701
6706
|
}
|
|
6702
6707
|
case "tool-result": {
|
|
6703
6708
|
const toolName = chunk.toolName;
|
|
6704
|
-
|
|
6705
|
-
|
|
6709
|
+
controller.enqueue(
|
|
6710
|
+
chunk.isError ? {
|
|
6706
6711
|
type: "tool-error",
|
|
6707
6712
|
toolCallId: chunk.toolCallId,
|
|
6708
6713
|
toolName,
|
|
6709
|
-
input:
|
|
6714
|
+
input: (_a21 = toolCallsByToolCallId.get(chunk.toolCallId)) == null ? void 0 : _a21.input,
|
|
6710
6715
|
providerExecuted: true,
|
|
6711
6716
|
error: chunk.result,
|
|
6712
6717
|
dynamic: chunk.dynamic,
|
|
6713
6718
|
...chunk.providerMetadata != null ? { providerMetadata: chunk.providerMetadata } : {}
|
|
6714
|
-
}
|
|
6715
|
-
} else {
|
|
6716
|
-
controller.enqueue({
|
|
6719
|
+
} : {
|
|
6717
6720
|
type: "tool-result",
|
|
6718
6721
|
toolCallId: chunk.toolCallId,
|
|
6719
6722
|
toolName,
|
|
6720
|
-
input:
|
|
6723
|
+
input: (_b = toolCallsByToolCallId.get(chunk.toolCallId)) == null ? void 0 : _b.input,
|
|
6721
6724
|
output: chunk.result,
|
|
6722
6725
|
providerExecuted: true,
|
|
6723
6726
|
dynamic: chunk.dynamic,
|
|
6724
6727
|
...chunk.providerMetadata != null ? { providerMetadata: chunk.providerMetadata } : {}
|
|
6725
|
-
}
|
|
6726
|
-
|
|
6728
|
+
}
|
|
6729
|
+
);
|
|
6727
6730
|
break;
|
|
6728
6731
|
}
|
|
6729
6732
|
default: {
|