@ai-sdk/openai 2.0.60 → 2.0.61

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.61
4
+
5
+ ### Patch Changes
6
+
7
+ - 28ce89a: fix(openai): add support for sources type 'api'
8
+
3
9
  ## 2.0.60
4
10
 
5
11
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -68,10 +68,13 @@ declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderDefinedToolFa
68
68
  /**
69
69
  * Optional sources cited by the model for the web search call.
70
70
  */
71
- sources?: {
71
+ sources?: Array<{
72
72
  type: "url";
73
73
  url: string;
74
- }[];
74
+ } | {
75
+ type: "api";
76
+ name: string;
77
+ }>;
75
78
  }, {
76
79
  /**
77
80
  * Filters for the search.
@@ -309,10 +312,13 @@ declare const openaiTools: {
309
312
  url: string;
310
313
  pattern: string;
311
314
  };
312
- sources?: {
315
+ sources?: Array<{
313
316
  type: "url";
314
317
  url: string;
315
- }[];
318
+ } | {
319
+ type: "api";
320
+ name: string;
321
+ }>;
316
322
  }>;
317
323
  };
318
324
 
package/dist/index.d.ts CHANGED
@@ -68,10 +68,13 @@ declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderDefinedToolFa
68
68
  /**
69
69
  * Optional sources cited by the model for the web search call.
70
70
  */
71
- sources?: {
71
+ sources?: Array<{
72
72
  type: "url";
73
73
  url: string;
74
- }[];
74
+ } | {
75
+ type: "api";
76
+ name: string;
77
+ }>;
75
78
  }, {
76
79
  /**
77
80
  * Filters for the search.
@@ -309,10 +312,13 @@ declare const openaiTools: {
309
312
  url: string;
310
313
  pattern: string;
311
314
  };
312
- sources?: {
315
+ sources?: Array<{
313
316
  type: "url";
314
317
  url: string;
315
- }[];
318
+ } | {
319
+ type: "api";
320
+ name: string;
321
+ }>;
316
322
  }>;
317
323
  };
318
324
 
package/dist/index.js CHANGED
@@ -1935,7 +1935,12 @@ var webSearchOutputSchema = (0, import_provider_utils18.lazySchema)(
1935
1935
  pattern: import_v413.z.string()
1936
1936
  })
1937
1937
  ]),
1938
- sources: import_v413.z.array(import_v413.z.object({ type: import_v413.z.literal("url"), url: import_v413.z.string() })).optional()
1938
+ sources: import_v413.z.array(
1939
+ import_v413.z.discriminatedUnion("type", [
1940
+ import_v413.z.object({ type: import_v413.z.literal("url"), url: import_v413.z.string() }),
1941
+ import_v413.z.object({ type: import_v413.z.literal("api"), name: import_v413.z.string() })
1942
+ ])
1943
+ ).optional()
1939
1944
  })
1940
1945
  )
1941
1946
  );
@@ -2517,7 +2522,12 @@ var openaiResponsesChunkSchema = (0, import_provider_utils21.lazyValidator)(
2517
2522
  import_v416.z.object({
2518
2523
  type: import_v416.z.literal("search"),
2519
2524
  query: import_v416.z.string().nullish(),
2520
- sources: import_v416.z.array(import_v416.z.object({ type: import_v416.z.literal("url"), url: import_v416.z.string() })).nullish()
2525
+ sources: import_v416.z.array(
2526
+ import_v416.z.discriminatedUnion("type", [
2527
+ import_v416.z.object({ type: import_v416.z.literal("url"), url: import_v416.z.string() }),
2528
+ import_v416.z.object({ type: import_v416.z.literal("api"), name: import_v416.z.string() })
2529
+ ])
2530
+ ).nullish()
2521
2531
  }),
2522
2532
  import_v416.z.object({
2523
2533
  type: import_v416.z.literal("open_page"),
@@ -2704,7 +2714,12 @@ var openaiResponsesResponseSchema = (0, import_provider_utils21.lazyValidator)(
2704
2714
  import_v416.z.object({
2705
2715
  type: import_v416.z.literal("search"),
2706
2716
  query: import_v416.z.string().nullish(),
2707
- sources: import_v416.z.array(import_v416.z.object({ type: import_v416.z.literal("url"), url: import_v416.z.string() })).nullish()
2717
+ sources: import_v416.z.array(
2718
+ import_v416.z.discriminatedUnion("type", [
2719
+ import_v416.z.object({ type: import_v416.z.literal("url"), url: import_v416.z.string() }),
2720
+ import_v416.z.object({ type: import_v416.z.literal("api"), name: import_v416.z.string() })
2721
+ ])
2722
+ ).nullish()
2708
2723
  }),
2709
2724
  import_v416.z.object({
2710
2725
  type: import_v416.z.literal("open_page"),
@@ -4438,7 +4453,7 @@ var OpenAITranscriptionModel = class {
4438
4453
  };
4439
4454
 
4440
4455
  // src/version.ts
4441
- var VERSION = true ? "2.0.60" : "0.0.0-test";
4456
+ var VERSION = true ? "2.0.61" : "0.0.0-test";
4442
4457
 
4443
4458
  // src/openai-provider.ts
4444
4459
  function createOpenAI(options = {}) {