@ai-sdk/openai 2.0.92 → 2.0.93

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @ai-sdk/openai
2
2
 
3
+ ## 2.0.93
4
+
5
+ ### Patch Changes
6
+
7
+ - fa64d70: fix(openai): change web search tool action to be optional
8
+
3
9
  ## 2.0.92
4
10
 
5
11
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -34,7 +34,7 @@ declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderDefinedToolFa
34
34
  * An object describing the specific action taken in this web search call.
35
35
  * Includes details on how the model used the web (search, open_page, findInPage).
36
36
  */
37
- action: {
37
+ action?: {
38
38
  /**
39
39
  * Action type "search" - Performs a web search query.
40
40
  */
@@ -276,7 +276,7 @@ declare const openaiTools: {
276
276
  * @deprecated Use `webSearch` instead.
277
277
  */
278
278
  webSearchPreview: _ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<{}, {
279
- action: {
279
+ action?: {
280
280
  type: "search";
281
281
  query?: string;
282
282
  } | {
@@ -308,7 +308,7 @@ declare const openaiTools: {
308
308
  * @param userLocation - The user location to use for the web search.
309
309
  */
310
310
  webSearch: (args?: Parameters<typeof webSearchToolFactory>[0]) => _ai_sdk_provider_utils.Tool<{}, {
311
- action: {
311
+ action?: {
312
312
  type: "search";
313
313
  query?: string;
314
314
  } | {
package/dist/index.d.ts CHANGED
@@ -34,7 +34,7 @@ declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderDefinedToolFa
34
34
  * An object describing the specific action taken in this web search call.
35
35
  * Includes details on how the model used the web (search, open_page, findInPage).
36
36
  */
37
- action: {
37
+ action?: {
38
38
  /**
39
39
  * Action type "search" - Performs a web search query.
40
40
  */
@@ -276,7 +276,7 @@ declare const openaiTools: {
276
276
  * @deprecated Use `webSearch` instead.
277
277
  */
278
278
  webSearchPreview: _ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<{}, {
279
- action: {
279
+ action?: {
280
280
  type: "search";
281
281
  query?: string;
282
282
  } | {
@@ -308,7 +308,7 @@ declare const openaiTools: {
308
308
  * @param userLocation - The user location to use for the web search.
309
309
  */
310
310
  webSearch: (args?: Parameters<typeof webSearchToolFactory>[0]) => _ai_sdk_provider_utils.Tool<{}, {
311
- action: {
311
+ action?: {
312
312
  type: "search";
313
313
  query?: string;
314
314
  } | {
package/dist/index.js CHANGED
@@ -1987,7 +1987,7 @@ var webSearchOutputSchema = (0, import_provider_utils18.lazySchema)(
1987
1987
  url: import_v413.z.string().nullish(),
1988
1988
  pattern: import_v413.z.string().nullish()
1989
1989
  })
1990
- ]),
1990
+ ]).optional(),
1991
1991
  sources: import_v413.z.array(
1992
1992
  import_v413.z.discriminatedUnion("type", [
1993
1993
  import_v413.z.object({ type: import_v413.z.literal("url"), url: import_v413.z.string() }),
@@ -2042,7 +2042,7 @@ var webSearchPreviewOutputSchema = (0, import_provider_utils19.lazySchema)(
2042
2042
  url: import_v414.z.string().nullish(),
2043
2043
  pattern: import_v414.z.string().nullish()
2044
2044
  })
2045
- ])
2045
+ ]).optional()
2046
2046
  })
2047
2047
  )
2048
2048
  );
@@ -2591,7 +2591,7 @@ var openaiResponsesChunkSchema = (0, import_provider_utils21.lazyValidator)(
2591
2591
  url: import_v416.z.string().nullish(),
2592
2592
  pattern: import_v416.z.string().nullish()
2593
2593
  })
2594
- ])
2594
+ ]).nullish()
2595
2595
  }),
2596
2596
  import_v416.z.object({
2597
2597
  type: import_v416.z.literal("file_search_call"),
@@ -2788,7 +2788,10 @@ var openaiResponsesResponseSchema = (0, import_provider_utils21.lazyValidator)(
2788
2788
  sources: import_v416.z.array(
2789
2789
  import_v416.z.discriminatedUnion("type", [
2790
2790
  import_v416.z.object({ type: import_v416.z.literal("url"), url: import_v416.z.string() }),
2791
- import_v416.z.object({ type: import_v416.z.literal("api"), name: import_v416.z.string() })
2791
+ import_v416.z.object({
2792
+ type: import_v416.z.literal("api"),
2793
+ name: import_v416.z.string()
2794
+ })
2792
2795
  ])
2793
2796
  ).nullish()
2794
2797
  }),
@@ -2801,7 +2804,7 @@ var openaiResponsesResponseSchema = (0, import_provider_utils21.lazyValidator)(
2801
2804
  url: import_v416.z.string().nullish(),
2802
2805
  pattern: import_v416.z.string().nullish()
2803
2806
  })
2804
- ])
2807
+ ]).nullish()
2805
2808
  }),
2806
2809
  import_v416.z.object({
2807
2810
  type: import_v416.z.literal("file_search_call"),
@@ -4225,6 +4228,9 @@ function isErrorChunk(chunk) {
4225
4228
  }
4226
4229
  function mapWebSearchOutput(action) {
4227
4230
  var _a;
4231
+ if (action == null) {
4232
+ return {};
4233
+ }
4228
4234
  switch (action.type) {
4229
4235
  case "search":
4230
4236
  return {
@@ -4598,7 +4604,7 @@ var OpenAITranscriptionModel = class {
4598
4604
  };
4599
4605
 
4600
4606
  // src/version.ts
4601
- var VERSION = true ? "2.0.92" : "0.0.0-test";
4607
+ var VERSION = true ? "2.0.93" : "0.0.0-test";
4602
4608
 
4603
4609
  // src/openai-provider.ts
4604
4610
  function createOpenAI(options = {}) {