ai 5.1.0-beta.13 → 5.1.0-beta.2
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 +0 -89
- package/dist/index.d.mts +59 -159
- package/dist/index.d.ts +59 -159
- package/dist/index.js +23 -26
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +23 -25
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +7 -7
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +7 -7
- package/dist/internal/index.mjs.map +1 -1
- package/dist/test/index.d.mts +32 -32
- package/dist/test/index.d.ts +32 -32
- package/dist/test/index.js +14 -14
- package/dist/test/index.js.map +1 -1
- package/dist/test/index.mjs +11 -11
- package/dist/test/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -12,7 +12,6 @@ import {
|
|
|
12
12
|
dynamicTool as dynamicTool2,
|
|
13
13
|
generateId as generateId2,
|
|
14
14
|
jsonSchema as jsonSchema2,
|
|
15
|
-
parseJsonEventStream as parseJsonEventStream3,
|
|
16
15
|
tool as tool2,
|
|
17
16
|
zodSchema
|
|
18
17
|
} from "@ai-sdk/provider-utils";
|
|
@@ -464,7 +463,7 @@ function resolveLanguageModel(model) {
|
|
|
464
463
|
}
|
|
465
464
|
function resolveEmbeddingModel(model) {
|
|
466
465
|
if (typeof model !== "string") {
|
|
467
|
-
if (model.specificationVersion !== "
|
|
466
|
+
if (model.specificationVersion !== "v2") {
|
|
468
467
|
throw new UnsupportedModelVersionError({
|
|
469
468
|
version: model.specificationVersion,
|
|
470
469
|
provider: model.provider,
|
|
@@ -679,7 +678,7 @@ import {
|
|
|
679
678
|
} from "@ai-sdk/provider-utils";
|
|
680
679
|
|
|
681
680
|
// src/version.ts
|
|
682
|
-
var VERSION = true ? "5.1.0-beta.
|
|
681
|
+
var VERSION = true ? "5.1.0-beta.2" : "0.0.0-test";
|
|
683
682
|
|
|
684
683
|
// src/util/download/download.ts
|
|
685
684
|
var download = async ({ url }) => {
|
|
@@ -972,12 +971,12 @@ async function downloadAssets(messages, download2, supportedUrls) {
|
|
|
972
971
|
}));
|
|
973
972
|
const downloadedFiles = await download2(plannedDownloads);
|
|
974
973
|
return Object.fromEntries(
|
|
975
|
-
downloadedFiles.
|
|
976
|
-
(
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
)
|
|
974
|
+
downloadedFiles.filter(
|
|
975
|
+
(downloadedFile) => (downloadedFile == null ? void 0 : downloadedFile.data) != null
|
|
976
|
+
).map(({ data, mediaType }, index) => [
|
|
977
|
+
plannedDownloads[index].url.toString(),
|
|
978
|
+
{ data, mediaType }
|
|
979
|
+
])
|
|
981
980
|
);
|
|
982
981
|
}
|
|
983
982
|
function convertPartToLanguageModelPart(part, downloadedAssets) {
|
|
@@ -2923,6 +2922,11 @@ var uiMessageChunkSchema = z7.union([
|
|
|
2923
2922
|
providerExecuted: z7.boolean().optional(),
|
|
2924
2923
|
dynamic: z7.boolean().optional()
|
|
2925
2924
|
}),
|
|
2925
|
+
z7.strictObject({
|
|
2926
|
+
type: z7.literal("reasoning"),
|
|
2927
|
+
text: z7.string(),
|
|
2928
|
+
providerMetadata: providerMetadataSchema.optional()
|
|
2929
|
+
}),
|
|
2926
2930
|
z7.strictObject({
|
|
2927
2931
|
type: z7.literal("reasoning-start"),
|
|
2928
2932
|
id: z7.string(),
|
|
@@ -2939,6 +2943,9 @@ var uiMessageChunkSchema = z7.union([
|
|
|
2939
2943
|
id: z7.string(),
|
|
2940
2944
|
providerMetadata: providerMetadataSchema.optional()
|
|
2941
2945
|
}),
|
|
2946
|
+
z7.strictObject({
|
|
2947
|
+
type: z7.literal("reasoning-part-finish")
|
|
2948
|
+
}),
|
|
2942
2949
|
z7.strictObject({
|
|
2943
2950
|
type: z7.literal("source-url"),
|
|
2944
2951
|
sourceId: z7.string(),
|
|
@@ -2961,10 +2968,7 @@ var uiMessageChunkSchema = z7.union([
|
|
|
2961
2968
|
providerMetadata: providerMetadataSchema.optional()
|
|
2962
2969
|
}),
|
|
2963
2970
|
z7.strictObject({
|
|
2964
|
-
type: z7.
|
|
2965
|
-
(value) => typeof value === "string" && value.startsWith("data-"),
|
|
2966
|
-
{ message: 'Type must start with "data-"' }
|
|
2967
|
-
),
|
|
2971
|
+
type: z7.string().startsWith("data-"),
|
|
2968
2972
|
id: z7.string().optional(),
|
|
2969
2973
|
data: z7.unknown(),
|
|
2970
2974
|
transient: z7.boolean().optional()
|
|
@@ -6318,7 +6322,7 @@ async function generateImage({
|
|
|
6318
6322
|
headers
|
|
6319
6323
|
}) {
|
|
6320
6324
|
var _a17, _b;
|
|
6321
|
-
if (model.specificationVersion !== "
|
|
6325
|
+
if (model.specificationVersion !== "v2") {
|
|
6322
6326
|
throw new UnsupportedModelVersionError({
|
|
6323
6327
|
version: model.specificationVersion,
|
|
6324
6328
|
provider: model.provider,
|
|
@@ -9697,11 +9701,9 @@ var AbstractChat = class {
|
|
|
9697
9701
|
}
|
|
9698
9702
|
};
|
|
9699
9703
|
this.addToolResult = async ({
|
|
9700
|
-
state = "output-available",
|
|
9701
9704
|
tool: tool3,
|
|
9702
9705
|
toolCallId,
|
|
9703
|
-
output
|
|
9704
|
-
errorText
|
|
9706
|
+
output
|
|
9705
9707
|
}) => this.jobExecutor.run(async () => {
|
|
9706
9708
|
var _a17, _b;
|
|
9707
9709
|
const messages = this.state.messages;
|
|
@@ -9709,16 +9711,16 @@ var AbstractChat = class {
|
|
|
9709
9711
|
this.state.replaceMessage(messages.length - 1, {
|
|
9710
9712
|
...lastMessage,
|
|
9711
9713
|
parts: lastMessage.parts.map(
|
|
9712
|
-
(part) => isToolOrDynamicToolUIPart(part) && part.toolCallId === toolCallId ? { ...part, state
|
|
9714
|
+
(part) => isToolOrDynamicToolUIPart(part) && part.toolCallId === toolCallId ? { ...part, state: "output-available", output } : part
|
|
9713
9715
|
)
|
|
9714
9716
|
});
|
|
9715
9717
|
if (this.activeResponse) {
|
|
9716
9718
|
this.activeResponse.state.message.parts = this.activeResponse.state.message.parts.map(
|
|
9717
9719
|
(part) => isToolOrDynamicToolUIPart(part) && part.toolCallId === toolCallId ? {
|
|
9718
9720
|
...part,
|
|
9719
|
-
state,
|
|
9721
|
+
state: "output-available",
|
|
9720
9722
|
output,
|
|
9721
|
-
errorText
|
|
9723
|
+
errorText: void 0
|
|
9722
9724
|
} : part
|
|
9723
9725
|
);
|
|
9724
9726
|
}
|
|
@@ -9927,9 +9929,7 @@ function lastAssistantMessageIsCompleteWithToolCalls({
|
|
|
9927
9929
|
return part.type === "step-start" ? index : lastIndex;
|
|
9928
9930
|
}, -1);
|
|
9929
9931
|
const lastStepToolInvocations = message.parts.slice(lastStepStartIndex + 1).filter(isToolOrDynamicToolUIPart);
|
|
9930
|
-
return lastStepToolInvocations.length > 0 && lastStepToolInvocations.every(
|
|
9931
|
-
(part) => part.state === "output-available" || part.state === "output-error"
|
|
9932
|
-
);
|
|
9932
|
+
return lastStepToolInvocations.length > 0 && lastStepToolInvocations.every((part) => part.state === "output-available");
|
|
9933
9933
|
}
|
|
9934
9934
|
|
|
9935
9935
|
// src/ui/transform-text-to-ui-message-stream.ts
|
|
@@ -10451,7 +10451,6 @@ export {
|
|
|
10451
10451
|
jsonSchema2 as jsonSchema,
|
|
10452
10452
|
lastAssistantMessageIsCompleteWithToolCalls,
|
|
10453
10453
|
modelMessageSchema,
|
|
10454
|
-
parseJsonEventStream3 as parseJsonEventStream,
|
|
10455
10454
|
parsePartialJson,
|
|
10456
10455
|
pipeTextStreamToResponse,
|
|
10457
10456
|
pipeUIMessageStreamToResponse,
|
|
@@ -10466,7 +10465,6 @@ export {
|
|
|
10466
10465
|
systemModelMessageSchema,
|
|
10467
10466
|
tool2 as tool,
|
|
10468
10467
|
toolModelMessageSchema,
|
|
10469
|
-
uiMessageChunkSchema,
|
|
10470
10468
|
userModelMessageSchema,
|
|
10471
10469
|
validateUIMessages,
|
|
10472
10470
|
wrapLanguageModel,
|