@ai-sdk/openai 3.0.0-beta.59 → 3.0.0-beta.61
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 +12 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +32 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -17
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +31 -16
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +31 -16
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/internal/index.js
CHANGED
|
@@ -2805,10 +2805,13 @@ var openaiResponsesChunkSchema = (0, import_provider_utils21.lazySchema)(
|
|
|
2805
2805
|
}),
|
|
2806
2806
|
import_v414.z.object({
|
|
2807
2807
|
type: import_v414.z.literal("error"),
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2808
|
+
sequence_number: import_v414.z.number(),
|
|
2809
|
+
error: import_v414.z.object({
|
|
2810
|
+
type: import_v414.z.string(),
|
|
2811
|
+
code: import_v414.z.string(),
|
|
2812
|
+
message: import_v414.z.string(),
|
|
2813
|
+
param: import_v414.z.string().nullish()
|
|
2814
|
+
})
|
|
2812
2815
|
}),
|
|
2813
2816
|
import_v414.z.object({ type: import_v414.z.string() }).loose().transform((value) => ({
|
|
2814
2817
|
type: "unknown_chunk",
|
|
@@ -2821,13 +2824,15 @@ var openaiResponsesChunkSchema = (0, import_provider_utils21.lazySchema)(
|
|
|
2821
2824
|
var openaiResponsesResponseSchema = (0, import_provider_utils21.lazySchema)(
|
|
2822
2825
|
() => (0, import_provider_utils21.zodSchema)(
|
|
2823
2826
|
import_v414.z.object({
|
|
2824
|
-
id: import_v414.z.string(),
|
|
2825
|
-
created_at: import_v414.z.number(),
|
|
2827
|
+
id: import_v414.z.string().optional(),
|
|
2828
|
+
created_at: import_v414.z.number().optional(),
|
|
2826
2829
|
error: import_v414.z.object({
|
|
2827
|
-
|
|
2828
|
-
|
|
2830
|
+
message: import_v414.z.string(),
|
|
2831
|
+
type: import_v414.z.string(),
|
|
2832
|
+
param: import_v414.z.string().nullish(),
|
|
2833
|
+
code: import_v414.z.string()
|
|
2829
2834
|
}).nullish(),
|
|
2830
|
-
model: import_v414.z.string(),
|
|
2835
|
+
model: import_v414.z.string().optional(),
|
|
2831
2836
|
output: import_v414.z.array(
|
|
2832
2837
|
import_v414.z.discriminatedUnion("type", [
|
|
2833
2838
|
import_v414.z.object({
|
|
@@ -3030,7 +3035,7 @@ var openaiResponsesResponseSchema = (0, import_provider_utils21.lazySchema)(
|
|
|
3030
3035
|
approval_request_id: import_v414.z.string()
|
|
3031
3036
|
})
|
|
3032
3037
|
])
|
|
3033
|
-
),
|
|
3038
|
+
).optional(),
|
|
3034
3039
|
service_tier: import_v414.z.string().nullish(),
|
|
3035
3040
|
incomplete_details: import_v414.z.object({ reason: import_v414.z.string() }).nullish(),
|
|
3036
3041
|
usage: import_v414.z.object({
|
|
@@ -3038,7 +3043,7 @@ var openaiResponsesResponseSchema = (0, import_provider_utils21.lazySchema)(
|
|
|
3038
3043
|
input_tokens_details: import_v414.z.object({ cached_tokens: import_v414.z.number().nullish() }).nullish(),
|
|
3039
3044
|
output_tokens: import_v414.z.number(),
|
|
3040
3045
|
output_tokens_details: import_v414.z.object({ reasoning_tokens: import_v414.z.number().nullish() }).nullish()
|
|
3041
|
-
})
|
|
3046
|
+
}).optional()
|
|
3042
3047
|
})
|
|
3043
3048
|
)
|
|
3044
3049
|
);
|
|
@@ -3115,6 +3120,7 @@ var openaiResponsesModelIds = [
|
|
|
3115
3120
|
var openaiResponsesProviderOptionsSchema = (0, import_provider_utils22.lazySchema)(
|
|
3116
3121
|
() => (0, import_provider_utils22.zodSchema)(
|
|
3117
3122
|
import_v415.z.object({
|
|
3123
|
+
conversation: import_v415.z.string().nullish(),
|
|
3118
3124
|
include: import_v415.z.array(
|
|
3119
3125
|
import_v415.z.enum([
|
|
3120
3126
|
"reasoning.encrypted_content",
|
|
@@ -3719,6 +3725,13 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3719
3725
|
providerOptions,
|
|
3720
3726
|
schema: openaiResponsesProviderOptionsSchema
|
|
3721
3727
|
});
|
|
3728
|
+
if ((openaiOptions == null ? void 0 : openaiOptions.conversation) && (openaiOptions == null ? void 0 : openaiOptions.previousResponseId)) {
|
|
3729
|
+
warnings.push({
|
|
3730
|
+
type: "unsupported-setting",
|
|
3731
|
+
setting: "conversation",
|
|
3732
|
+
details: "conversation and previousResponseId cannot be used together"
|
|
3733
|
+
});
|
|
3734
|
+
}
|
|
3722
3735
|
const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
|
|
3723
3736
|
prompt,
|
|
3724
3737
|
systemMessageMode: modelConfig.systemMessageMode,
|
|
@@ -3781,6 +3794,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3781
3794
|
}
|
|
3782
3795
|
},
|
|
3783
3796
|
// provider options:
|
|
3797
|
+
conversation: openaiOptions == null ? void 0 : openaiOptions.conversation,
|
|
3784
3798
|
max_tool_calls: openaiOptions == null ? void 0 : openaiOptions.maxToolCalls,
|
|
3785
3799
|
metadata: openaiOptions == null ? void 0 : openaiOptions.metadata,
|
|
3786
3800
|
parallel_tool_calls: openaiOptions == null ? void 0 : openaiOptions.parallelToolCalls,
|
|
@@ -4230,6 +4244,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4230
4244
|
if (typeof response.service_tier === "string") {
|
|
4231
4245
|
providerMetadata.openai.serviceTier = response.service_tier;
|
|
4232
4246
|
}
|
|
4247
|
+
const usage = response.usage;
|
|
4233
4248
|
return {
|
|
4234
4249
|
content,
|
|
4235
4250
|
finishReason: mapOpenAIResponseFinishReason({
|
|
@@ -4237,11 +4252,11 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4237
4252
|
hasFunctionCall
|
|
4238
4253
|
}),
|
|
4239
4254
|
usage: {
|
|
4240
|
-
inputTokens:
|
|
4241
|
-
outputTokens:
|
|
4242
|
-
totalTokens:
|
|
4243
|
-
reasoningTokens: (_z = (_y =
|
|
4244
|
-
cachedInputTokens: (_B = (_A =
|
|
4255
|
+
inputTokens: usage.input_tokens,
|
|
4256
|
+
outputTokens: usage.output_tokens,
|
|
4257
|
+
totalTokens: usage.input_tokens + usage.output_tokens,
|
|
4258
|
+
reasoningTokens: (_z = (_y = usage.output_tokens_details) == null ? void 0 : _y.reasoning_tokens) != null ? _z : void 0,
|
|
4259
|
+
cachedInputTokens: (_B = (_A = usage.input_tokens_details) == null ? void 0 : _A.cached_tokens) != null ? _B : void 0
|
|
4245
4260
|
},
|
|
4246
4261
|
request: { body },
|
|
4247
4262
|
response: {
|