@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
|
@@ -282,9 +282,12 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
282
282
|
output_tokens: number;
|
|
283
283
|
input_tokens_details?: {
|
|
284
284
|
cached_tokens?: number | null | undefined;
|
|
285
|
+
orchestration_input_tokens?: number | null | undefined;
|
|
286
|
+
orchestration_input_cached_tokens?: number | null | undefined;
|
|
285
287
|
} | null | undefined;
|
|
286
288
|
output_tokens_details?: {
|
|
287
289
|
reasoning_tokens?: number | null | undefined;
|
|
290
|
+
orchestration_output_tokens?: number | null | undefined;
|
|
288
291
|
} | null | undefined;
|
|
289
292
|
};
|
|
290
293
|
incomplete_details?: {
|
|
@@ -307,9 +310,12 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
307
310
|
output_tokens: number;
|
|
308
311
|
input_tokens_details?: {
|
|
309
312
|
cached_tokens?: number | null | undefined;
|
|
313
|
+
orchestration_input_tokens?: number | null | undefined;
|
|
314
|
+
orchestration_input_cached_tokens?: number | null | undefined;
|
|
310
315
|
} | null | undefined;
|
|
311
316
|
output_tokens_details?: {
|
|
312
317
|
reasoning_tokens?: number | null | undefined;
|
|
318
|
+
orchestration_output_tokens?: number | null | undefined;
|
|
313
319
|
} | null | undefined;
|
|
314
320
|
} | null | undefined;
|
|
315
321
|
service_tier?: string | null | undefined;
|
package/dist/internal/index.d.ts
CHANGED
|
@@ -282,9 +282,12 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
282
282
|
output_tokens: number;
|
|
283
283
|
input_tokens_details?: {
|
|
284
284
|
cached_tokens?: number | null | undefined;
|
|
285
|
+
orchestration_input_tokens?: number | null | undefined;
|
|
286
|
+
orchestration_input_cached_tokens?: number | null | undefined;
|
|
285
287
|
} | null | undefined;
|
|
286
288
|
output_tokens_details?: {
|
|
287
289
|
reasoning_tokens?: number | null | undefined;
|
|
290
|
+
orchestration_output_tokens?: number | null | undefined;
|
|
288
291
|
} | null | undefined;
|
|
289
292
|
};
|
|
290
293
|
incomplete_details?: {
|
|
@@ -307,9 +310,12 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
307
310
|
output_tokens: number;
|
|
308
311
|
input_tokens_details?: {
|
|
309
312
|
cached_tokens?: number | null | undefined;
|
|
313
|
+
orchestration_input_tokens?: number | null | undefined;
|
|
314
|
+
orchestration_input_cached_tokens?: number | null | undefined;
|
|
310
315
|
} | null | undefined;
|
|
311
316
|
output_tokens_details?: {
|
|
312
317
|
reasoning_tokens?: number | null | undefined;
|
|
318
|
+
orchestration_output_tokens?: number | null | undefined;
|
|
313
319
|
} | null | undefined;
|
|
314
320
|
} | null | undefined;
|
|
315
321
|
service_tier?: string | null | undefined;
|
package/dist/internal/index.js
CHANGED
|
@@ -2699,7 +2699,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2699
2699
|
hasApplyPatchTool = false,
|
|
2700
2700
|
customProviderToolNames
|
|
2701
2701
|
}) {
|
|
2702
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
2702
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
2703
2703
|
let input = [];
|
|
2704
2704
|
const warnings = [];
|
|
2705
2705
|
const processedApprovalIds = /* @__PURE__ */ new Set();
|
|
@@ -2836,10 +2836,11 @@ async function convertToOpenAIResponsesInput({
|
|
|
2836
2836
|
}
|
|
2837
2837
|
break;
|
|
2838
2838
|
}
|
|
2839
|
-
if (store && id != null) {
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2839
|
+
if (hasPreviousResponseId && store && id != null) {
|
|
2840
|
+
break;
|
|
2841
|
+
}
|
|
2842
|
+
const isProviderDefinedToolCall = hasLocalShellTool && resolvedToolName === "local_shell" || hasShellTool && resolvedToolName === "shell" || hasApplyPatchTool && resolvedToolName === "apply_patch" || ((_m = customProviderToolNames == null ? void 0 : customProviderToolNames.has(resolvedToolName)) != null ? _m : false);
|
|
2843
|
+
if (store && id != null && isProviderDefinedToolCall) {
|
|
2843
2844
|
input.push({ type: "item_reference", id });
|
|
2844
2845
|
break;
|
|
2845
2846
|
}
|
|
@@ -2910,7 +2911,6 @@ async function convertToOpenAIResponsesInput({
|
|
|
2910
2911
|
call_id: part.toolCallId,
|
|
2911
2912
|
name: resolvedToolName,
|
|
2912
2913
|
arguments: serializeToolCallArguments2(part.input),
|
|
2913
|
-
id,
|
|
2914
2914
|
...namespace != null && { namespace }
|
|
2915
2915
|
});
|
|
2916
2916
|
break;
|
|
@@ -2927,7 +2927,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2927
2927
|
part.toolName
|
|
2928
2928
|
);
|
|
2929
2929
|
if (resolvedResultToolName === "tool_search") {
|
|
2930
|
-
const itemId = (
|
|
2930
|
+
const itemId = (_p = (_o = (_n = part.providerOptions) == null ? void 0 : _n[providerOptionsName]) == null ? void 0 : _o.itemId) != null ? _p : part.toolCallId;
|
|
2931
2931
|
if (store) {
|
|
2932
2932
|
input.push({ type: "item_reference", id: itemId });
|
|
2933
2933
|
} else if (part.output.type === "json") {
|
|
@@ -2968,7 +2968,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2968
2968
|
break;
|
|
2969
2969
|
}
|
|
2970
2970
|
if (store) {
|
|
2971
|
-
const itemId = (
|
|
2971
|
+
const itemId = (_s = (_r = (_q = part.providerOptions) == null ? void 0 : _q[providerOptionsName]) == null ? void 0 : _r.itemId) != null ? _s : part.toolCallId;
|
|
2972
2972
|
input.push({ type: "item_reference", id: itemId });
|
|
2973
2973
|
} else {
|
|
2974
2974
|
warnings.push({
|
|
@@ -3078,7 +3078,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3078
3078
|
}
|
|
3079
3079
|
const output = part.output;
|
|
3080
3080
|
if (output.type === "execution-denied") {
|
|
3081
|
-
const approvalId = (
|
|
3081
|
+
const approvalId = (_u = (_t = output.providerOptions) == null ? void 0 : _t.openai) == null ? void 0 : _u.approvalId;
|
|
3082
3082
|
if (approvalId) {
|
|
3083
3083
|
continue;
|
|
3084
3084
|
}
|
|
@@ -3152,7 +3152,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3152
3152
|
outputValue = output.value;
|
|
3153
3153
|
break;
|
|
3154
3154
|
case "execution-denied":
|
|
3155
|
-
outputValue = (
|
|
3155
|
+
outputValue = (_v = output.reason) != null ? _v : "Tool execution denied.";
|
|
3156
3156
|
break;
|
|
3157
3157
|
case "json":
|
|
3158
3158
|
case "error-json":
|
|
@@ -3213,7 +3213,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3213
3213
|
contentValue = output.value;
|
|
3214
3214
|
break;
|
|
3215
3215
|
case "execution-denied":
|
|
3216
|
-
contentValue = (
|
|
3216
|
+
contentValue = (_w = output.reason) != null ? _w : "Tool execution denied.";
|
|
3217
3217
|
break;
|
|
3218
3218
|
case "json":
|
|
3219
3219
|
case "error-json":
|
|
@@ -3353,9 +3353,16 @@ var openaiResponsesChunkSchema = (0, import_provider_utils25.lazySchema)(
|
|
|
3353
3353
|
incomplete_details: import_v418.z.object({ reason: import_v418.z.string() }).nullish(),
|
|
3354
3354
|
usage: import_v418.z.object({
|
|
3355
3355
|
input_tokens: import_v418.z.number(),
|
|
3356
|
-
input_tokens_details: import_v418.z.object({
|
|
3356
|
+
input_tokens_details: import_v418.z.object({
|
|
3357
|
+
cached_tokens: import_v418.z.number().nullish(),
|
|
3358
|
+
orchestration_input_tokens: import_v418.z.number().nullish(),
|
|
3359
|
+
orchestration_input_cached_tokens: import_v418.z.number().nullish()
|
|
3360
|
+
}).nullish(),
|
|
3357
3361
|
output_tokens: import_v418.z.number(),
|
|
3358
|
-
output_tokens_details: import_v418.z.object({
|
|
3362
|
+
output_tokens_details: import_v418.z.object({
|
|
3363
|
+
reasoning_tokens: import_v418.z.number().nullish(),
|
|
3364
|
+
orchestration_output_tokens: import_v418.z.number().nullish()
|
|
3365
|
+
}).nullish()
|
|
3359
3366
|
}),
|
|
3360
3367
|
service_tier: import_v418.z.string().nullish()
|
|
3361
3368
|
})
|
|
@@ -3370,9 +3377,16 @@ var openaiResponsesChunkSchema = (0, import_provider_utils25.lazySchema)(
|
|
|
3370
3377
|
incomplete_details: import_v418.z.object({ reason: import_v418.z.string() }).nullish(),
|
|
3371
3378
|
usage: import_v418.z.object({
|
|
3372
3379
|
input_tokens: import_v418.z.number(),
|
|
3373
|
-
input_tokens_details: import_v418.z.object({
|
|
3380
|
+
input_tokens_details: import_v418.z.object({
|
|
3381
|
+
cached_tokens: import_v418.z.number().nullish(),
|
|
3382
|
+
orchestration_input_tokens: import_v418.z.number().nullish(),
|
|
3383
|
+
orchestration_input_cached_tokens: import_v418.z.number().nullish()
|
|
3384
|
+
}).nullish(),
|
|
3374
3385
|
output_tokens: import_v418.z.number(),
|
|
3375
|
-
output_tokens_details: import_v418.z.object({
|
|
3386
|
+
output_tokens_details: import_v418.z.object({
|
|
3387
|
+
reasoning_tokens: import_v418.z.number().nullish(),
|
|
3388
|
+
orchestration_output_tokens: import_v418.z.number().nullish()
|
|
3389
|
+
}).nullish()
|
|
3376
3390
|
}).nullish(),
|
|
3377
3391
|
service_tier: import_v418.z.string().nullish()
|
|
3378
3392
|
})
|
|
@@ -4156,9 +4170,16 @@ var openaiResponsesResponseSchema = (0, import_provider_utils25.lazySchema)(
|
|
|
4156
4170
|
incomplete_details: import_v418.z.object({ reason: import_v418.z.string() }).nullish(),
|
|
4157
4171
|
usage: import_v418.z.object({
|
|
4158
4172
|
input_tokens: import_v418.z.number(),
|
|
4159
|
-
input_tokens_details: import_v418.z.object({
|
|
4173
|
+
input_tokens_details: import_v418.z.object({
|
|
4174
|
+
cached_tokens: import_v418.z.number().nullish(),
|
|
4175
|
+
orchestration_input_tokens: import_v418.z.number().nullish(),
|
|
4176
|
+
orchestration_input_cached_tokens: import_v418.z.number().nullish()
|
|
4177
|
+
}).nullish(),
|
|
4160
4178
|
output_tokens: import_v418.z.number(),
|
|
4161
|
-
output_tokens_details: import_v418.z.object({
|
|
4179
|
+
output_tokens_details: import_v418.z.object({
|
|
4180
|
+
reasoning_tokens: import_v418.z.number().nullish(),
|
|
4181
|
+
orchestration_output_tokens: import_v418.z.number().nullish()
|
|
4182
|
+
}).nullish()
|
|
4162
4183
|
}).optional()
|
|
4163
4184
|
})
|
|
4164
4185
|
)
|