@ai-sdk/openai 2.0.75 → 2.0.77

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,17 @@
1
1
  # @ai-sdk/openai
2
2
 
3
+ ## 2.0.77
4
+
5
+ ### Patch Changes
6
+
7
+ - 31f6c20: fix(openai): allow open_page action type url to be nullish
8
+
9
+ ## 2.0.76
10
+
11
+ ### Patch Changes
12
+
13
+ - 61545c4: feat (provider/openai): include more image generation response metadata
14
+
3
15
  ## 2.0.75
4
16
 
5
17
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -51,7 +51,7 @@ declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderDefinedToolFa
51
51
  /**
52
52
  * The URL opened by the model.
53
53
  */
54
- url: string;
54
+ url?: string | null;
55
55
  } | {
56
56
  /**
57
57
  * Action type "find": Searches for a pattern within a loaded page.
@@ -60,11 +60,11 @@ declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderDefinedToolFa
60
60
  /**
61
61
  * The URL of the page searched for the pattern.
62
62
  */
63
- url: string;
63
+ url?: string | null;
64
64
  /**
65
65
  * The pattern or text to search for within the page.
66
66
  */
67
- pattern: string;
67
+ pattern?: string | null;
68
68
  };
69
69
  /**
70
70
  * Optional sources cited by the model for the web search call.
@@ -281,11 +281,11 @@ declare const openaiTools: {
281
281
  query?: string;
282
282
  } | {
283
283
  type: "openPage";
284
- url: string;
284
+ url?: string | null;
285
285
  } | {
286
286
  type: "find";
287
- url: string;
288
- pattern: string;
287
+ url?: string | null;
288
+ pattern?: string | null;
289
289
  };
290
290
  }, {
291
291
  searchContextSize?: "low" | "medium" | "high";
@@ -313,11 +313,11 @@ declare const openaiTools: {
313
313
  query?: string;
314
314
  } | {
315
315
  type: "openPage";
316
- url: string;
316
+ url?: string | null;
317
317
  } | {
318
318
  type: "find";
319
- url: string;
320
- pattern: string;
319
+ url?: string | null;
320
+ pattern?: string | null;
321
321
  };
322
322
  sources?: Array<{
323
323
  type: "url";
package/dist/index.d.ts CHANGED
@@ -51,7 +51,7 @@ declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderDefinedToolFa
51
51
  /**
52
52
  * The URL opened by the model.
53
53
  */
54
- url: string;
54
+ url?: string | null;
55
55
  } | {
56
56
  /**
57
57
  * Action type "find": Searches for a pattern within a loaded page.
@@ -60,11 +60,11 @@ declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderDefinedToolFa
60
60
  /**
61
61
  * The URL of the page searched for the pattern.
62
62
  */
63
- url: string;
63
+ url?: string | null;
64
64
  /**
65
65
  * The pattern or text to search for within the page.
66
66
  */
67
- pattern: string;
67
+ pattern?: string | null;
68
68
  };
69
69
  /**
70
70
  * Optional sources cited by the model for the web search call.
@@ -281,11 +281,11 @@ declare const openaiTools: {
281
281
  query?: string;
282
282
  } | {
283
283
  type: "openPage";
284
- url: string;
284
+ url?: string | null;
285
285
  } | {
286
286
  type: "find";
287
- url: string;
288
- pattern: string;
287
+ url?: string | null;
288
+ pattern?: string | null;
289
289
  };
290
290
  }, {
291
291
  searchContextSize?: "low" | "medium" | "high";
@@ -313,11 +313,11 @@ declare const openaiTools: {
313
313
  query?: string;
314
314
  } | {
315
315
  type: "openPage";
316
- url: string;
316
+ url?: string | null;
317
317
  } | {
318
318
  type: "find";
319
- url: string;
320
- pattern: string;
319
+ url?: string | null;
320
+ pattern?: string | null;
321
321
  };
322
322
  sources?: Array<{
323
323
  type: "url";
package/dist/index.js CHANGED
@@ -1652,12 +1652,26 @@ var import_v48 = require("zod/v4");
1652
1652
  var openaiImageResponseSchema = (0, import_provider_utils12.lazyValidator)(
1653
1653
  () => (0, import_provider_utils12.zodSchema)(
1654
1654
  import_v48.z.object({
1655
+ created: import_v48.z.number().nullish(),
1655
1656
  data: import_v48.z.array(
1656
1657
  import_v48.z.object({
1657
1658
  b64_json: import_v48.z.string(),
1658
1659
  revised_prompt: import_v48.z.string().nullish()
1659
1660
  })
1660
- )
1661
+ ),
1662
+ background: import_v48.z.string().nullish(),
1663
+ output_format: import_v48.z.string().nullish(),
1664
+ size: import_v48.z.string().nullish(),
1665
+ quality: import_v48.z.string().nullish(),
1666
+ usage: import_v48.z.object({
1667
+ input_tokens: import_v48.z.number().nullish(),
1668
+ output_tokens: import_v48.z.number().nullish(),
1669
+ total_tokens: import_v48.z.number().nullish(),
1670
+ input_tokens_details: import_v48.z.object({
1671
+ image_tokens: import_v48.z.number().nullish(),
1672
+ text_tokens: import_v48.z.number().nullish()
1673
+ }).nullish()
1674
+ }).nullish()
1661
1675
  })
1662
1676
  )
1663
1677
  );
@@ -1742,11 +1756,14 @@ var OpenAIImageModel = class {
1742
1756
  },
1743
1757
  providerMetadata: {
1744
1758
  openai: {
1745
- images: response.data.map(
1746
- (item) => item.revised_prompt ? {
1747
- revisedPrompt: item.revised_prompt
1748
- } : null
1749
- )
1759
+ images: response.data.map((item) => ({
1760
+ ...item.revised_prompt ? { revisedPrompt: item.revised_prompt } : {},
1761
+ ...response.created != null ? { created: response.created } : {},
1762
+ ...response.size != null ? { size: response.size } : {},
1763
+ ...response.quality != null ? { quality: response.quality } : {},
1764
+ ...response.background != null ? { background: response.background } : {},
1765
+ ...response.output_format != null ? { outputFormat: response.output_format } : {}
1766
+ }))
1750
1767
  }
1751
1768
  }
1752
1769
  };
@@ -1941,12 +1958,12 @@ var webSearchOutputSchema = (0, import_provider_utils18.lazySchema)(
1941
1958
  }),
1942
1959
  import_v413.z.object({
1943
1960
  type: import_v413.z.literal("openPage"),
1944
- url: import_v413.z.string()
1961
+ url: import_v413.z.string().nullish()
1945
1962
  }),
1946
1963
  import_v413.z.object({
1947
1964
  type: import_v413.z.literal("find"),
1948
- url: import_v413.z.string(),
1949
- pattern: import_v413.z.string()
1965
+ url: import_v413.z.string().nullish(),
1966
+ pattern: import_v413.z.string().nullish()
1950
1967
  })
1951
1968
  ]),
1952
1969
  sources: import_v413.z.array(
@@ -1996,12 +2013,12 @@ var webSearchPreviewOutputSchema = (0, import_provider_utils19.lazySchema)(
1996
2013
  }),
1997
2014
  import_v414.z.object({
1998
2015
  type: import_v414.z.literal("openPage"),
1999
- url: import_v414.z.string()
2016
+ url: import_v414.z.string().nullish()
2000
2017
  }),
2001
2018
  import_v414.z.object({
2002
2019
  type: import_v414.z.literal("find"),
2003
- url: import_v414.z.string(),
2004
- pattern: import_v414.z.string()
2020
+ url: import_v414.z.string().nullish(),
2021
+ pattern: import_v414.z.string().nullish()
2005
2022
  })
2006
2023
  ])
2007
2024
  })
@@ -2545,12 +2562,12 @@ var openaiResponsesChunkSchema = (0, import_provider_utils21.lazyValidator)(
2545
2562
  }),
2546
2563
  import_v416.z.object({
2547
2564
  type: import_v416.z.literal("open_page"),
2548
- url: import_v416.z.string()
2565
+ url: import_v416.z.string().nullish()
2549
2566
  }),
2550
2567
  import_v416.z.object({
2551
2568
  type: import_v416.z.literal("find"),
2552
- url: import_v416.z.string(),
2553
- pattern: import_v416.z.string()
2569
+ url: import_v416.z.string().nullish(),
2570
+ pattern: import_v416.z.string().nullish()
2554
2571
  })
2555
2572
  ])
2556
2573
  }),
@@ -2755,12 +2772,12 @@ var openaiResponsesResponseSchema = (0, import_provider_utils21.lazyValidator)(
2755
2772
  }),
2756
2773
  import_v416.z.object({
2757
2774
  type: import_v416.z.literal("open_page"),
2758
- url: import_v416.z.string()
2775
+ url: import_v416.z.string().nullish()
2759
2776
  }),
2760
2777
  import_v416.z.object({
2761
2778
  type: import_v416.z.literal("find"),
2762
- url: import_v416.z.string(),
2763
- pattern: import_v416.z.string()
2779
+ url: import_v416.z.string().nullish(),
2780
+ pattern: import_v416.z.string().nullish()
2764
2781
  })
2765
2782
  ])
2766
2783
  }),
@@ -4565,7 +4582,7 @@ var OpenAITranscriptionModel = class {
4565
4582
  };
4566
4583
 
4567
4584
  // src/version.ts
4568
- var VERSION = true ? "2.0.75" : "0.0.0-test";
4585
+ var VERSION = true ? "2.0.77" : "0.0.0-test";
4569
4586
 
4570
4587
  // src/openai-provider.ts
4571
4588
  function createOpenAI(options = {}) {