@ai-sdk/openai 4.0.0-canary.73 → 4.0.0
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 +193 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +32 -10
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts +6 -0
- package/dist/internal/index.js +31 -9
- package/dist/internal/index.js.map +1 -1
- package/docs/03-openai.mdx +1 -1
- package/package.json +4 -4
- package/src/responses/convert-openai-responses-usage.ts +3 -0
- package/src/responses/openai-responses-api.ts +27 -6
- package/src/responses/openai-responses-language-model.ts +9 -3
package/dist/internal/index.d.ts
CHANGED
|
@@ -354,9 +354,12 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
354
354
|
output_tokens: number;
|
|
355
355
|
input_tokens_details?: {
|
|
356
356
|
cached_tokens?: number | null | undefined;
|
|
357
|
+
orchestration_input_tokens?: number | null | undefined;
|
|
358
|
+
orchestration_input_cached_tokens?: number | null | undefined;
|
|
357
359
|
} | null | undefined;
|
|
358
360
|
output_tokens_details?: {
|
|
359
361
|
reasoning_tokens?: number | null | undefined;
|
|
362
|
+
orchestration_output_tokens?: number | null | undefined;
|
|
360
363
|
} | null | undefined;
|
|
361
364
|
};
|
|
362
365
|
incomplete_details?: {
|
|
@@ -380,9 +383,12 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
380
383
|
output_tokens: number;
|
|
381
384
|
input_tokens_details?: {
|
|
382
385
|
cached_tokens?: number | null | undefined;
|
|
386
|
+
orchestration_input_tokens?: number | null | undefined;
|
|
387
|
+
orchestration_input_cached_tokens?: number | null | undefined;
|
|
383
388
|
} | null | undefined;
|
|
384
389
|
output_tokens_details?: {
|
|
385
390
|
reasoning_tokens?: number | null | undefined;
|
|
391
|
+
orchestration_output_tokens?: number | null | undefined;
|
|
386
392
|
} | null | undefined;
|
|
387
393
|
} | null | undefined;
|
|
388
394
|
service_tier?: string | null | undefined;
|
package/dist/internal/index.js
CHANGED
|
@@ -3688,9 +3688,16 @@ var openaiResponsesChunkSchema = lazySchema16(
|
|
|
3688
3688
|
incomplete_details: z18.object({ reason: z18.string() }).nullish(),
|
|
3689
3689
|
usage: z18.object({
|
|
3690
3690
|
input_tokens: z18.number(),
|
|
3691
|
-
input_tokens_details: z18.object({
|
|
3691
|
+
input_tokens_details: z18.object({
|
|
3692
|
+
cached_tokens: z18.number().nullish(),
|
|
3693
|
+
orchestration_input_tokens: z18.number().nullish(),
|
|
3694
|
+
orchestration_input_cached_tokens: z18.number().nullish()
|
|
3695
|
+
}).nullish(),
|
|
3692
3696
|
output_tokens: z18.number(),
|
|
3693
|
-
output_tokens_details: z18.object({
|
|
3697
|
+
output_tokens_details: z18.object({
|
|
3698
|
+
reasoning_tokens: z18.number().nullish(),
|
|
3699
|
+
orchestration_output_tokens: z18.number().nullish()
|
|
3700
|
+
}).nullish()
|
|
3694
3701
|
}),
|
|
3695
3702
|
service_tier: z18.string().nullish()
|
|
3696
3703
|
})
|
|
@@ -3706,9 +3713,16 @@ var openaiResponsesChunkSchema = lazySchema16(
|
|
|
3706
3713
|
incomplete_details: z18.object({ reason: z18.string() }).nullish(),
|
|
3707
3714
|
usage: z18.object({
|
|
3708
3715
|
input_tokens: z18.number(),
|
|
3709
|
-
input_tokens_details: z18.object({
|
|
3716
|
+
input_tokens_details: z18.object({
|
|
3717
|
+
cached_tokens: z18.number().nullish(),
|
|
3718
|
+
orchestration_input_tokens: z18.number().nullish(),
|
|
3719
|
+
orchestration_input_cached_tokens: z18.number().nullish()
|
|
3720
|
+
}).nullish(),
|
|
3710
3721
|
output_tokens: z18.number(),
|
|
3711
|
-
output_tokens_details: z18.object({
|
|
3722
|
+
output_tokens_details: z18.object({
|
|
3723
|
+
reasoning_tokens: z18.number().nullish(),
|
|
3724
|
+
orchestration_output_tokens: z18.number().nullish()
|
|
3725
|
+
}).nullish()
|
|
3712
3726
|
}).nullish(),
|
|
3713
3727
|
service_tier: z18.string().nullish()
|
|
3714
3728
|
})
|
|
@@ -4499,9 +4513,16 @@ var openaiResponsesResponseSchema = lazySchema16(
|
|
|
4499
4513
|
incomplete_details: z18.object({ reason: z18.string() }).nullish(),
|
|
4500
4514
|
usage: z18.object({
|
|
4501
4515
|
input_tokens: z18.number(),
|
|
4502
|
-
input_tokens_details: z18.object({
|
|
4516
|
+
input_tokens_details: z18.object({
|
|
4517
|
+
cached_tokens: z18.number().nullish(),
|
|
4518
|
+
orchestration_input_tokens: z18.number().nullish(),
|
|
4519
|
+
orchestration_input_cached_tokens: z18.number().nullish()
|
|
4520
|
+
}).nullish(),
|
|
4503
4521
|
output_tokens: z18.number(),
|
|
4504
|
-
output_tokens_details: z18.object({
|
|
4522
|
+
output_tokens_details: z18.object({
|
|
4523
|
+
reasoning_tokens: z18.number().nullish(),
|
|
4524
|
+
orchestration_output_tokens: z18.number().nullish()
|
|
4525
|
+
}).nullish()
|
|
4505
4526
|
}).optional()
|
|
4506
4527
|
})
|
|
4507
4528
|
)
|
|
@@ -5531,6 +5552,7 @@ var OpenAIResponsesLanguageModel = class _OpenAIResponsesLanguageModel {
|
|
|
5531
5552
|
});
|
|
5532
5553
|
}
|
|
5533
5554
|
const resolvedReasoningEffort = (_a = openaiOptions == null ? void 0 : openaiOptions.reasoningEffort) != null ? _a : isCustomReasoning2(reasoning) ? reasoning : void 0;
|
|
5555
|
+
const resolvedReasoningSummary = (openaiOptions == null ? void 0 : openaiOptions.reasoningSummary) !== void 0 ? openaiOptions.reasoningSummary : resolvedReasoningEffort != null && resolvedReasoningEffort !== "none" ? "detailed" : void 0;
|
|
5534
5556
|
const isReasoningModel = (_b = openaiOptions == null ? void 0 : openaiOptions.forceReasoning) != null ? _b : modelCapabilities.isReasoningModel;
|
|
5535
5557
|
if ((openaiOptions == null ? void 0 : openaiOptions.conversation) && (openaiOptions == null ? void 0 : openaiOptions.previousResponseId)) {
|
|
5536
5558
|
warnings.push({
|
|
@@ -5657,13 +5679,13 @@ var OpenAIResponsesLanguageModel = class _OpenAIResponsesLanguageModel {
|
|
|
5657
5679
|
}))
|
|
5658
5680
|
},
|
|
5659
5681
|
// model-specific settings:
|
|
5660
|
-
...isReasoningModel && (resolvedReasoningEffort != null ||
|
|
5682
|
+
...isReasoningModel && (resolvedReasoningEffort != null || resolvedReasoningSummary != null) && {
|
|
5661
5683
|
reasoning: {
|
|
5662
5684
|
...resolvedReasoningEffort != null && {
|
|
5663
5685
|
effort: resolvedReasoningEffort
|
|
5664
5686
|
},
|
|
5665
|
-
...
|
|
5666
|
-
summary:
|
|
5687
|
+
...resolvedReasoningSummary != null && {
|
|
5688
|
+
summary: resolvedReasoningSummary
|
|
5667
5689
|
}
|
|
5668
5690
|
}
|
|
5669
5691
|
}
|