@ai-sdk/openai 4.0.0-canary.63 → 4.0.0-canary.65
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 +14 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +16 -9
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts +1 -0
- package/dist/internal/index.js +15 -8
- package/dist/internal/index.js.map +1 -1
- package/docs/03-openai.mdx +4 -4
- package/package.json +2 -2
- package/src/responses/convert-to-openai-responses-input.ts +7 -6
- package/src/responses/openai-responses-api.ts +2 -0
- package/src/responses/openai-responses-language-model.ts +5 -1
- package/src/tool/web-search.ts +8 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @ai-sdk/openai
|
|
2
2
|
|
|
3
|
+
## 4.0.0-canary.65
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- cd3de8b: feat(openai): forward `web_search_call.action.queries` from Responses API
|
|
8
|
+
|
|
9
|
+
## 4.0.0-canary.64
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [6c93e36]
|
|
14
|
+
- Updated dependencies [f617ac2]
|
|
15
|
+
- @ai-sdk/provider-utils@5.0.0-canary.44
|
|
16
|
+
|
|
3
17
|
## 4.0.0-canary.63
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -83,8 +83,14 @@ declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderExecutedToolF
|
|
|
83
83
|
type: "search";
|
|
84
84
|
/**
|
|
85
85
|
* The search query.
|
|
86
|
+
*
|
|
87
|
+
* @deprecated Use `queries` instead.
|
|
86
88
|
*/
|
|
87
89
|
query?: string;
|
|
90
|
+
/**
|
|
91
|
+
* The search queries the model used.
|
|
92
|
+
*/
|
|
93
|
+
queries?: string[];
|
|
88
94
|
} | {
|
|
89
95
|
/**
|
|
90
96
|
* Action type "openPage" - Opens a specific URL from search results.
|
|
@@ -433,6 +439,7 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
433
439
|
action?: {
|
|
434
440
|
type: "search";
|
|
435
441
|
query?: string | null | undefined;
|
|
442
|
+
queries?: string[] | null | undefined;
|
|
436
443
|
sources?: ({
|
|
437
444
|
type: "url";
|
|
438
445
|
url: string;
|
|
@@ -961,6 +968,7 @@ declare const openaiTools: {
|
|
|
961
968
|
action?: {
|
|
962
969
|
type: "search";
|
|
963
970
|
query?: string;
|
|
971
|
+
queries?: string[];
|
|
964
972
|
} | {
|
|
965
973
|
type: "openPage";
|
|
966
974
|
url?: string | null;
|
package/dist/index.js
CHANGED
|
@@ -2605,7 +2605,8 @@ var webSearchOutputSchema = lazySchema19(
|
|
|
2605
2605
|
action: z20.discriminatedUnion("type", [
|
|
2606
2606
|
z20.object({
|
|
2607
2607
|
type: z20.literal("search"),
|
|
2608
|
-
query: z20.string().optional()
|
|
2608
|
+
query: z20.string().optional(),
|
|
2609
|
+
queries: z20.array(z20.string()).optional()
|
|
2609
2610
|
}),
|
|
2610
2611
|
z20.object({
|
|
2611
2612
|
type: z20.literal("openPage"),
|
|
@@ -3072,9 +3073,9 @@ async function convertToOpenAIResponsesInput({
|
|
|
3072
3073
|
for (const part of content) {
|
|
3073
3074
|
switch (part.type) {
|
|
3074
3075
|
case "text": {
|
|
3075
|
-
const
|
|
3076
|
-
const id =
|
|
3077
|
-
const phase =
|
|
3076
|
+
const providerOptions = (_a = part.providerOptions) == null ? void 0 : _a[providerOptionsName];
|
|
3077
|
+
const id = providerOptions == null ? void 0 : providerOptions.itemId;
|
|
3078
|
+
const phase = providerOptions == null ? void 0 : providerOptions.phase;
|
|
3078
3079
|
if (hasConversation && id != null) {
|
|
3079
3080
|
break;
|
|
3080
3081
|
}
|
|
@@ -3343,8 +3344,8 @@ async function convertToOpenAIResponsesInput({
|
|
|
3343
3344
|
}
|
|
3344
3345
|
case "custom": {
|
|
3345
3346
|
if (part.kind === "openai.compaction") {
|
|
3346
|
-
const
|
|
3347
|
-
const id =
|
|
3347
|
+
const providerOptions = (_n = part.providerOptions) == null ? void 0 : _n[providerOptionsName];
|
|
3348
|
+
const id = providerOptions == null ? void 0 : providerOptions.itemId;
|
|
3348
3349
|
if (hasConversation && id != null) {
|
|
3349
3350
|
break;
|
|
3350
3351
|
}
|
|
@@ -3352,7 +3353,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3352
3353
|
input.push({ type: "item_reference", id });
|
|
3353
3354
|
break;
|
|
3354
3355
|
}
|
|
3355
|
-
const encryptedContent =
|
|
3356
|
+
const encryptedContent = providerOptions == null ? void 0 : providerOptions.encryptedContent;
|
|
3356
3357
|
if (id != null) {
|
|
3357
3358
|
input.push({
|
|
3358
3359
|
type: "compaction",
|
|
@@ -3932,6 +3933,7 @@ var openaiResponsesChunkSchema = lazySchema22(
|
|
|
3932
3933
|
z24.object({
|
|
3933
3934
|
type: z24.literal("search"),
|
|
3934
3935
|
query: z24.string().nullish(),
|
|
3936
|
+
queries: z24.array(z24.string()).nullish(),
|
|
3935
3937
|
sources: z24.array(
|
|
3936
3938
|
z24.discriminatedUnion("type", [
|
|
3937
3939
|
z24.object({ type: z24.literal("url"), url: z24.string() }),
|
|
@@ -4289,6 +4291,7 @@ var openaiResponsesResponseSchema = lazySchema22(
|
|
|
4289
4291
|
z24.object({
|
|
4290
4292
|
type: z24.literal("search"),
|
|
4291
4293
|
query: z24.string().nullish(),
|
|
4294
|
+
queries: z24.array(z24.string()).nullish(),
|
|
4292
4295
|
sources: z24.array(
|
|
4293
4296
|
z24.discriminatedUnion("type", [
|
|
4294
4297
|
z24.object({ type: z24.literal("url"), url: z24.string() }),
|
|
@@ -6808,7 +6811,11 @@ function mapWebSearchOutput(action) {
|
|
|
6808
6811
|
switch (action.type) {
|
|
6809
6812
|
case "search":
|
|
6810
6813
|
return {
|
|
6811
|
-
action: {
|
|
6814
|
+
action: {
|
|
6815
|
+
type: "search",
|
|
6816
|
+
query: (_a = action.query) != null ? _a : void 0,
|
|
6817
|
+
...action.queries != null && { queries: action.queries }
|
|
6818
|
+
},
|
|
6812
6819
|
// include sources when provided by the Responses API (behind include flag)
|
|
6813
6820
|
...action.sources != null && { sources: action.sources }
|
|
6814
6821
|
};
|
|
@@ -7313,7 +7320,7 @@ var OpenAISkills = class {
|
|
|
7313
7320
|
};
|
|
7314
7321
|
|
|
7315
7322
|
// src/version.ts
|
|
7316
|
-
var VERSION = true ? "4.0.0-canary.
|
|
7323
|
+
var VERSION = true ? "4.0.0-canary.65" : "0.0.0-test";
|
|
7317
7324
|
|
|
7318
7325
|
// src/openai-provider.ts
|
|
7319
7326
|
function createOpenAI(options = {}) {
|