@ai-sdk/openai 2.0.108 → 2.0.110
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 +13 -0
- package/dist/index.js +46 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +46 -5
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +45 -4
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +45 -4
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -2609,9 +2609,16 @@ var openaiResponsesChunkSchema = lazyValidator9(
|
|
|
2609
2609
|
incomplete_details: z17.object({ reason: z17.string() }).nullish(),
|
|
2610
2610
|
usage: z17.object({
|
|
2611
2611
|
input_tokens: z17.number(),
|
|
2612
|
-
input_tokens_details: z17.object({
|
|
2612
|
+
input_tokens_details: z17.object({
|
|
2613
|
+
cached_tokens: z17.number().nullish(),
|
|
2614
|
+
orchestration_input_tokens: z17.number().nullish(),
|
|
2615
|
+
orchestration_input_cached_tokens: z17.number().nullish()
|
|
2616
|
+
}).nullish(),
|
|
2613
2617
|
output_tokens: z17.number(),
|
|
2614
|
-
output_tokens_details: z17.object({
|
|
2618
|
+
output_tokens_details: z17.object({
|
|
2619
|
+
reasoning_tokens: z17.number().nullish(),
|
|
2620
|
+
orchestration_output_tokens: z17.number().nullish()
|
|
2621
|
+
}).nullish()
|
|
2615
2622
|
}),
|
|
2616
2623
|
service_tier: z17.string().nullish()
|
|
2617
2624
|
})
|
|
@@ -3034,9 +3041,16 @@ var openaiResponsesResponseSchema = lazyValidator9(
|
|
|
3034
3041
|
incomplete_details: z17.object({ reason: z17.string() }).nullish(),
|
|
3035
3042
|
usage: z17.object({
|
|
3036
3043
|
input_tokens: z17.number(),
|
|
3037
|
-
input_tokens_details: z17.object({
|
|
3044
|
+
input_tokens_details: z17.object({
|
|
3045
|
+
cached_tokens: z17.number().nullish(),
|
|
3046
|
+
orchestration_input_tokens: z17.number().nullish(),
|
|
3047
|
+
orchestration_input_cached_tokens: z17.number().nullish()
|
|
3048
|
+
}).nullish(),
|
|
3038
3049
|
output_tokens: z17.number(),
|
|
3039
|
-
output_tokens_details: z17.object({
|
|
3050
|
+
output_tokens_details: z17.object({
|
|
3051
|
+
reasoning_tokens: z17.number().nullish(),
|
|
3052
|
+
orchestration_output_tokens: z17.number().nullish()
|
|
3053
|
+
}).nullish()
|
|
3040
3054
|
}).optional()
|
|
3041
3055
|
})
|
|
3042
3056
|
)
|
|
@@ -3851,6 +3865,10 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3851
3865
|
providerMetadata[providerKey].serviceTier = response.service_tier;
|
|
3852
3866
|
}
|
|
3853
3867
|
const usage = response.usage;
|
|
3868
|
+
const orchestrationUsage = getOrchestrationUsageMetadata(usage);
|
|
3869
|
+
if (orchestrationUsage != null) {
|
|
3870
|
+
providerMetadata[providerKey].usage = orchestrationUsage;
|
|
3871
|
+
}
|
|
3854
3872
|
return {
|
|
3855
3873
|
content,
|
|
3856
3874
|
finishReason: mapOpenAIResponseFinishReason({
|
|
@@ -3916,6 +3934,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3916
3934
|
let hasFunctionCall = false;
|
|
3917
3935
|
const activeReasoning = {};
|
|
3918
3936
|
let serviceTier;
|
|
3937
|
+
let orchestrationUsage;
|
|
3919
3938
|
return {
|
|
3920
3939
|
stream: response.pipeThrough(
|
|
3921
3940
|
new TransformStream({
|
|
@@ -4316,6 +4335,9 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4316
4335
|
if (typeof value.response.service_tier === "string") {
|
|
4317
4336
|
serviceTier = value.response.service_tier;
|
|
4318
4337
|
}
|
|
4338
|
+
orchestrationUsage = getOrchestrationUsageMetadata(
|
|
4339
|
+
value.response.usage
|
|
4340
|
+
);
|
|
4319
4341
|
} else if (isResponseAnnotationAddedChunk(value)) {
|
|
4320
4342
|
ongoingAnnotations.push(value.annotation);
|
|
4321
4343
|
if (value.annotation.type === "url_citation") {
|
|
@@ -4359,6 +4381,9 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4359
4381
|
if (serviceTier !== void 0) {
|
|
4360
4382
|
providerMetadata[providerKey].serviceTier = serviceTier;
|
|
4361
4383
|
}
|
|
4384
|
+
if (orchestrationUsage != null) {
|
|
4385
|
+
providerMetadata[providerKey].usage = orchestrationUsage;
|
|
4386
|
+
}
|
|
4362
4387
|
controller.enqueue({
|
|
4363
4388
|
type: "finish",
|
|
4364
4389
|
finishReason,
|
|
@@ -4427,6 +4452,22 @@ function mapWebSearchOutput(action) {
|
|
|
4427
4452
|
};
|
|
4428
4453
|
}
|
|
4429
4454
|
}
|
|
4455
|
+
function getOrchestrationUsageMetadata(usage) {
|
|
4456
|
+
var _a, _b, _c;
|
|
4457
|
+
const orchestrationInputTokens = (_a = usage == null ? void 0 : usage.input_tokens_details) == null ? void 0 : _a.orchestration_input_tokens;
|
|
4458
|
+
const orchestrationInputCachedTokens = (_b = usage == null ? void 0 : usage.input_tokens_details) == null ? void 0 : _b.orchestration_input_cached_tokens;
|
|
4459
|
+
const orchestrationOutputTokens = (_c = usage == null ? void 0 : usage.output_tokens_details) == null ? void 0 : _c.orchestration_output_tokens;
|
|
4460
|
+
if (orchestrationInputTokens == null && orchestrationInputCachedTokens == null && orchestrationOutputTokens == null) {
|
|
4461
|
+
return void 0;
|
|
4462
|
+
}
|
|
4463
|
+
return {
|
|
4464
|
+
...orchestrationInputTokens != null && { orchestrationInputTokens },
|
|
4465
|
+
...orchestrationInputCachedTokens != null && {
|
|
4466
|
+
orchestrationInputCachedTokens
|
|
4467
|
+
},
|
|
4468
|
+
...orchestrationOutputTokens != null && { orchestrationOutputTokens }
|
|
4469
|
+
};
|
|
4470
|
+
}
|
|
4430
4471
|
|
|
4431
4472
|
// src/speech/openai-speech-model.ts
|
|
4432
4473
|
import {
|
|
@@ -4799,7 +4840,7 @@ var OpenAITranscriptionModel = class {
|
|
|
4799
4840
|
};
|
|
4800
4841
|
|
|
4801
4842
|
// src/version.ts
|
|
4802
|
-
var VERSION = true ? "2.0.
|
|
4843
|
+
var VERSION = true ? "2.0.110" : "0.0.0-test";
|
|
4803
4844
|
|
|
4804
4845
|
// src/openai-provider.ts
|
|
4805
4846
|
function createOpenAI(options = {}) {
|