@ai-sdk/openai 3.0.0-beta.64 → 3.0.0-beta.66
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 +33 -27
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +33 -27
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +32 -26
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +32 -26
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @ai-sdk/openai
|
|
2
2
|
|
|
3
|
+
## 3.0.0-beta.66
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- d86b52f: distinguish between OpenAI and Azure in Responses API providerMetadata
|
|
8
|
+
|
|
9
|
+
## 3.0.0-beta.65
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 38a4035: added support for external_web_access parameter on web_search tool
|
|
14
|
+
|
|
3
15
|
## 3.0.0-beta.64
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -78,6 +78,12 @@ declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderDefinedToolFa
|
|
|
78
78
|
name: string;
|
|
79
79
|
}>;
|
|
80
80
|
}, {
|
|
81
|
+
/**
|
|
82
|
+
* Whether to use external web access for fetching live content.
|
|
83
|
+
* - true: Fetch live web content (default)
|
|
84
|
+
* - false: Use cached/indexed results
|
|
85
|
+
*/
|
|
86
|
+
externalWebAccess?: boolean;
|
|
81
87
|
/**
|
|
82
88
|
* Filters for the search.
|
|
83
89
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -78,6 +78,12 @@ declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderDefinedToolFa
|
|
|
78
78
|
name: string;
|
|
79
79
|
}>;
|
|
80
80
|
}, {
|
|
81
|
+
/**
|
|
82
|
+
* Whether to use external web access for fetching live content.
|
|
83
|
+
* - true: Fetch live web content (default)
|
|
84
|
+
* - false: Use cached/indexed results
|
|
85
|
+
*/
|
|
86
|
+
externalWebAccess?: boolean;
|
|
81
87
|
/**
|
|
82
88
|
* Filters for the search.
|
|
83
89
|
*/
|
package/dist/index.js
CHANGED
|
@@ -1917,6 +1917,7 @@ var import_v413 = require("zod/v4");
|
|
|
1917
1917
|
var webSearchArgsSchema = (0, import_provider_utils18.lazySchema)(
|
|
1918
1918
|
() => (0, import_provider_utils18.zodSchema)(
|
|
1919
1919
|
import_v413.z.object({
|
|
1920
|
+
externalWebAccess: import_v413.z.boolean().optional(),
|
|
1920
1921
|
filters: import_v413.z.object({ allowedDomains: import_v413.z.array(import_v413.z.string()).optional() }).optional(),
|
|
1921
1922
|
searchContextSize: import_v413.z.enum(["low", "medium", "high"]).optional(),
|
|
1922
1923
|
userLocation: import_v413.z.object({
|
|
@@ -3289,6 +3290,7 @@ async function prepareResponsesTools({
|
|
|
3289
3290
|
openaiTools2.push({
|
|
3290
3291
|
type: "web_search",
|
|
3291
3292
|
filters: args.filters != null ? { allowed_domains: args.filters.allowedDomains } : void 0,
|
|
3293
|
+
external_web_access: args.externalWebAccess,
|
|
3292
3294
|
search_context_size: args.searchContextSize,
|
|
3293
3295
|
user_location: args.userLocation
|
|
3294
3296
|
});
|
|
@@ -3624,6 +3626,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3624
3626
|
path: "/responses",
|
|
3625
3627
|
modelId: this.modelId
|
|
3626
3628
|
});
|
|
3629
|
+
const providerKey = this.config.provider.replace(".responses", "");
|
|
3627
3630
|
const {
|
|
3628
3631
|
responseHeaders,
|
|
3629
3632
|
value: response,
|
|
@@ -3664,7 +3667,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3664
3667
|
type: "reasoning",
|
|
3665
3668
|
text: summary.text,
|
|
3666
3669
|
providerMetadata: {
|
|
3667
|
-
|
|
3670
|
+
[providerKey]: {
|
|
3668
3671
|
itemId: part.id,
|
|
3669
3672
|
reasoningEncryptedContent: (_a = part.encrypted_content) != null ? _a : null
|
|
3670
3673
|
}
|
|
@@ -3700,7 +3703,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3700
3703
|
action: part.action
|
|
3701
3704
|
}),
|
|
3702
3705
|
providerMetadata: {
|
|
3703
|
-
|
|
3706
|
+
[providerKey]: {
|
|
3704
3707
|
itemId: part.id
|
|
3705
3708
|
}
|
|
3706
3709
|
}
|
|
@@ -3722,7 +3725,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3722
3725
|
type: "text",
|
|
3723
3726
|
text: contentPart.text,
|
|
3724
3727
|
providerMetadata: {
|
|
3725
|
-
|
|
3728
|
+
[providerKey]: providerMetadata2
|
|
3726
3729
|
}
|
|
3727
3730
|
});
|
|
3728
3731
|
for (const annotation of contentPart.annotations) {
|
|
@@ -3744,7 +3747,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3744
3747
|
filename: (_l = annotation.filename) != null ? _l : annotation.file_id,
|
|
3745
3748
|
...annotation.file_id ? {
|
|
3746
3749
|
providerMetadata: {
|
|
3747
|
-
|
|
3750
|
+
[providerKey]: {
|
|
3748
3751
|
fileId: annotation.file_id
|
|
3749
3752
|
}
|
|
3750
3753
|
}
|
|
@@ -3759,7 +3762,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3759
3762
|
title: (_q = (_p = annotation.filename) != null ? _p : annotation.file_id) != null ? _q : "Document",
|
|
3760
3763
|
filename: (_r = annotation.filename) != null ? _r : annotation.file_id,
|
|
3761
3764
|
providerMetadata: {
|
|
3762
|
-
|
|
3765
|
+
[providerKey]: {
|
|
3763
3766
|
fileId: annotation.file_id,
|
|
3764
3767
|
containerId: annotation.container_id,
|
|
3765
3768
|
...annotation.index != null ? { index: annotation.index } : {}
|
|
@@ -3775,7 +3778,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3775
3778
|
title: annotation.file_id,
|
|
3776
3779
|
filename: annotation.file_id,
|
|
3777
3780
|
providerMetadata: {
|
|
3778
|
-
|
|
3781
|
+
[providerKey]: {
|
|
3779
3782
|
fileId: annotation.file_id,
|
|
3780
3783
|
...annotation.index != null ? { index: annotation.index } : {}
|
|
3781
3784
|
}
|
|
@@ -3794,7 +3797,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3794
3797
|
toolName: part.name,
|
|
3795
3798
|
input: part.arguments,
|
|
3796
3799
|
providerMetadata: {
|
|
3797
|
-
|
|
3800
|
+
[providerKey]: {
|
|
3798
3801
|
itemId: part.id
|
|
3799
3802
|
}
|
|
3800
3803
|
}
|
|
@@ -3959,13 +3962,13 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3959
3962
|
}
|
|
3960
3963
|
}
|
|
3961
3964
|
const providerMetadata = {
|
|
3962
|
-
|
|
3965
|
+
[providerKey]: { responseId: response.id }
|
|
3963
3966
|
};
|
|
3964
3967
|
if (logprobs.length > 0) {
|
|
3965
|
-
providerMetadata.
|
|
3968
|
+
providerMetadata[providerKey].logprobs = logprobs;
|
|
3966
3969
|
}
|
|
3967
3970
|
if (typeof response.service_tier === "string") {
|
|
3968
|
-
providerMetadata.
|
|
3971
|
+
providerMetadata[providerKey].serviceTier = response.service_tier;
|
|
3969
3972
|
}
|
|
3970
3973
|
const usage = response.usage;
|
|
3971
3974
|
return {
|
|
@@ -4018,6 +4021,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4018
4021
|
fetch: this.config.fetch
|
|
4019
4022
|
});
|
|
4020
4023
|
const self = this;
|
|
4024
|
+
const providerKey = this.config.provider.replace(".responses", "");
|
|
4021
4025
|
let finishReason = "unknown";
|
|
4022
4026
|
const usage = {
|
|
4023
4027
|
inputTokens: void 0,
|
|
@@ -4141,7 +4145,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4141
4145
|
type: "text-start",
|
|
4142
4146
|
id: value.item.id,
|
|
4143
4147
|
providerMetadata: {
|
|
4144
|
-
|
|
4148
|
+
[providerKey]: {
|
|
4145
4149
|
itemId: value.item.id
|
|
4146
4150
|
}
|
|
4147
4151
|
}
|
|
@@ -4155,7 +4159,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4155
4159
|
type: "reasoning-start",
|
|
4156
4160
|
id: `${value.item.id}:0`,
|
|
4157
4161
|
providerMetadata: {
|
|
4158
|
-
|
|
4162
|
+
[providerKey]: {
|
|
4159
4163
|
itemId: value.item.id,
|
|
4160
4164
|
reasoningEncryptedContent: (_a = value.item.encrypted_content) != null ? _a : null
|
|
4161
4165
|
}
|
|
@@ -4176,7 +4180,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4176
4180
|
toolName: value.item.name,
|
|
4177
4181
|
input: value.item.arguments,
|
|
4178
4182
|
providerMetadata: {
|
|
4179
|
-
|
|
4183
|
+
[providerKey]: {
|
|
4180
4184
|
itemId: value.item.id
|
|
4181
4185
|
}
|
|
4182
4186
|
}
|
|
@@ -4314,7 +4318,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4314
4318
|
}
|
|
4315
4319
|
}),
|
|
4316
4320
|
providerMetadata: {
|
|
4317
|
-
|
|
4321
|
+
[providerKey]: { itemId: value.item.id }
|
|
4318
4322
|
}
|
|
4319
4323
|
});
|
|
4320
4324
|
} else if (value.item.type === "reasoning") {
|
|
@@ -4329,7 +4333,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4329
4333
|
type: "reasoning-end",
|
|
4330
4334
|
id: `${value.item.id}:${summaryIndex}`,
|
|
4331
4335
|
providerMetadata: {
|
|
4332
|
-
|
|
4336
|
+
[providerKey]: {
|
|
4333
4337
|
itemId: value.item.id,
|
|
4334
4338
|
reasoningEncryptedContent: (_d = value.item.encrypted_content) != null ? _d : null
|
|
4335
4339
|
}
|
|
@@ -4419,7 +4423,9 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4419
4423
|
controller.enqueue({
|
|
4420
4424
|
type: "reasoning-end",
|
|
4421
4425
|
id: `${value.item_id}:${summaryIndex}`,
|
|
4422
|
-
providerMetadata: {
|
|
4426
|
+
providerMetadata: {
|
|
4427
|
+
[providerKey]: { itemId: value.item_id }
|
|
4428
|
+
}
|
|
4423
4429
|
});
|
|
4424
4430
|
activeReasoningPart.summaryParts[summaryIndex] = "concluded";
|
|
4425
4431
|
}
|
|
@@ -4428,7 +4434,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4428
4434
|
type: "reasoning-start",
|
|
4429
4435
|
id: `${value.item_id}:${value.summary_index}`,
|
|
4430
4436
|
providerMetadata: {
|
|
4431
|
-
|
|
4437
|
+
[providerKey]: {
|
|
4432
4438
|
itemId: value.item_id,
|
|
4433
4439
|
reasoningEncryptedContent: (_h = (_g = activeReasoning[value.item_id]) == null ? void 0 : _g.encryptedContent) != null ? _h : null
|
|
4434
4440
|
}
|
|
@@ -4441,7 +4447,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4441
4447
|
id: `${value.item_id}:${value.summary_index}`,
|
|
4442
4448
|
delta: value.delta,
|
|
4443
4449
|
providerMetadata: {
|
|
4444
|
-
|
|
4450
|
+
[providerKey]: {
|
|
4445
4451
|
itemId: value.item_id
|
|
4446
4452
|
}
|
|
4447
4453
|
}
|
|
@@ -4452,7 +4458,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4452
4458
|
type: "reasoning-end",
|
|
4453
4459
|
id: `${value.item_id}:${value.summary_index}`,
|
|
4454
4460
|
providerMetadata: {
|
|
4455
|
-
|
|
4461
|
+
[providerKey]: { itemId: value.item_id }
|
|
4456
4462
|
}
|
|
4457
4463
|
});
|
|
4458
4464
|
activeReasoning[value.item_id].summaryParts[value.summary_index] = "concluded";
|
|
@@ -4492,7 +4498,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4492
4498
|
filename: (_v = value.annotation.filename) != null ? _v : value.annotation.file_id,
|
|
4493
4499
|
...value.annotation.file_id ? {
|
|
4494
4500
|
providerMetadata: {
|
|
4495
|
-
|
|
4501
|
+
[providerKey]: {
|
|
4496
4502
|
fileId: value.annotation.file_id
|
|
4497
4503
|
}
|
|
4498
4504
|
}
|
|
@@ -4507,7 +4513,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4507
4513
|
title: (_A = (_z = value.annotation.filename) != null ? _z : value.annotation.file_id) != null ? _A : "Document",
|
|
4508
4514
|
filename: (_B = value.annotation.filename) != null ? _B : value.annotation.file_id,
|
|
4509
4515
|
providerMetadata: {
|
|
4510
|
-
|
|
4516
|
+
[providerKey]: {
|
|
4511
4517
|
fileId: value.annotation.file_id,
|
|
4512
4518
|
containerId: value.annotation.container_id,
|
|
4513
4519
|
...value.annotation.index != null ? { index: value.annotation.index } : {}
|
|
@@ -4523,7 +4529,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4523
4529
|
title: value.annotation.file_id,
|
|
4524
4530
|
filename: value.annotation.file_id,
|
|
4525
4531
|
providerMetadata: {
|
|
4526
|
-
|
|
4532
|
+
[providerKey]: {
|
|
4527
4533
|
fileId: value.annotation.file_id,
|
|
4528
4534
|
...value.annotation.index != null ? { index: value.annotation.index } : {}
|
|
4529
4535
|
}
|
|
@@ -4535,7 +4541,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4535
4541
|
type: "text-end",
|
|
4536
4542
|
id: value.item.id,
|
|
4537
4543
|
providerMetadata: {
|
|
4538
|
-
|
|
4544
|
+
[providerKey]: {
|
|
4539
4545
|
itemId: value.item.id,
|
|
4540
4546
|
...ongoingAnnotations.length > 0 && {
|
|
4541
4547
|
annotations: ongoingAnnotations
|
|
@@ -4549,15 +4555,15 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4549
4555
|
},
|
|
4550
4556
|
flush(controller) {
|
|
4551
4557
|
const providerMetadata = {
|
|
4552
|
-
|
|
4558
|
+
[providerKey]: {
|
|
4553
4559
|
responseId
|
|
4554
4560
|
}
|
|
4555
4561
|
};
|
|
4556
4562
|
if (logprobs.length > 0) {
|
|
4557
|
-
providerMetadata.
|
|
4563
|
+
providerMetadata[providerKey].logprobs = logprobs;
|
|
4558
4564
|
}
|
|
4559
4565
|
if (serviceTier !== void 0) {
|
|
4560
|
-
providerMetadata.
|
|
4566
|
+
providerMetadata[providerKey].serviceTier = serviceTier;
|
|
4561
4567
|
}
|
|
4562
4568
|
controller.enqueue({
|
|
4563
4569
|
type: "finish",
|
|
@@ -4989,7 +4995,7 @@ var OpenAITranscriptionModel = class {
|
|
|
4989
4995
|
};
|
|
4990
4996
|
|
|
4991
4997
|
// src/version.ts
|
|
4992
|
-
var VERSION = true ? "3.0.0-beta.
|
|
4998
|
+
var VERSION = true ? "3.0.0-beta.66" : "0.0.0-test";
|
|
4993
4999
|
|
|
4994
5000
|
// src/openai-provider.ts
|
|
4995
5001
|
function createOpenAI(options = {}) {
|