@ai-sdk/openai 3.0.0-beta.36 → 3.0.0-beta.37

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
+ ## 3.0.0-beta.37
4
+
5
+ ### Patch Changes
6
+
7
+ - e85fa2f: feat(openai): add sources in web-search actions
8
+
3
9
  ## 3.0.0-beta.36
4
10
 
5
11
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -65,6 +65,13 @@ declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderDefinedToolFa
65
65
  */
66
66
  pattern: string;
67
67
  };
68
+ /**
69
+ * Optional sources cited by the model for the web search call.
70
+ */
71
+ sources?: {
72
+ type: "url";
73
+ url: string;
74
+ }[];
68
75
  }, {
69
76
  /**
70
77
  * Filters for the search.
@@ -308,6 +315,10 @@ declare const openaiTools: {
308
315
  url: string;
309
316
  pattern: string;
310
317
  };
318
+ sources?: {
319
+ type: "url";
320
+ url: string;
321
+ }[];
311
322
  }>;
312
323
  };
313
324
 
package/dist/index.d.ts CHANGED
@@ -65,6 +65,13 @@ declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderDefinedToolFa
65
65
  */
66
66
  pattern: string;
67
67
  };
68
+ /**
69
+ * Optional sources cited by the model for the web search call.
70
+ */
71
+ sources?: {
72
+ type: "url";
73
+ url: string;
74
+ }[];
68
75
  }, {
69
76
  /**
70
77
  * Filters for the search.
@@ -308,6 +315,10 @@ declare const openaiTools: {
308
315
  url: string;
309
316
  pattern: string;
310
317
  };
318
+ sources?: {
319
+ type: "url";
320
+ url: string;
321
+ }[];
311
322
  }>;
312
323
  };
313
324
 
package/dist/index.js CHANGED
@@ -1950,7 +1950,8 @@ var webSearchOutputSchema = (0, import_provider_utils18.lazySchema)(
1950
1950
  url: import_v413.z.string(),
1951
1951
  pattern: import_v413.z.string()
1952
1952
  })
1953
- ])
1953
+ ]),
1954
+ sources: import_v413.z.array(import_v413.z.object({ type: import_v413.z.literal("url"), url: import_v413.z.string() })).optional()
1954
1955
  })
1955
1956
  )
1956
1957
  );
@@ -2550,7 +2551,8 @@ var openaiResponsesChunkSchema = (0, import_provider_utils21.lazySchema)(
2550
2551
  action: import_v416.z.discriminatedUnion("type", [
2551
2552
  import_v416.z.object({
2552
2553
  type: import_v416.z.literal("search"),
2553
- query: import_v416.z.string().nullish()
2554
+ query: import_v416.z.string().nullish(),
2555
+ sources: import_v416.z.array(import_v416.z.object({ type: import_v416.z.literal("url"), url: import_v416.z.string() })).nullish()
2554
2556
  }),
2555
2557
  import_v416.z.object({
2556
2558
  type: import_v416.z.literal("open_page"),
@@ -2736,7 +2738,8 @@ var openaiResponsesResponseSchema = (0, import_provider_utils21.lazySchema)(
2736
2738
  action: import_v416.z.discriminatedUnion("type", [
2737
2739
  import_v416.z.object({
2738
2740
  type: import_v416.z.literal("search"),
2739
- query: import_v416.z.string().nullish()
2741
+ query: import_v416.z.string().nullish(),
2742
+ sources: import_v416.z.array(import_v416.z.object({ type: import_v416.z.literal("url"), url: import_v416.z.string() })).nullish()
2740
2743
  }),
2741
2744
  import_v416.z.object({
2742
2745
  type: import_v416.z.literal("open_page"),
@@ -4111,7 +4114,11 @@ function mapWebSearchOutput(action) {
4111
4114
  var _a;
4112
4115
  switch (action.type) {
4113
4116
  case "search":
4114
- return { action: { type: "search", query: (_a = action.query) != null ? _a : void 0 } };
4117
+ return {
4118
+ action: { type: "search", query: (_a = action.query) != null ? _a : void 0 },
4119
+ // include sources when provided by the Responses API (behind include flag)
4120
+ ...action.sources != null && { sources: action.sources }
4121
+ };
4115
4122
  case "open_page":
4116
4123
  return { action: { type: "openPage", url: action.url } };
4117
4124
  case "find":
@@ -4474,7 +4481,7 @@ var OpenAITranscriptionModel = class {
4474
4481
  };
4475
4482
 
4476
4483
  // src/version.ts
4477
- var VERSION = true ? "3.0.0-beta.36" : "0.0.0-test";
4484
+ var VERSION = true ? "3.0.0-beta.37" : "0.0.0-test";
4478
4485
 
4479
4486
  // src/openai-provider.ts
4480
4487
  function createOpenAI(options = {}) {