ai 4.1.45 → 4.1.47
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 +18 -0
- package/README.md +2 -2
- package/dist/index.d.mts +135 -10
- package/dist/index.d.ts +135 -10
- package/dist/index.js +341 -162
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +319 -141
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
- package/rsc/dist/index.d.ts +45 -1
- package/rsc/dist/rsc-server.d.mts +45 -1
- package/rsc/dist/rsc-server.mjs +65 -17
- package/rsc/dist/rsc-server.mjs.map +1 -1
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "ai",
|
3
|
-
"version": "4.1.
|
3
|
+
"version": "4.1.47",
|
4
4
|
"description": "AI SDK by Vercel - The AI Toolkit for TypeScript and JavaScript",
|
5
5
|
"license": "Apache-2.0",
|
6
6
|
"sideEffects": false,
|
@@ -40,10 +40,10 @@
|
|
40
40
|
}
|
41
41
|
},
|
42
42
|
"dependencies": {
|
43
|
-
"@ai-sdk/provider": "1.0.
|
44
|
-
"@ai-sdk/provider-utils": "2.1.
|
45
|
-
"@ai-sdk/react": "1.1.
|
46
|
-
"@ai-sdk/ui-utils": "1.1.
|
43
|
+
"@ai-sdk/provider": "1.0.9",
|
44
|
+
"@ai-sdk/provider-utils": "2.1.10",
|
45
|
+
"@ai-sdk/react": "1.1.19",
|
46
|
+
"@ai-sdk/ui-utils": "1.1.16",
|
47
47
|
"@opentelemetry/api": "1.9.0",
|
48
48
|
"jsondiffpatch": "0.6.0"
|
49
49
|
},
|
package/rsc/dist/index.d.ts
CHANGED
@@ -325,6 +325,50 @@ interface FilePart {
|
|
325
325
|
*/
|
326
326
|
experimental_providerMetadata?: ProviderMetadata;
|
327
327
|
}
|
328
|
+
/**
|
329
|
+
* Reasoning content part of a prompt. It contains a reasoning.
|
330
|
+
*/
|
331
|
+
interface ReasoningPart {
|
332
|
+
type: 'reasoning';
|
333
|
+
/**
|
334
|
+
The reasoning text.
|
335
|
+
*/
|
336
|
+
text: string;
|
337
|
+
/**
|
338
|
+
An optional signature for verifying that the reasoning originated from the model.
|
339
|
+
*/
|
340
|
+
signature?: string;
|
341
|
+
/**
|
342
|
+
Additional provider-specific metadata. They are passed through
|
343
|
+
to the provider from the AI SDK and enable provider-specific
|
344
|
+
functionality that can be fully encapsulated in the provider.
|
345
|
+
*/
|
346
|
+
providerOptions?: ProviderOptions;
|
347
|
+
/**
|
348
|
+
@deprecated Use `providerOptions` instead.
|
349
|
+
*/
|
350
|
+
experimental_providerMetadata?: ProviderMetadata;
|
351
|
+
}
|
352
|
+
/**
|
353
|
+
Redacted reasoning content part of a prompt.
|
354
|
+
*/
|
355
|
+
interface RedactedReasoningPart {
|
356
|
+
type: 'redacted-reasoning';
|
357
|
+
/**
|
358
|
+
Redacted reasoning data.
|
359
|
+
*/
|
360
|
+
data: string;
|
361
|
+
/**
|
362
|
+
Additional provider-specific metadata. They are passed through
|
363
|
+
to the provider from the AI SDK and enable provider-specific
|
364
|
+
functionality that can be fully encapsulated in the provider.
|
365
|
+
*/
|
366
|
+
providerOptions?: ProviderOptions;
|
367
|
+
/**
|
368
|
+
@deprecated Use `providerOptions` instead.
|
369
|
+
*/
|
370
|
+
experimental_providerMetadata?: ProviderMetadata;
|
371
|
+
}
|
328
372
|
/**
|
329
373
|
Tool call content part of a prompt. It contains a tool call (usually generated by the AI model).
|
330
374
|
*/
|
@@ -452,7 +496,7 @@ type CoreAssistantMessage = {
|
|
452
496
|
/**
|
453
497
|
Content of an assistant message. It can be a string or an array of text and tool call parts.
|
454
498
|
*/
|
455
|
-
type AssistantContent = string | Array<TextPart | ToolCallPart>;
|
499
|
+
type AssistantContent = string | Array<TextPart | ReasoningPart | RedactedReasoningPart | ToolCallPart>;
|
456
500
|
/**
|
457
501
|
A tool message. It contains the result of one or more tool calls.
|
458
502
|
*/
|
@@ -323,6 +323,50 @@ interface FilePart {
|
|
323
323
|
*/
|
324
324
|
experimental_providerMetadata?: ProviderMetadata;
|
325
325
|
}
|
326
|
+
/**
|
327
|
+
* Reasoning content part of a prompt. It contains a reasoning.
|
328
|
+
*/
|
329
|
+
interface ReasoningPart {
|
330
|
+
type: 'reasoning';
|
331
|
+
/**
|
332
|
+
The reasoning text.
|
333
|
+
*/
|
334
|
+
text: string;
|
335
|
+
/**
|
336
|
+
An optional signature for verifying that the reasoning originated from the model.
|
337
|
+
*/
|
338
|
+
signature?: string;
|
339
|
+
/**
|
340
|
+
Additional provider-specific metadata. They are passed through
|
341
|
+
to the provider from the AI SDK and enable provider-specific
|
342
|
+
functionality that can be fully encapsulated in the provider.
|
343
|
+
*/
|
344
|
+
providerOptions?: ProviderOptions;
|
345
|
+
/**
|
346
|
+
@deprecated Use `providerOptions` instead.
|
347
|
+
*/
|
348
|
+
experimental_providerMetadata?: ProviderMetadata;
|
349
|
+
}
|
350
|
+
/**
|
351
|
+
Redacted reasoning content part of a prompt.
|
352
|
+
*/
|
353
|
+
interface RedactedReasoningPart {
|
354
|
+
type: 'redacted-reasoning';
|
355
|
+
/**
|
356
|
+
Redacted reasoning data.
|
357
|
+
*/
|
358
|
+
data: string;
|
359
|
+
/**
|
360
|
+
Additional provider-specific metadata. They are passed through
|
361
|
+
to the provider from the AI SDK and enable provider-specific
|
362
|
+
functionality that can be fully encapsulated in the provider.
|
363
|
+
*/
|
364
|
+
providerOptions?: ProviderOptions;
|
365
|
+
/**
|
366
|
+
@deprecated Use `providerOptions` instead.
|
367
|
+
*/
|
368
|
+
experimental_providerMetadata?: ProviderMetadata;
|
369
|
+
}
|
326
370
|
/**
|
327
371
|
Tool call content part of a prompt. It contains a tool call (usually generated by the AI model).
|
328
372
|
*/
|
@@ -450,7 +494,7 @@ type CoreAssistantMessage = {
|
|
450
494
|
/**
|
451
495
|
Content of an assistant message. It can be a string or an array of text and tool call parts.
|
452
496
|
*/
|
453
|
-
type AssistantContent = string | Array<TextPart | ToolCallPart>;
|
497
|
+
type AssistantContent = string | Array<TextPart | ReasoningPart | RedactedReasoningPart | ToolCallPart>;
|
454
498
|
/**
|
455
499
|
A tool message. It contains the result of one or more tool calls.
|
456
500
|
*/
|
package/rsc/dist/rsc-server.mjs
CHANGED
@@ -1004,24 +1004,52 @@ function convertToCoreMessages(messages, options) {
|
|
1004
1004
|
case "assistant": {
|
1005
1005
|
if (message.parts != null) {
|
1006
1006
|
let processBlock2 = function() {
|
1007
|
+
const content2 = [];
|
1008
|
+
for (const part of block) {
|
1009
|
+
switch (part.type) {
|
1010
|
+
case "text":
|
1011
|
+
content2.push({
|
1012
|
+
type: "text",
|
1013
|
+
text: part.text
|
1014
|
+
});
|
1015
|
+
break;
|
1016
|
+
case "reasoning": {
|
1017
|
+
for (const detail of part.details) {
|
1018
|
+
switch (detail.type) {
|
1019
|
+
case "text":
|
1020
|
+
content2.push({
|
1021
|
+
type: "reasoning",
|
1022
|
+
text: detail.text,
|
1023
|
+
signature: detail.signature
|
1024
|
+
});
|
1025
|
+
break;
|
1026
|
+
case "redacted":
|
1027
|
+
content2.push({
|
1028
|
+
type: "redacted-reasoning",
|
1029
|
+
data: detail.data
|
1030
|
+
});
|
1031
|
+
break;
|
1032
|
+
}
|
1033
|
+
}
|
1034
|
+
break;
|
1035
|
+
}
|
1036
|
+
case "tool-invocation":
|
1037
|
+
content2.push({
|
1038
|
+
type: "tool-call",
|
1039
|
+
toolCallId: part.toolInvocation.toolCallId,
|
1040
|
+
toolName: part.toolInvocation.toolName,
|
1041
|
+
args: part.toolInvocation.args
|
1042
|
+
});
|
1043
|
+
break;
|
1044
|
+
default: {
|
1045
|
+
const _exhaustiveCheck = part;
|
1046
|
+
throw new Error(`Unsupported part: ${_exhaustiveCheck}`);
|
1047
|
+
}
|
1048
|
+
}
|
1049
|
+
}
|
1007
1050
|
coreMessages.push({
|
1008
1051
|
role: "assistant",
|
1009
|
-
content:
|
1010
|
-
switch (part.type) {
|
1011
|
-
case "text":
|
1012
|
-
return {
|
1013
|
-
type: "text",
|
1014
|
-
text: part.text
|
1015
|
-
};
|
1016
|
-
default:
|
1017
|
-
return {
|
1018
|
-
type: "tool-call",
|
1019
|
-
toolCallId: part.toolInvocation.toolCallId,
|
1020
|
-
toolName: part.toolInvocation.toolName,
|
1021
|
-
args: part.toolInvocation.args
|
1022
|
-
};
|
1023
|
-
}
|
1024
|
-
})
|
1052
|
+
content: content2
|
1025
1053
|
});
|
1026
1054
|
const stepInvocations = block.filter(
|
1027
1055
|
(part) => part.type === "tool-invocation"
|
@@ -1066,6 +1094,7 @@ function convertToCoreMessages(messages, options) {
|
|
1066
1094
|
for (const part of message.parts) {
|
1067
1095
|
switch (part.type) {
|
1068
1096
|
case "reasoning":
|
1097
|
+
block.push(part);
|
1069
1098
|
break;
|
1070
1099
|
case "text": {
|
1071
1100
|
if (blockHasToolInvocations) {
|
@@ -1263,6 +1292,18 @@ var filePartSchema = z5.object({
|
|
1263
1292
|
providerOptions: providerMetadataSchema.optional(),
|
1264
1293
|
experimental_providerMetadata: providerMetadataSchema.optional()
|
1265
1294
|
});
|
1295
|
+
var reasoningPartSchema = z5.object({
|
1296
|
+
type: z5.literal("reasoning"),
|
1297
|
+
text: z5.string(),
|
1298
|
+
providerOptions: providerMetadataSchema.optional(),
|
1299
|
+
experimental_providerMetadata: providerMetadataSchema.optional()
|
1300
|
+
});
|
1301
|
+
var redactedReasoningPartSchema = z5.object({
|
1302
|
+
type: z5.literal("redacted-reasoning"),
|
1303
|
+
data: z5.string(),
|
1304
|
+
providerOptions: providerMetadataSchema.optional(),
|
1305
|
+
experimental_providerMetadata: providerMetadataSchema.optional()
|
1306
|
+
});
|
1266
1307
|
var toolCallPartSchema = z5.object({
|
1267
1308
|
type: z5.literal("tool-call"),
|
1268
1309
|
toolCallId: z5.string(),
|
@@ -1302,7 +1343,14 @@ var coreAssistantMessageSchema = z6.object({
|
|
1302
1343
|
role: z6.literal("assistant"),
|
1303
1344
|
content: z6.union([
|
1304
1345
|
z6.string(),
|
1305
|
-
z6.array(
|
1346
|
+
z6.array(
|
1347
|
+
z6.union([
|
1348
|
+
textPartSchema,
|
1349
|
+
reasoningPartSchema,
|
1350
|
+
redactedReasoningPartSchema,
|
1351
|
+
toolCallPartSchema
|
1352
|
+
])
|
1353
|
+
)
|
1306
1354
|
]),
|
1307
1355
|
providerOptions: providerMetadataSchema.optional(),
|
1308
1356
|
experimental_providerMetadata: providerMetadataSchema.optional()
|