@ai-sdk/openai 4.0.0-canary.73 → 4.0.1
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 +199 -0
- package/dist/index.d.ts +7 -1
- package/dist/index.js +34 -11
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts +6 -0
- package/dist/internal/index.js +33 -10
- package/dist/internal/index.js.map +1 -1
- package/docs/03-openai.mdx +13 -12
- package/package.json +4 -4
- package/src/responses/convert-openai-responses-usage.ts +3 -0
- package/src/responses/openai-responses-api.ts +28 -6
- package/src/responses/openai-responses-language-model-options.ts +2 -1
- 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
|
)
|
|
@@ -4592,13 +4613,14 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema17(
|
|
|
4592
4613
|
conversation: z19.string().nullish(),
|
|
4593
4614
|
/**
|
|
4594
4615
|
* The set of extra fields to include in the response (advanced, usually not needed).
|
|
4595
|
-
* Example values: 'reasoning.encrypted_content', 'file_search_call.results', 'message.output_text.logprobs'.
|
|
4616
|
+
* Example values: 'reasoning.encrypted_content', 'file_search_call.results', 'web_search_call.results', 'message.output_text.logprobs'.
|
|
4596
4617
|
*/
|
|
4597
4618
|
include: z19.array(
|
|
4598
4619
|
z19.enum([
|
|
4599
4620
|
"reasoning.encrypted_content",
|
|
4600
4621
|
// handled internally by default, only needed for unknown reasoning models
|
|
4601
4622
|
"file_search_call.results",
|
|
4623
|
+
"web_search_call.results",
|
|
4602
4624
|
"message.output_text.logprobs"
|
|
4603
4625
|
])
|
|
4604
4626
|
).nullish(),
|
|
@@ -5531,6 +5553,7 @@ var OpenAIResponsesLanguageModel = class _OpenAIResponsesLanguageModel {
|
|
|
5531
5553
|
});
|
|
5532
5554
|
}
|
|
5533
5555
|
const resolvedReasoningEffort = (_a = openaiOptions == null ? void 0 : openaiOptions.reasoningEffort) != null ? _a : isCustomReasoning2(reasoning) ? reasoning : void 0;
|
|
5556
|
+
const resolvedReasoningSummary = (openaiOptions == null ? void 0 : openaiOptions.reasoningSummary) !== void 0 ? openaiOptions.reasoningSummary : resolvedReasoningEffort != null && resolvedReasoningEffort !== "none" ? "detailed" : void 0;
|
|
5534
5557
|
const isReasoningModel = (_b = openaiOptions == null ? void 0 : openaiOptions.forceReasoning) != null ? _b : modelCapabilities.isReasoningModel;
|
|
5535
5558
|
if ((openaiOptions == null ? void 0 : openaiOptions.conversation) && (openaiOptions == null ? void 0 : openaiOptions.previousResponseId)) {
|
|
5536
5559
|
warnings.push({
|
|
@@ -5657,13 +5680,13 @@ var OpenAIResponsesLanguageModel = class _OpenAIResponsesLanguageModel {
|
|
|
5657
5680
|
}))
|
|
5658
5681
|
},
|
|
5659
5682
|
// model-specific settings:
|
|
5660
|
-
...isReasoningModel && (resolvedReasoningEffort != null ||
|
|
5683
|
+
...isReasoningModel && (resolvedReasoningEffort != null || resolvedReasoningSummary != null) && {
|
|
5661
5684
|
reasoning: {
|
|
5662
5685
|
...resolvedReasoningEffort != null && {
|
|
5663
5686
|
effort: resolvedReasoningEffort
|
|
5664
5687
|
},
|
|
5665
|
-
...
|
|
5666
|
-
summary:
|
|
5688
|
+
...resolvedReasoningSummary != null && {
|
|
5689
|
+
summary: resolvedReasoningSummary
|
|
5667
5690
|
}
|
|
5668
5691
|
}
|
|
5669
5692
|
}
|