@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/index.mjs
CHANGED
|
@@ -47,6 +47,7 @@ function getOpenAILanguageModelCapabilities(modelId) {
|
|
|
47
47
|
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);
|
|
48
48
|
const isGptNanoModel = (_d = (_c = gptVersion == null ? void 0 : gptVersion.variant) == null ? void 0 : _c.startsWith("nano")) != null ? _d : false;
|
|
49
49
|
const isGpt6OrLaterModel = gptVersion != null && gptVersion.major >= 6;
|
|
50
|
+
const isGpt6SolOrLuna = modelId === "gpt-6-sol" || modelId === "gpt-6-luna";
|
|
50
51
|
const supportsFlexProcessing = oSeriesVersion != null && oSeriesVersion >= 3 || gptVersion != null && gptVersion.major >= 5 && !isGptChatModel;
|
|
51
52
|
const supportsPriorityProcessing = modelId.startsWith("gpt-4") || gptVersion != null && gptVersion.major >= 5 && !isGptNanoModel && !isGptChatModel || oSeriesVersion != null && oSeriesVersion >= 3;
|
|
52
53
|
const isReasoningModel = oSeriesVersion != null || gptVersion != null && gptVersion.major >= 5 && !isGptChatModel || modelId === "codex-mini-latest" || modelId === "computer-use-preview";
|
|
@@ -57,7 +58,7 @@ function getOpenAILanguageModelCapabilities(modelId) {
|
|
|
57
58
|
supportsPriorityProcessing,
|
|
58
59
|
supportsConfigurationUpdate: isGpt6OrLaterModel,
|
|
59
60
|
supportsAsyncToolCalling: isGpt6OrLaterModel,
|
|
60
|
-
supportedReasoningEfforts: isGpt6OrLaterModel ? ["low", "medium", "high", "xhigh", "max"] : void 0,
|
|
61
|
+
supportedReasoningEfforts: isGpt6SolOrLuna ? ["none", "low", "medium", "high", "xhigh", "max"] : isGpt6OrLaterModel ? ["low", "medium", "high", "xhigh", "max"] : void 0,
|
|
61
62
|
isReasoningModel,
|
|
62
63
|
systemMessageMode,
|
|
63
64
|
supportsNonReasoningParameters
|
|
@@ -381,6 +382,9 @@ var openaiChatResponseSchema = lazyValidator(
|
|
|
381
382
|
message: z2.object({
|
|
382
383
|
role: z2.literal("assistant").nullish(),
|
|
383
384
|
content: z2.string().nullish(),
|
|
385
|
+
audio: z2.object({
|
|
386
|
+
transcript: z2.string().nullish()
|
|
387
|
+
}).nullish(),
|
|
384
388
|
tool_calls: z2.array(
|
|
385
389
|
z2.object({
|
|
386
390
|
id: z2.string().nullish(),
|
|
@@ -921,7 +925,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
921
925
|
};
|
|
922
926
|
}
|
|
923
927
|
async doGenerate(options) {
|
|
924
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
928
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
925
929
|
const { args: body, warnings } = await this.getArgs(options);
|
|
926
930
|
const {
|
|
927
931
|
responseHeaders,
|
|
@@ -949,19 +953,19 @@ var OpenAIChatLanguageModel = class {
|
|
|
949
953
|
});
|
|
950
954
|
}
|
|
951
955
|
const content = [];
|
|
952
|
-
const text = choice.message.content;
|
|
956
|
+
const text = choice.message.content != null && choice.message.content.length > 0 ? choice.message.content : (_a2 = choice.message.audio) == null ? void 0 : _a2.transcript;
|
|
953
957
|
if (text != null && text.length > 0) {
|
|
954
958
|
content.push({ type: "text", text });
|
|
955
959
|
}
|
|
956
|
-
for (const toolCall of (
|
|
960
|
+
for (const toolCall of (_b = choice.message.tool_calls) != null ? _b : []) {
|
|
957
961
|
content.push({
|
|
958
962
|
type: "tool-call",
|
|
959
|
-
toolCallId: (
|
|
963
|
+
toolCallId: (_c = toolCall.id) != null ? _c : generateId(),
|
|
960
964
|
toolName: toolCall.function.name,
|
|
961
965
|
input: toolCall.function.arguments
|
|
962
966
|
});
|
|
963
967
|
}
|
|
964
|
-
for (const annotation of (
|
|
968
|
+
for (const annotation of (_d = choice.message.annotations) != null ? _d : []) {
|
|
965
969
|
content.push({
|
|
966
970
|
type: "source",
|
|
967
971
|
sourceType: "url",
|
|
@@ -970,8 +974,8 @@ var OpenAIChatLanguageModel = class {
|
|
|
970
974
|
title: annotation.url_citation.title
|
|
971
975
|
});
|
|
972
976
|
}
|
|
973
|
-
const completionTokenDetails = (
|
|
974
|
-
const promptTokenDetails = (
|
|
977
|
+
const completionTokenDetails = (_e = response.usage) == null ? void 0 : _e.completion_tokens_details;
|
|
978
|
+
const promptTokenDetails = (_f = response.usage) == null ? void 0 : _f.prompt_tokens_details;
|
|
975
979
|
const providerMetadata = { openai: {} };
|
|
976
980
|
if ((completionTokenDetails == null ? void 0 : completionTokenDetails.accepted_prediction_tokens) != null) {
|
|
977
981
|
providerMetadata.openai.acceptedPredictionTokens = completionTokenDetails == null ? void 0 : completionTokenDetails.accepted_prediction_tokens;
|
|
@@ -984,18 +988,18 @@ var OpenAIChatLanguageModel = class {
|
|
|
984
988
|
cacheWriteTokens: promptTokenDetails.cache_write_tokens
|
|
985
989
|
};
|
|
986
990
|
}
|
|
987
|
-
if (((
|
|
991
|
+
if (((_g = choice.logprobs) == null ? void 0 : _g.content) != null) {
|
|
988
992
|
providerMetadata.openai.logprobs = choice.logprobs.content;
|
|
989
993
|
}
|
|
990
994
|
return {
|
|
991
995
|
content,
|
|
992
996
|
finishReason: mapOpenAIFinishReason(choice.finish_reason),
|
|
993
997
|
usage: {
|
|
994
|
-
inputTokens: (
|
|
995
|
-
outputTokens: (
|
|
996
|
-
totalTokens: (
|
|
997
|
-
reasoningTokens: (
|
|
998
|
-
cachedInputTokens: (
|
|
998
|
+
inputTokens: (_i = (_h = response.usage) == null ? void 0 : _h.prompt_tokens) != null ? _i : void 0,
|
|
999
|
+
outputTokens: (_k = (_j = response.usage) == null ? void 0 : _j.completion_tokens) != null ? _k : void 0,
|
|
1000
|
+
totalTokens: (_m = (_l = response.usage) == null ? void 0 : _l.total_tokens) != null ? _m : void 0,
|
|
1001
|
+
reasoningTokens: (_n = completionTokenDetails == null ? void 0 : completionTokenDetails.reasoning_tokens) != null ? _n : void 0,
|
|
1002
|
+
cachedInputTokens: (_o = promptTokenDetails == null ? void 0 : promptTokenDetails.cached_tokens) != null ? _o : void 0
|
|
999
1003
|
},
|
|
1000
1004
|
request: { body },
|
|
1001
1005
|
response: {
|
|
@@ -2950,7 +2954,7 @@ var openaiResponsesChunkSchema = lazyValidator9(
|
|
|
2950
2954
|
name: z17.string(),
|
|
2951
2955
|
arguments: z17.string(),
|
|
2952
2956
|
async: z17.boolean().nullish(),
|
|
2953
|
-
status: z17.
|
|
2957
|
+
status: z17.enum(["in_progress", "completed", "incomplete"])
|
|
2954
2958
|
}),
|
|
2955
2959
|
z17.object({
|
|
2956
2960
|
type: z17.literal("code_interpreter_call"),
|
|
@@ -3359,7 +3363,9 @@ var openaiResponsesReasoningModelIds = [
|
|
|
3359
3363
|
"gpt-5.6-luna",
|
|
3360
3364
|
"gpt-5.6-sol",
|
|
3361
3365
|
"gpt-5.6-terra",
|
|
3362
|
-
"gpt-6-astra"
|
|
3366
|
+
"gpt-6-astra",
|
|
3367
|
+
"gpt-6-luna",
|
|
3368
|
+
"gpt-6-sol"
|
|
3363
3369
|
];
|
|
3364
3370
|
var openaiResponsesModelIds = [
|
|
3365
3371
|
"gpt-4.1",
|
|
@@ -4417,7 +4423,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4417
4423
|
providerExecuted: true
|
|
4418
4424
|
});
|
|
4419
4425
|
} else if (value.item.type === "message") {
|
|
4420
|
-
ongoingAnnotations.splice(0
|
|
4426
|
+
ongoingAnnotations.splice(0);
|
|
4421
4427
|
activeMessagePhase = (_a2 = value.item.phase) != null ? _a2 : void 0;
|
|
4422
4428
|
controller.enqueue({
|
|
4423
4429
|
type: "text-start",
|
|
@@ -5233,7 +5239,7 @@ var OpenAITranscriptionModel = class {
|
|
|
5233
5239
|
};
|
|
5234
5240
|
|
|
5235
5241
|
// src/version.ts
|
|
5236
|
-
var VERSION = true ? "2.0.
|
|
5242
|
+
var VERSION = true ? "2.0.129" : "0.0.0-test";
|
|
5237
5243
|
|
|
5238
5244
|
// src/openai-provider.ts
|
|
5239
5245
|
function createOpenAI(options = {}) {
|