ai 6.0.286 → 6.0.288
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 +20 -0
- package/dist/index.js +11 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -10
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +1 -1
- package/dist/internal/index.mjs +1 -1
- package/docs/02-foundations/02-providers-and-models.mdx +1 -0
- package/package.json +3 -3
- package/src/ui/convert-to-model-messages.ts +8 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# ai
|
|
2
2
|
|
|
3
|
+
## 6.0.288
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [bd8bf1f]
|
|
8
|
+
- @ai-sdk/gateway@3.0.198
|
|
9
|
+
|
|
10
|
+
## 6.0.287
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- 9af6cfa: fix(ai): preserve provider metadata when converting failed tool calls
|
|
15
|
+
- Updated dependencies [5f2d078]
|
|
16
|
+
- Updated dependencies [1096a27]
|
|
17
|
+
- Updated dependencies [2a82d35]
|
|
18
|
+
- Updated dependencies [82e18b0]
|
|
19
|
+
- Updated dependencies [eea6869]
|
|
20
|
+
- @ai-sdk/gateway@3.0.197
|
|
21
|
+
- @ai-sdk/provider-utils@4.0.52
|
|
22
|
+
|
|
3
23
|
## 6.0.286
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -1334,7 +1334,7 @@ function detectMediaType({
|
|
|
1334
1334
|
var import_provider_utils3 = require("@ai-sdk/provider-utils");
|
|
1335
1335
|
|
|
1336
1336
|
// src/version.ts
|
|
1337
|
-
var VERSION = true ? "6.0.
|
|
1337
|
+
var VERSION = true ? "6.0.288" : "0.0.0-test";
|
|
1338
1338
|
|
|
1339
1339
|
// src/util/download/download.ts
|
|
1340
1340
|
var download = async ({
|
|
@@ -9543,7 +9543,7 @@ async function convertToModelMessages(messages, options) {
|
|
|
9543
9543
|
if (message.parts != null) {
|
|
9544
9544
|
let block = [];
|
|
9545
9545
|
async function processBlock() {
|
|
9546
|
-
var _a23, _b, _c, _d, _e, _f, _g, _h;
|
|
9546
|
+
var _a23, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
9547
9547
|
if (block.length === 0) {
|
|
9548
9548
|
return;
|
|
9549
9549
|
}
|
|
@@ -9572,13 +9572,14 @@ async function convertToModelMessages(messages, options) {
|
|
|
9572
9572
|
} else if (isToolUIPart(part)) {
|
|
9573
9573
|
const toolName = getToolName(part);
|
|
9574
9574
|
if (part.state !== "input-streaming") {
|
|
9575
|
+
const callProviderMetadata = (_a23 = part.callProviderMetadata) != null ? _a23 : part.state === "output-error" ? part.resultProviderMetadata : void 0;
|
|
9575
9576
|
content.push({
|
|
9576
9577
|
type: "tool-call",
|
|
9577
9578
|
toolCallId: part.toolCallId,
|
|
9578
9579
|
toolName,
|
|
9579
|
-
input: part.state === "output-error" ? (
|
|
9580
|
+
input: part.state === "output-error" ? (_b = part.input) != null ? _b : "rawInput" in part ? part.rawInput : void 0 : part.input,
|
|
9580
9581
|
providerExecuted: part.providerExecuted,
|
|
9581
|
-
...
|
|
9582
|
+
...callProviderMetadata != null ? { providerOptions: callProviderMetadata } : {}
|
|
9582
9583
|
});
|
|
9583
9584
|
if (part.approval != null) {
|
|
9584
9585
|
content.push({
|
|
@@ -9589,7 +9590,7 @@ async function convertToModelMessages(messages, options) {
|
|
|
9589
9590
|
});
|
|
9590
9591
|
}
|
|
9591
9592
|
if (part.providerExecuted === true && part.state !== "approval-responded" && (part.state === "output-available" || part.state === "output-error")) {
|
|
9592
|
-
const resultProviderMetadata = (
|
|
9593
|
+
const resultProviderMetadata = (_c = part.resultProviderMetadata) != null ? _c : part.callProviderMetadata;
|
|
9593
9594
|
content.push({
|
|
9594
9595
|
type: "tool-result",
|
|
9595
9596
|
toolCallId: part.toolCallId,
|
|
@@ -9598,7 +9599,7 @@ async function convertToModelMessages(messages, options) {
|
|
|
9598
9599
|
toolCallId: part.toolCallId,
|
|
9599
9600
|
input: part.input,
|
|
9600
9601
|
output: part.state === "output-error" ? part.errorText : part.output,
|
|
9601
|
-
tool: (
|
|
9602
|
+
tool: (_d = options == null ? void 0 : options.tools) == null ? void 0 : _d[toolName],
|
|
9602
9603
|
errorMode: part.state === "output-error" ? "json" : "none"
|
|
9603
9604
|
}),
|
|
9604
9605
|
...resultProviderMetadata != null ? { providerOptions: resultProviderMetadata } : {}
|
|
@@ -9606,7 +9607,7 @@ async function convertToModelMessages(messages, options) {
|
|
|
9606
9607
|
}
|
|
9607
9608
|
}
|
|
9608
9609
|
} else if (isDataUIPart(part)) {
|
|
9609
|
-
const dataPart = (
|
|
9610
|
+
const dataPart = (_e = options == null ? void 0 : options.convertDataPart) == null ? void 0 : _e.call(
|
|
9610
9611
|
options,
|
|
9611
9612
|
part
|
|
9612
9613
|
);
|
|
@@ -9634,7 +9635,7 @@ async function convertToModelMessages(messages, options) {
|
|
|
9634
9635
|
{
|
|
9635
9636
|
const content2 = [];
|
|
9636
9637
|
for (const toolPart of toolParts) {
|
|
9637
|
-
if (((
|
|
9638
|
+
if (((_f = toolPart.approval) == null ? void 0 : _f.approved) != null) {
|
|
9638
9639
|
content2.push({
|
|
9639
9640
|
type: "tool-approval-response",
|
|
9640
9641
|
approvalId: toolPart.approval.id,
|
|
@@ -9654,7 +9655,7 @@ async function convertToModelMessages(messages, options) {
|
|
|
9654
9655
|
toolName: getToolName(toolPart),
|
|
9655
9656
|
output: {
|
|
9656
9657
|
type: "error-text",
|
|
9657
|
-
value: (
|
|
9658
|
+
value: (_h = (_g = toolPart.approval) == null ? void 0 : _g.reason) != null ? _h : "Tool call execution denied."
|
|
9658
9659
|
},
|
|
9659
9660
|
...toolPart.callProviderMetadata != null ? { providerOptions: toolPart.callProviderMetadata } : {}
|
|
9660
9661
|
});
|
|
@@ -9671,7 +9672,7 @@ async function convertToModelMessages(messages, options) {
|
|
|
9671
9672
|
toolCallId: toolPart.toolCallId,
|
|
9672
9673
|
input: toolPart.input,
|
|
9673
9674
|
output: toolPart.state === "output-error" ? toolPart.errorText : toolPart.output,
|
|
9674
|
-
tool: (
|
|
9675
|
+
tool: (_i = options == null ? void 0 : options.tools) == null ? void 0 : _i[toolName],
|
|
9675
9676
|
errorMode: toolPart.state === "output-error" ? "text" : "none"
|
|
9676
9677
|
}),
|
|
9677
9678
|
...toolPart.callProviderMetadata != null ? { providerOptions: toolPart.callProviderMetadata } : {}
|