ai 5.0.264 → 5.0.266
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 +19 -0
- package/dist/index.js +35 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +35 -13
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +1 -1
- package/dist/internal/index.mjs +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# ai
|
|
2
2
|
|
|
3
|
+
## 5.0.266
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [cd9b333]
|
|
8
|
+
- @ai-sdk/gateway@2.0.158
|
|
9
|
+
|
|
10
|
+
## 5.0.265
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- bf29419: chore: enable dead code lint rules
|
|
15
|
+
- 0519802: fix(ai): preserve parsed metadata and data values when validating UI messages
|
|
16
|
+
- Updated dependencies [0430ee6]
|
|
17
|
+
- Updated dependencies [bf29419]
|
|
18
|
+
- Updated dependencies [14ecfdc]
|
|
19
|
+
- @ai-sdk/gateway@2.0.157
|
|
20
|
+
- @ai-sdk/provider-utils@3.0.39
|
|
21
|
+
|
|
3
22
|
## 5.0.264
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -816,7 +816,7 @@ function detectMediaType({
|
|
|
816
816
|
var import_provider_utils2 = require("@ai-sdk/provider-utils");
|
|
817
817
|
|
|
818
818
|
// src/version.ts
|
|
819
|
-
var VERSION = true ? "5.0.
|
|
819
|
+
var VERSION = true ? "5.0.266" : "0.0.0-test";
|
|
820
820
|
|
|
821
821
|
// src/util/download/download.ts
|
|
822
822
|
var download = async ({
|
|
@@ -2025,8 +2025,8 @@ var DefaultGeneratedFile = class {
|
|
|
2025
2025
|
}
|
|
2026
2026
|
};
|
|
2027
2027
|
var DefaultGeneratedFileWithType = class extends DefaultGeneratedFile {
|
|
2028
|
-
constructor(
|
|
2029
|
-
super(
|
|
2028
|
+
constructor() {
|
|
2029
|
+
super(...arguments);
|
|
2030
2030
|
this.type = "file";
|
|
2031
2031
|
}
|
|
2032
2032
|
};
|
|
@@ -2047,6 +2047,9 @@ async function parseToolCall({
|
|
|
2047
2047
|
}) {
|
|
2048
2048
|
try {
|
|
2049
2049
|
if (tools == null) {
|
|
2050
|
+
if (toolCall.providerExecuted) {
|
|
2051
|
+
return await parseProviderExecutedDynamicToolCall(toolCall);
|
|
2052
|
+
}
|
|
2050
2053
|
throw new NoSuchToolError({ toolName: toolCall.toolName });
|
|
2051
2054
|
}
|
|
2052
2055
|
try {
|
|
@@ -2094,6 +2097,25 @@ async function parseToolCall({
|
|
|
2094
2097
|
};
|
|
2095
2098
|
}
|
|
2096
2099
|
}
|
|
2100
|
+
async function parseProviderExecutedDynamicToolCall(toolCall) {
|
|
2101
|
+
const parseResult = toolCall.input.trim() === "" ? { success: true, value: {} } : await (0, import_provider_utils9.safeParseJSON)({ text: toolCall.input });
|
|
2102
|
+
if (parseResult.success === false) {
|
|
2103
|
+
throw new InvalidToolInputError({
|
|
2104
|
+
toolName: toolCall.toolName,
|
|
2105
|
+
toolInput: toolCall.input,
|
|
2106
|
+
cause: parseResult.error
|
|
2107
|
+
});
|
|
2108
|
+
}
|
|
2109
|
+
return {
|
|
2110
|
+
type: "tool-call",
|
|
2111
|
+
toolCallId: toolCall.toolCallId,
|
|
2112
|
+
toolName: toolCall.toolName,
|
|
2113
|
+
input: parseResult.value,
|
|
2114
|
+
providerExecuted: true,
|
|
2115
|
+
dynamic: true,
|
|
2116
|
+
providerMetadata: toolCall.providerMetadata
|
|
2117
|
+
};
|
|
2118
|
+
}
|
|
2097
2119
|
async function doParseToolCall({
|
|
2098
2120
|
toolCall,
|
|
2099
2121
|
tools
|
|
@@ -2101,6 +2123,9 @@ async function doParseToolCall({
|
|
|
2101
2123
|
const toolName = toolCall.toolName;
|
|
2102
2124
|
const tool2 = tools[toolName];
|
|
2103
2125
|
if (tool2 == null) {
|
|
2126
|
+
if (toolCall.providerExecuted) {
|
|
2127
|
+
return await parseProviderExecutedDynamicToolCall(toolCall);
|
|
2128
|
+
}
|
|
2104
2129
|
throw new NoSuchToolError({
|
|
2105
2130
|
toolName: toolCall.toolName,
|
|
2106
2131
|
availableTools: Object.keys(tools)
|
|
@@ -2994,8 +3019,6 @@ function writeToServerResponse({
|
|
|
2994
3019
|
});
|
|
2995
3020
|
}
|
|
2996
3021
|
}
|
|
2997
|
-
} catch (error) {
|
|
2998
|
-
throw error;
|
|
2999
3022
|
} finally {
|
|
3000
3023
|
response.end();
|
|
3001
3024
|
}
|
|
@@ -6653,7 +6676,6 @@ async function embedMany({
|
|
|
6653
6676
|
}),
|
|
6654
6677
|
tracer,
|
|
6655
6678
|
fn: async (span) => {
|
|
6656
|
-
var _a16;
|
|
6657
6679
|
const [
|
|
6658
6680
|
maxEmbeddingsPerCall,
|
|
6659
6681
|
maxInputBytesPerCall,
|
|
@@ -6686,7 +6708,7 @@ async function embedMany({
|
|
|
6686
6708
|
}),
|
|
6687
6709
|
tracer,
|
|
6688
6710
|
fn: async (doEmbedSpan) => {
|
|
6689
|
-
var
|
|
6711
|
+
var _a16;
|
|
6690
6712
|
const modelResponse = await model.doEmbed({
|
|
6691
6713
|
values,
|
|
6692
6714
|
abortSignal,
|
|
@@ -6694,7 +6716,7 @@ async function embedMany({
|
|
|
6694
6716
|
providerOptions
|
|
6695
6717
|
});
|
|
6696
6718
|
const embeddings3 = modelResponse.embeddings;
|
|
6697
|
-
const usage2 = (
|
|
6719
|
+
const usage2 = (_a16 = modelResponse.usage) != null ? _a16 : { tokens: NaN };
|
|
6698
6720
|
doEmbedSpan.setAttributes(
|
|
6699
6721
|
selectTelemetryAttributes({
|
|
6700
6722
|
telemetry,
|
|
@@ -6772,7 +6794,7 @@ async function embedMany({
|
|
|
6772
6794
|
}),
|
|
6773
6795
|
tracer,
|
|
6774
6796
|
fn: async (doEmbedSpan) => {
|
|
6775
|
-
var
|
|
6797
|
+
var _a16;
|
|
6776
6798
|
const modelResponse = await model.doEmbed({
|
|
6777
6799
|
values: chunk,
|
|
6778
6800
|
abortSignal,
|
|
@@ -6780,7 +6802,7 @@ async function embedMany({
|
|
|
6780
6802
|
providerOptions
|
|
6781
6803
|
});
|
|
6782
6804
|
const embeddings2 = modelResponse.embeddings;
|
|
6783
|
-
const usage = (
|
|
6805
|
+
const usage = (_a16 = modelResponse.usage) != null ? _a16 : { tokens: NaN };
|
|
6784
6806
|
doEmbedSpan.setAttributes(
|
|
6785
6807
|
selectTelemetryAttributes({
|
|
6786
6808
|
telemetry,
|
|
@@ -6817,7 +6839,7 @@ async function embedMany({
|
|
|
6817
6839
|
result.providerMetadata
|
|
6818
6840
|
)) {
|
|
6819
6841
|
providerMetadata[providerName] = {
|
|
6820
|
-
...
|
|
6842
|
+
...providerMetadata[providerName],
|
|
6821
6843
|
...metadata
|
|
6822
6844
|
};
|
|
6823
6845
|
}
|
|
@@ -10439,7 +10461,7 @@ async function safeValidateUIMessages({
|
|
|
10439
10461
|
}
|
|
10440
10462
|
if (metadataSchema) {
|
|
10441
10463
|
for (const message of validatedMessages) {
|
|
10442
|
-
await (0, import_provider_utils33.validateTypes)({
|
|
10464
|
+
message.metadata = await (0, import_provider_utils33.validateTypes)({
|
|
10443
10465
|
value: message.metadata,
|
|
10444
10466
|
schema: metadataSchema
|
|
10445
10467
|
});
|
|
@@ -10462,7 +10484,7 @@ async function safeValidateUIMessages({
|
|
|
10462
10484
|
})
|
|
10463
10485
|
};
|
|
10464
10486
|
}
|
|
10465
|
-
await (0, import_provider_utils33.validateTypes)({
|
|
10487
|
+
dataPart.data = await (0, import_provider_utils33.validateTypes)({
|
|
10466
10488
|
value: dataPart.data,
|
|
10467
10489
|
schema: dataSchema
|
|
10468
10490
|
});
|