@ai-sdk/openai 3.0.72 → 3.0.74
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 +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +39 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +39 -18
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +6 -0
- package/dist/internal/index.d.ts +6 -0
- package/dist/internal/index.js +38 -17
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +38 -17
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/responses/convert-openai-responses-usage.ts +3 -0
- package/src/responses/convert-to-openai-responses-input.ts +23 -5
- package/src/responses/openai-responses-api.ts +27 -6
package/dist/index.mjs
CHANGED
|
@@ -2847,7 +2847,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2847
2847
|
hasApplyPatchTool = false,
|
|
2848
2848
|
customProviderToolNames
|
|
2849
2849
|
}) {
|
|
2850
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
2850
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
2851
2851
|
let input = [];
|
|
2852
2852
|
const warnings = [];
|
|
2853
2853
|
const processedApprovalIds = /* @__PURE__ */ new Set();
|
|
@@ -2984,10 +2984,11 @@ async function convertToOpenAIResponsesInput({
|
|
|
2984
2984
|
}
|
|
2985
2985
|
break;
|
|
2986
2986
|
}
|
|
2987
|
-
if (store && id != null) {
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2987
|
+
if (hasPreviousResponseId && store && id != null) {
|
|
2988
|
+
break;
|
|
2989
|
+
}
|
|
2990
|
+
const isProviderDefinedToolCall = hasLocalShellTool && resolvedToolName === "local_shell" || hasShellTool && resolvedToolName === "shell" || hasApplyPatchTool && resolvedToolName === "apply_patch" || ((_m = customProviderToolNames == null ? void 0 : customProviderToolNames.has(resolvedToolName)) != null ? _m : false);
|
|
2991
|
+
if (store && id != null && isProviderDefinedToolCall) {
|
|
2991
2992
|
input.push({ type: "item_reference", id });
|
|
2992
2993
|
break;
|
|
2993
2994
|
}
|
|
@@ -3058,7 +3059,6 @@ async function convertToOpenAIResponsesInput({
|
|
|
3058
3059
|
call_id: part.toolCallId,
|
|
3059
3060
|
name: resolvedToolName,
|
|
3060
3061
|
arguments: serializeToolCallArguments2(part.input),
|
|
3061
|
-
id,
|
|
3062
3062
|
...namespace != null && { namespace }
|
|
3063
3063
|
});
|
|
3064
3064
|
break;
|
|
@@ -3075,7 +3075,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3075
3075
|
part.toolName
|
|
3076
3076
|
);
|
|
3077
3077
|
if (resolvedResultToolName === "tool_search") {
|
|
3078
|
-
const itemId = (
|
|
3078
|
+
const itemId = (_p = (_o = (_n = part.providerOptions) == null ? void 0 : _n[providerOptionsName]) == null ? void 0 : _o.itemId) != null ? _p : part.toolCallId;
|
|
3079
3079
|
if (store) {
|
|
3080
3080
|
input.push({ type: "item_reference", id: itemId });
|
|
3081
3081
|
} else if (part.output.type === "json") {
|
|
@@ -3116,7 +3116,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3116
3116
|
break;
|
|
3117
3117
|
}
|
|
3118
3118
|
if (store) {
|
|
3119
|
-
const itemId = (
|
|
3119
|
+
const itemId = (_s = (_r = (_q = part.providerOptions) == null ? void 0 : _q[providerOptionsName]) == null ? void 0 : _r.itemId) != null ? _s : part.toolCallId;
|
|
3120
3120
|
input.push({ type: "item_reference", id: itemId });
|
|
3121
3121
|
} else {
|
|
3122
3122
|
warnings.push({
|
|
@@ -3226,7 +3226,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3226
3226
|
}
|
|
3227
3227
|
const output = part.output;
|
|
3228
3228
|
if (output.type === "execution-denied") {
|
|
3229
|
-
const approvalId = (
|
|
3229
|
+
const approvalId = (_u = (_t = output.providerOptions) == null ? void 0 : _t.openai) == null ? void 0 : _u.approvalId;
|
|
3230
3230
|
if (approvalId) {
|
|
3231
3231
|
continue;
|
|
3232
3232
|
}
|
|
@@ -3300,7 +3300,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3300
3300
|
outputValue = output.value;
|
|
3301
3301
|
break;
|
|
3302
3302
|
case "execution-denied":
|
|
3303
|
-
outputValue = (
|
|
3303
|
+
outputValue = (_v = output.reason) != null ? _v : "Tool execution denied.";
|
|
3304
3304
|
break;
|
|
3305
3305
|
case "json":
|
|
3306
3306
|
case "error-json":
|
|
@@ -3361,7 +3361,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3361
3361
|
contentValue = output.value;
|
|
3362
3362
|
break;
|
|
3363
3363
|
case "execution-denied":
|
|
3364
|
-
contentValue = (
|
|
3364
|
+
contentValue = (_w = output.reason) != null ? _w : "Tool execution denied.";
|
|
3365
3365
|
break;
|
|
3366
3366
|
case "json":
|
|
3367
3367
|
case "error-json":
|
|
@@ -3504,9 +3504,16 @@ var openaiResponsesChunkSchema = lazySchema20(
|
|
|
3504
3504
|
incomplete_details: z22.object({ reason: z22.string() }).nullish(),
|
|
3505
3505
|
usage: z22.object({
|
|
3506
3506
|
input_tokens: z22.number(),
|
|
3507
|
-
input_tokens_details: z22.object({
|
|
3507
|
+
input_tokens_details: z22.object({
|
|
3508
|
+
cached_tokens: z22.number().nullish(),
|
|
3509
|
+
orchestration_input_tokens: z22.number().nullish(),
|
|
3510
|
+
orchestration_input_cached_tokens: z22.number().nullish()
|
|
3511
|
+
}).nullish(),
|
|
3508
3512
|
output_tokens: z22.number(),
|
|
3509
|
-
output_tokens_details: z22.object({
|
|
3513
|
+
output_tokens_details: z22.object({
|
|
3514
|
+
reasoning_tokens: z22.number().nullish(),
|
|
3515
|
+
orchestration_output_tokens: z22.number().nullish()
|
|
3516
|
+
}).nullish()
|
|
3510
3517
|
}),
|
|
3511
3518
|
service_tier: z22.string().nullish()
|
|
3512
3519
|
})
|
|
@@ -3521,9 +3528,16 @@ var openaiResponsesChunkSchema = lazySchema20(
|
|
|
3521
3528
|
incomplete_details: z22.object({ reason: z22.string() }).nullish(),
|
|
3522
3529
|
usage: z22.object({
|
|
3523
3530
|
input_tokens: z22.number(),
|
|
3524
|
-
input_tokens_details: z22.object({
|
|
3531
|
+
input_tokens_details: z22.object({
|
|
3532
|
+
cached_tokens: z22.number().nullish(),
|
|
3533
|
+
orchestration_input_tokens: z22.number().nullish(),
|
|
3534
|
+
orchestration_input_cached_tokens: z22.number().nullish()
|
|
3535
|
+
}).nullish(),
|
|
3525
3536
|
output_tokens: z22.number(),
|
|
3526
|
-
output_tokens_details: z22.object({
|
|
3537
|
+
output_tokens_details: z22.object({
|
|
3538
|
+
reasoning_tokens: z22.number().nullish(),
|
|
3539
|
+
orchestration_output_tokens: z22.number().nullish()
|
|
3540
|
+
}).nullish()
|
|
3527
3541
|
}).nullish(),
|
|
3528
3542
|
service_tier: z22.string().nullish()
|
|
3529
3543
|
})
|
|
@@ -4307,9 +4321,16 @@ var openaiResponsesResponseSchema = lazySchema20(
|
|
|
4307
4321
|
incomplete_details: z22.object({ reason: z22.string() }).nullish(),
|
|
4308
4322
|
usage: z22.object({
|
|
4309
4323
|
input_tokens: z22.number(),
|
|
4310
|
-
input_tokens_details: z22.object({
|
|
4324
|
+
input_tokens_details: z22.object({
|
|
4325
|
+
cached_tokens: z22.number().nullish(),
|
|
4326
|
+
orchestration_input_tokens: z22.number().nullish(),
|
|
4327
|
+
orchestration_input_cached_tokens: z22.number().nullish()
|
|
4328
|
+
}).nullish(),
|
|
4311
4329
|
output_tokens: z22.number(),
|
|
4312
|
-
output_tokens_details: z22.object({
|
|
4330
|
+
output_tokens_details: z22.object({
|
|
4331
|
+
reasoning_tokens: z22.number().nullish(),
|
|
4332
|
+
orchestration_output_tokens: z22.number().nullish()
|
|
4333
|
+
}).nullish()
|
|
4313
4334
|
}).optional()
|
|
4314
4335
|
})
|
|
4315
4336
|
)
|
|
@@ -6967,7 +6988,7 @@ var OpenAITranscriptionModel = class {
|
|
|
6967
6988
|
};
|
|
6968
6989
|
|
|
6969
6990
|
// src/version.ts
|
|
6970
|
-
var VERSION = true ? "3.0.
|
|
6991
|
+
var VERSION = true ? "3.0.74" : "0.0.0-test";
|
|
6971
6992
|
|
|
6972
6993
|
// src/openai-provider.ts
|
|
6973
6994
|
function createOpenAI(options = {}) {
|