ai 3.0.19 → 3.0.20
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/anthropic/dist/index.d.mts +44 -10
- package/anthropic/dist/index.d.ts +44 -10
- package/anthropic/dist/index.js +17 -31
- package/anthropic/dist/index.js.map +1 -1
- package/anthropic/dist/index.mjs +17 -31
- package/anthropic/dist/index.mjs.map +1 -1
- package/dist/index.d.mts +97 -24
- package/dist/index.d.ts +97 -24
- package/dist/index.js +55 -118
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +53 -117
- package/dist/index.mjs.map +1 -1
- package/google/dist/index.d.mts +44 -10
- package/google/dist/index.d.ts +44 -10
- package/google/dist/index.js +47 -43
- package/google/dist/index.js.map +1 -1
- package/google/dist/index.mjs +47 -43
- package/google/dist/index.mjs.map +1 -1
- package/mistral/dist/index.d.mts +44 -10
- package/mistral/dist/index.d.ts +44 -10
- package/mistral/dist/index.js +6 -21
- package/mistral/dist/index.js.map +1 -1
- package/mistral/dist/index.mjs +6 -21
- package/mistral/dist/index.mjs.map +1 -1
- package/openai/dist/index.d.mts +44 -10
- package/openai/dist/index.d.ts +44 -10
- package/openai/dist/index.js +9 -29
- package/openai/dist/index.js.map +1 -1
- package/openai/dist/index.mjs +9 -29
- package/openai/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/react/dist/index.d.mts +8 -4
- package/react/dist/index.d.ts +12 -6
- package/react/dist/index.js +23 -105
- package/react/dist/index.js.map +1 -1
- package/react/dist/index.mjs +22 -105
- package/react/dist/index.mjs.map +1 -1
- package/react/dist/index.server.d.mts +4 -2
- package/react/dist/index.server.d.ts +4 -2
- package/react/dist/index.server.js.map +1 -1
- package/react/dist/index.server.mjs.map +1 -1
- package/rsc/dist/rsc-server.mjs +6 -16
- package/rsc/dist/rsc-server.mjs.map +1 -1
- package/solid/dist/index.js +19 -104
- package/solid/dist/index.js.map +1 -1
- package/solid/dist/index.mjs +19 -104
- package/solid/dist/index.mjs.map +1 -1
- package/spec/dist/index.d.mts +48 -20
- package/spec/dist/index.d.ts +48 -20
- package/spec/dist/index.js +4 -14
- package/spec/dist/index.js.map +1 -1
- package/spec/dist/index.mjs +4 -14
- package/spec/dist/index.mjs.map +1 -1
- package/svelte/dist/index.js +19 -104
- package/svelte/dist/index.js.map +1 -1
- package/svelte/dist/index.mjs +19 -104
- package/svelte/dist/index.mjs.map +1 -1
- package/vue/dist/index.js +19 -104
- package/vue/dist/index.js.map +1 -1
- package/vue/dist/index.mjs +19 -104
- package/vue/dist/index.mjs.map +1 -1
package/openai/dist/index.d.mts
CHANGED
@@ -75,13 +75,13 @@ type LanguageModelV1CallSettings = {
|
|
75
75
|
};
|
76
76
|
|
77
77
|
/**
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
78
|
+
A prompt is a list of messages.
|
79
|
+
|
80
|
+
Note: Not all models and prompt formats support multi-modal inputs and
|
81
|
+
tool calls. The validation happens at runtime.
|
82
|
+
|
83
|
+
Note: This is not a user-facing prompt. The AI SDK methods will map the
|
84
|
+
user-facing prompt types such as chat or instruction prompts to this format.
|
85
85
|
*/
|
86
86
|
type LanguageModelV1Prompt = Array<LanguageModelV1Message>;
|
87
87
|
type LanguageModelV1Message = {
|
@@ -97,35 +97,69 @@ type LanguageModelV1Message = {
|
|
97
97
|
role: 'tool';
|
98
98
|
content: Array<LanguageModelV1ToolResultPart>;
|
99
99
|
};
|
100
|
+
/**
|
101
|
+
Text content part of a prompt. It contains a string of text.
|
102
|
+
*/
|
100
103
|
interface LanguageModelV1TextPart {
|
101
104
|
type: 'text';
|
102
105
|
/**
|
103
|
-
|
106
|
+
The text content.
|
104
107
|
*/
|
105
108
|
text: string;
|
106
109
|
}
|
110
|
+
/**
|
111
|
+
Image content part of a prompt. It contains an image.
|
112
|
+
*/
|
107
113
|
interface LanguageModelV1ImagePart {
|
108
114
|
type: 'image';
|
109
115
|
/**
|
110
|
-
|
116
|
+
Image data as a Uint8Array (e.g. from a Blob or Buffer) or a URL.
|
111
117
|
*/
|
112
118
|
image: Uint8Array | URL;
|
113
119
|
/**
|
114
|
-
|
120
|
+
Optional mime type of the image.
|
115
121
|
*/
|
116
122
|
mimeType?: string;
|
117
123
|
}
|
124
|
+
/**
|
125
|
+
Tool call content part of a prompt. It contains a tool call (usually generated by the AI model).
|
126
|
+
*/
|
118
127
|
interface LanguageModelV1ToolCallPart {
|
119
128
|
type: 'tool-call';
|
129
|
+
/**
|
130
|
+
ID of the tool call. This ID is used to match the tool call with the tool result.
|
131
|
+
*/
|
120
132
|
toolCallId: string;
|
133
|
+
/**
|
134
|
+
Name of the tool that is being called.
|
135
|
+
*/
|
121
136
|
toolName: string;
|
137
|
+
/**
|
138
|
+
Arguments of the tool call. This is a JSON-serializable object that matches the tool's input schema.
|
139
|
+
*/
|
122
140
|
args: unknown;
|
123
141
|
}
|
142
|
+
/**
|
143
|
+
Tool result content part of a prompt. It contains the result of the tool call with the matching ID.
|
144
|
+
*/
|
124
145
|
interface LanguageModelV1ToolResultPart {
|
125
146
|
type: 'tool-result';
|
147
|
+
/**
|
148
|
+
ID of the tool call that this result is associated with.
|
149
|
+
*/
|
126
150
|
toolCallId: string;
|
151
|
+
/**
|
152
|
+
Name of the tool that generated this result.
|
153
|
+
*/
|
127
154
|
toolName: string;
|
155
|
+
/**
|
156
|
+
Result of the tool call. This is a JSON-serializable object.
|
157
|
+
*/
|
128
158
|
result: unknown;
|
159
|
+
/**
|
160
|
+
Optional flag if the result is an error or an error message.
|
161
|
+
*/
|
162
|
+
isError?: boolean;
|
129
163
|
}
|
130
164
|
|
131
165
|
type LanguageModelV1CallOptions = LanguageModelV1CallSettings & {
|
package/openai/dist/index.d.ts
CHANGED
@@ -75,13 +75,13 @@ type LanguageModelV1CallSettings = {
|
|
75
75
|
};
|
76
76
|
|
77
77
|
/**
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
78
|
+
A prompt is a list of messages.
|
79
|
+
|
80
|
+
Note: Not all models and prompt formats support multi-modal inputs and
|
81
|
+
tool calls. The validation happens at runtime.
|
82
|
+
|
83
|
+
Note: This is not a user-facing prompt. The AI SDK methods will map the
|
84
|
+
user-facing prompt types such as chat or instruction prompts to this format.
|
85
85
|
*/
|
86
86
|
type LanguageModelV1Prompt = Array<LanguageModelV1Message>;
|
87
87
|
type LanguageModelV1Message = {
|
@@ -97,35 +97,69 @@ type LanguageModelV1Message = {
|
|
97
97
|
role: 'tool';
|
98
98
|
content: Array<LanguageModelV1ToolResultPart>;
|
99
99
|
};
|
100
|
+
/**
|
101
|
+
Text content part of a prompt. It contains a string of text.
|
102
|
+
*/
|
100
103
|
interface LanguageModelV1TextPart {
|
101
104
|
type: 'text';
|
102
105
|
/**
|
103
|
-
|
106
|
+
The text content.
|
104
107
|
*/
|
105
108
|
text: string;
|
106
109
|
}
|
110
|
+
/**
|
111
|
+
Image content part of a prompt. It contains an image.
|
112
|
+
*/
|
107
113
|
interface LanguageModelV1ImagePart {
|
108
114
|
type: 'image';
|
109
115
|
/**
|
110
|
-
|
116
|
+
Image data as a Uint8Array (e.g. from a Blob or Buffer) or a URL.
|
111
117
|
*/
|
112
118
|
image: Uint8Array | URL;
|
113
119
|
/**
|
114
|
-
|
120
|
+
Optional mime type of the image.
|
115
121
|
*/
|
116
122
|
mimeType?: string;
|
117
123
|
}
|
124
|
+
/**
|
125
|
+
Tool call content part of a prompt. It contains a tool call (usually generated by the AI model).
|
126
|
+
*/
|
118
127
|
interface LanguageModelV1ToolCallPart {
|
119
128
|
type: 'tool-call';
|
129
|
+
/**
|
130
|
+
ID of the tool call. This ID is used to match the tool call with the tool result.
|
131
|
+
*/
|
120
132
|
toolCallId: string;
|
133
|
+
/**
|
134
|
+
Name of the tool that is being called.
|
135
|
+
*/
|
121
136
|
toolName: string;
|
137
|
+
/**
|
138
|
+
Arguments of the tool call. This is a JSON-serializable object that matches the tool's input schema.
|
139
|
+
*/
|
122
140
|
args: unknown;
|
123
141
|
}
|
142
|
+
/**
|
143
|
+
Tool result content part of a prompt. It contains the result of the tool call with the matching ID.
|
144
|
+
*/
|
124
145
|
interface LanguageModelV1ToolResultPart {
|
125
146
|
type: 'tool-result';
|
147
|
+
/**
|
148
|
+
ID of the tool call that this result is associated with.
|
149
|
+
*/
|
126
150
|
toolCallId: string;
|
151
|
+
/**
|
152
|
+
Name of the tool that generated this result.
|
153
|
+
*/
|
127
154
|
toolName: string;
|
155
|
+
/**
|
156
|
+
Result of the tool call. This is a JSON-serializable object.
|
157
|
+
*/
|
128
158
|
result: unknown;
|
159
|
+
/**
|
160
|
+
Optional flag if the result is an error or an error message.
|
161
|
+
*/
|
162
|
+
isError?: boolean;
|
129
163
|
}
|
130
164
|
|
131
165
|
type LanguageModelV1CallOptions = LanguageModelV1CallSettings & {
|
package/openai/dist/index.js
CHANGED
@@ -566,26 +566,19 @@ function convertUint8ArrayToBase64(array) {
|
|
566
566
|
|
567
567
|
// spec/errors/unsupported-functionality-error.ts
|
568
568
|
var UnsupportedFunctionalityError = class extends Error {
|
569
|
-
constructor({
|
570
|
-
|
571
|
-
functionality
|
572
|
-
}) {
|
573
|
-
super(
|
574
|
-
`'${functionality}' functionality not supported by the '${provider}' provider.`
|
575
|
-
);
|
569
|
+
constructor({ functionality }) {
|
570
|
+
super(`'${functionality}' functionality not supported.`);
|
576
571
|
this.name = "AI_UnsupportedFunctionalityError";
|
577
|
-
this.provider = provider;
|
578
572
|
this.functionality = functionality;
|
579
573
|
}
|
580
574
|
static isUnsupportedFunctionalityError(error) {
|
581
|
-
return error instanceof Error && error.name === "AI_UnsupportedFunctionalityError" && typeof error.
|
575
|
+
return error instanceof Error && error.name === "AI_UnsupportedFunctionalityError" && typeof error.functionality === "string";
|
582
576
|
}
|
583
577
|
toJSON() {
|
584
578
|
return {
|
585
579
|
name: this.name,
|
586
580
|
message: this.message,
|
587
581
|
stack: this.stack,
|
588
|
-
provider: this.provider,
|
589
582
|
functionality: this.functionality
|
590
583
|
};
|
591
584
|
}
|
@@ -795,8 +788,7 @@ var OpenAIChatLanguageModel = class {
|
|
795
788
|
}
|
796
789
|
case "object-grammar": {
|
797
790
|
throw new UnsupportedFunctionalityError({
|
798
|
-
functionality: "object-grammar mode"
|
799
|
-
provider: this.provider
|
791
|
+
functionality: "object-grammar mode"
|
800
792
|
});
|
801
793
|
}
|
802
794
|
default: {
|
@@ -1018,7 +1010,6 @@ var import_zod3 = require("zod");
|
|
1018
1010
|
function convertToOpenAICompletionPrompt({
|
1019
1011
|
prompt: prompt2,
|
1020
1012
|
inputFormat,
|
1021
|
-
provider,
|
1022
1013
|
user = "user",
|
1023
1014
|
assistant = "assistant"
|
1024
1015
|
}) {
|
@@ -1048,7 +1039,6 @@ function convertToOpenAICompletionPrompt({
|
|
1048
1039
|
}
|
1049
1040
|
case "image": {
|
1050
1041
|
throw new UnsupportedFunctionalityError({
|
1051
|
-
provider,
|
1052
1042
|
functionality: "images"
|
1053
1043
|
});
|
1054
1044
|
}
|
@@ -1068,7 +1058,6 @@ ${userMessage}
|
|
1068
1058
|
}
|
1069
1059
|
case "tool-call": {
|
1070
1060
|
throw new UnsupportedFunctionalityError({
|
1071
|
-
provider,
|
1072
1061
|
functionality: "tool-call messages"
|
1073
1062
|
});
|
1074
1063
|
}
|
@@ -1082,7 +1071,6 @@ ${assistantMessage}
|
|
1082
1071
|
}
|
1083
1072
|
case "tool": {
|
1084
1073
|
throw new UnsupportedFunctionalityError({
|
1085
|
-
provider,
|
1086
1074
|
functionality: "tool messages"
|
1087
1075
|
});
|
1088
1076
|
}
|
@@ -1126,11 +1114,7 @@ var OpenAICompletionLanguageModel = class {
|
|
1126
1114
|
}) {
|
1127
1115
|
var _a;
|
1128
1116
|
const type = mode.type;
|
1129
|
-
const { prompt: completionPrompt, stopSequences } = convertToOpenAICompletionPrompt({
|
1130
|
-
prompt: prompt2,
|
1131
|
-
inputFormat,
|
1132
|
-
provider: this.provider
|
1133
|
-
});
|
1117
|
+
const { prompt: completionPrompt, stopSequences } = convertToOpenAICompletionPrompt({ prompt: prompt2, inputFormat });
|
1134
1118
|
const baseArgs = {
|
1135
1119
|
// model id:
|
1136
1120
|
model: this.modelId,
|
@@ -1171,28 +1155,24 @@ var OpenAICompletionLanguageModel = class {
|
|
1171
1155
|
case "regular": {
|
1172
1156
|
if ((_a = mode.tools) == null ? void 0 : _a.length) {
|
1173
1157
|
throw new UnsupportedFunctionalityError({
|
1174
|
-
functionality: "tools"
|
1175
|
-
provider: this.provider
|
1158
|
+
functionality: "tools"
|
1176
1159
|
});
|
1177
1160
|
}
|
1178
1161
|
return baseArgs;
|
1179
1162
|
}
|
1180
1163
|
case "object-json": {
|
1181
1164
|
throw new UnsupportedFunctionalityError({
|
1182
|
-
functionality: "object-json mode"
|
1183
|
-
provider: this.provider
|
1165
|
+
functionality: "object-json mode"
|
1184
1166
|
});
|
1185
1167
|
}
|
1186
1168
|
case "object-tool": {
|
1187
1169
|
throw new UnsupportedFunctionalityError({
|
1188
|
-
functionality: "object-tool mode"
|
1189
|
-
provider: this.provider
|
1170
|
+
functionality: "object-tool mode"
|
1190
1171
|
});
|
1191
1172
|
}
|
1192
1173
|
case "object-grammar": {
|
1193
1174
|
throw new UnsupportedFunctionalityError({
|
1194
|
-
functionality: "object-grammar mode"
|
1195
|
-
provider: this.provider
|
1175
|
+
functionality: "object-grammar mode"
|
1196
1176
|
});
|
1197
1177
|
}
|
1198
1178
|
default: {
|