@ai-sdk/openai 2.0.127 → 2.0.129
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.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +24 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -18
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +3 -3
- package/dist/internal/index.d.ts +3 -3
- package/dist/internal/index.js +23 -17
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +23 -17
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/internal/index.mjs
CHANGED
|
@@ -39,6 +39,7 @@ function getOpenAILanguageModelCapabilities(modelId) {
|
|
|
39
39
|
const isGptChatModel = (gptVersion == null ? void 0 : gptVersion.minor) == null && ((_b = (_a2 = gptVersion == null ? void 0 : gptVersion.variant) == null ? void 0 : _a2.startsWith("chat")) != null ? _b : false);
|
|
40
40
|
const isGptNanoModel = (_d = (_c = gptVersion == null ? void 0 : gptVersion.variant) == null ? void 0 : _c.startsWith("nano")) != null ? _d : false;
|
|
41
41
|
const isGpt6OrLaterModel = gptVersion != null && gptVersion.major >= 6;
|
|
42
|
+
const isGpt6SolOrLuna = modelId === "gpt-6-sol" || modelId === "gpt-6-luna";
|
|
42
43
|
const supportsFlexProcessing = oSeriesVersion != null && oSeriesVersion >= 3 || gptVersion != null && gptVersion.major >= 5 && !isGptChatModel;
|
|
43
44
|
const supportsPriorityProcessing = modelId.startsWith("gpt-4") || gptVersion != null && gptVersion.major >= 5 && !isGptNanoModel && !isGptChatModel || oSeriesVersion != null && oSeriesVersion >= 3;
|
|
44
45
|
const isReasoningModel = oSeriesVersion != null || gptVersion != null && gptVersion.major >= 5 && !isGptChatModel || modelId === "codex-mini-latest" || modelId === "computer-use-preview";
|
|
@@ -49,7 +50,7 @@ function getOpenAILanguageModelCapabilities(modelId) {
|
|
|
49
50
|
supportsPriorityProcessing,
|
|
50
51
|
supportsConfigurationUpdate: isGpt6OrLaterModel,
|
|
51
52
|
supportsAsyncToolCalling: isGpt6OrLaterModel,
|
|
52
|
-
supportedReasoningEfforts: isGpt6OrLaterModel ? ["low", "medium", "high", "xhigh", "max"] : void 0,
|
|
53
|
+
supportedReasoningEfforts: isGpt6SolOrLuna ? ["none", "low", "medium", "high", "xhigh", "max"] : isGpt6OrLaterModel ? ["low", "medium", "high", "xhigh", "max"] : void 0,
|
|
53
54
|
isReasoningModel,
|
|
54
55
|
systemMessageMode,
|
|
55
56
|
supportsNonReasoningParameters
|
|
@@ -373,6 +374,9 @@ var openaiChatResponseSchema = lazyValidator(
|
|
|
373
374
|
message: z2.object({
|
|
374
375
|
role: z2.literal("assistant").nullish(),
|
|
375
376
|
content: z2.string().nullish(),
|
|
377
|
+
audio: z2.object({
|
|
378
|
+
transcript: z2.string().nullish()
|
|
379
|
+
}).nullish(),
|
|
376
380
|
tool_calls: z2.array(
|
|
377
381
|
z2.object({
|
|
378
382
|
id: z2.string().nullish(),
|
|
@@ -913,7 +917,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
913
917
|
};
|
|
914
918
|
}
|
|
915
919
|
async doGenerate(options) {
|
|
916
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
920
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
917
921
|
const { args: body, warnings } = await this.getArgs(options);
|
|
918
922
|
const {
|
|
919
923
|
responseHeaders,
|
|
@@ -941,19 +945,19 @@ var OpenAIChatLanguageModel = class {
|
|
|
941
945
|
});
|
|
942
946
|
}
|
|
943
947
|
const content = [];
|
|
944
|
-
const text = choice.message.content;
|
|
948
|
+
const text = choice.message.content != null && choice.message.content.length > 0 ? choice.message.content : (_a2 = choice.message.audio) == null ? void 0 : _a2.transcript;
|
|
945
949
|
if (text != null && text.length > 0) {
|
|
946
950
|
content.push({ type: "text", text });
|
|
947
951
|
}
|
|
948
|
-
for (const toolCall of (
|
|
952
|
+
for (const toolCall of (_b = choice.message.tool_calls) != null ? _b : []) {
|
|
949
953
|
content.push({
|
|
950
954
|
type: "tool-call",
|
|
951
|
-
toolCallId: (
|
|
955
|
+
toolCallId: (_c = toolCall.id) != null ? _c : generateId(),
|
|
952
956
|
toolName: toolCall.function.name,
|
|
953
957
|
input: toolCall.function.arguments
|
|
954
958
|
});
|
|
955
959
|
}
|
|
956
|
-
for (const annotation of (
|
|
960
|
+
for (const annotation of (_d = choice.message.annotations) != null ? _d : []) {
|
|
957
961
|
content.push({
|
|
958
962
|
type: "source",
|
|
959
963
|
sourceType: "url",
|
|
@@ -962,8 +966,8 @@ var OpenAIChatLanguageModel = class {
|
|
|
962
966
|
title: annotation.url_citation.title
|
|
963
967
|
});
|
|
964
968
|
}
|
|
965
|
-
const completionTokenDetails = (
|
|
966
|
-
const promptTokenDetails = (
|
|
969
|
+
const completionTokenDetails = (_e = response.usage) == null ? void 0 : _e.completion_tokens_details;
|
|
970
|
+
const promptTokenDetails = (_f = response.usage) == null ? void 0 : _f.prompt_tokens_details;
|
|
967
971
|
const providerMetadata = { openai: {} };
|
|
968
972
|
if ((completionTokenDetails == null ? void 0 : completionTokenDetails.accepted_prediction_tokens) != null) {
|
|
969
973
|
providerMetadata.openai.acceptedPredictionTokens = completionTokenDetails == null ? void 0 : completionTokenDetails.accepted_prediction_tokens;
|
|
@@ -976,18 +980,18 @@ var OpenAIChatLanguageModel = class {
|
|
|
976
980
|
cacheWriteTokens: promptTokenDetails.cache_write_tokens
|
|
977
981
|
};
|
|
978
982
|
}
|
|
979
|
-
if (((
|
|
983
|
+
if (((_g = choice.logprobs) == null ? void 0 : _g.content) != null) {
|
|
980
984
|
providerMetadata.openai.logprobs = choice.logprobs.content;
|
|
981
985
|
}
|
|
982
986
|
return {
|
|
983
987
|
content,
|
|
984
988
|
finishReason: mapOpenAIFinishReason(choice.finish_reason),
|
|
985
989
|
usage: {
|
|
986
|
-
inputTokens: (
|
|
987
|
-
outputTokens: (
|
|
988
|
-
totalTokens: (
|
|
989
|
-
reasoningTokens: (
|
|
990
|
-
cachedInputTokens: (
|
|
990
|
+
inputTokens: (_i = (_h = response.usage) == null ? void 0 : _h.prompt_tokens) != null ? _i : void 0,
|
|
991
|
+
outputTokens: (_k = (_j = response.usage) == null ? void 0 : _j.completion_tokens) != null ? _k : void 0,
|
|
992
|
+
totalTokens: (_m = (_l = response.usage) == null ? void 0 : _l.total_tokens) != null ? _m : void 0,
|
|
993
|
+
reasoningTokens: (_n = completionTokenDetails == null ? void 0 : completionTokenDetails.reasoning_tokens) != null ? _n : void 0,
|
|
994
|
+
cachedInputTokens: (_o = promptTokenDetails == null ? void 0 : promptTokenDetails.cached_tokens) != null ? _o : void 0
|
|
991
995
|
},
|
|
992
996
|
request: { body },
|
|
993
997
|
response: {
|
|
@@ -2984,7 +2988,7 @@ var openaiResponsesChunkSchema = lazyValidator12(
|
|
|
2984
2988
|
name: z15.string(),
|
|
2985
2989
|
arguments: z15.string(),
|
|
2986
2990
|
async: z15.boolean().nullish(),
|
|
2987
|
-
status: z15.
|
|
2991
|
+
status: z15.enum(["in_progress", "completed", "incomplete"])
|
|
2988
2992
|
}),
|
|
2989
2993
|
z15.object({
|
|
2990
2994
|
type: z15.literal("code_interpreter_call"),
|
|
@@ -3393,7 +3397,9 @@ var openaiResponsesReasoningModelIds = [
|
|
|
3393
3397
|
"gpt-5.6-luna",
|
|
3394
3398
|
"gpt-5.6-sol",
|
|
3395
3399
|
"gpt-5.6-terra",
|
|
3396
|
-
"gpt-6-astra"
|
|
3400
|
+
"gpt-6-astra",
|
|
3401
|
+
"gpt-6-luna",
|
|
3402
|
+
"gpt-6-sol"
|
|
3397
3403
|
];
|
|
3398
3404
|
var openaiResponsesModelIds = [
|
|
3399
3405
|
"gpt-4.1",
|
|
@@ -4710,7 +4716,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4710
4716
|
providerExecuted: true
|
|
4711
4717
|
});
|
|
4712
4718
|
} else if (value.item.type === "message") {
|
|
4713
|
-
ongoingAnnotations.splice(0
|
|
4719
|
+
ongoingAnnotations.splice(0);
|
|
4714
4720
|
activeMessagePhase = (_a2 = value.item.phase) != null ? _a2 : void 0;
|
|
4715
4721
|
controller.enqueue({
|
|
4716
4722
|
type: "text-start",
|