@ai-sdk/openai 2.0.59 → 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,17 @@
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
+
9
+ ## 2.0.60
10
+
11
+ ### Patch Changes
12
+
13
+ - 3e42838: fix: remove code for unsuported o1-mini and o1-preview models
14
+
3
15
  ## 2.0.59
4
16
 
5
17
  ### 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
@@ -1066,18 +1066,6 @@ function getSystemMessageMode(modelId) {
1066
1066
  return (_b = (_a = reasoningModels[modelId]) == null ? void 0 : _a.systemMessageMode) != null ? _b : "developer";
1067
1067
  }
1068
1068
  var reasoningModels = {
1069
- "o1-mini": {
1070
- systemMessageMode: "remove"
1071
- },
1072
- "o1-mini-2024-09-12": {
1073
- systemMessageMode: "remove"
1074
- },
1075
- "o1-preview": {
1076
- systemMessageMode: "remove"
1077
- },
1078
- "o1-preview-2024-09-12": {
1079
- systemMessageMode: "remove"
1080
- },
1081
1069
  o3: {
1082
1070
  systemMessageMode: "developer"
1083
1071
  },
@@ -1947,7 +1935,12 @@ var webSearchOutputSchema = (0, import_provider_utils18.lazySchema)(
1947
1935
  pattern: import_v413.z.string()
1948
1936
  })
1949
1937
  ]),
1950
- 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()
1951
1944
  })
1952
1945
  )
1953
1946
  );
@@ -2529,7 +2522,12 @@ var openaiResponsesChunkSchema = (0, import_provider_utils21.lazyValidator)(
2529
2522
  import_v416.z.object({
2530
2523
  type: import_v416.z.literal("search"),
2531
2524
  query: import_v416.z.string().nullish(),
2532
- 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()
2533
2531
  }),
2534
2532
  import_v416.z.object({
2535
2533
  type: import_v416.z.literal("open_page"),
@@ -2716,7 +2714,12 @@ var openaiResponsesResponseSchema = (0, import_provider_utils21.lazyValidator)(
2716
2714
  import_v416.z.object({
2717
2715
  type: import_v416.z.literal("search"),
2718
2716
  query: import_v416.z.string().nullish(),
2719
- 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()
2720
2723
  }),
2721
2724
  import_v416.z.object({
2722
2725
  type: import_v416.z.literal("open_page"),
@@ -4068,13 +4071,6 @@ function getResponsesModelConfig(modelId) {
4068
4071
  };
4069
4072
  }
4070
4073
  if (modelId.startsWith("o") || modelId.startsWith("gpt-5") || modelId.startsWith("codex-") || modelId.startsWith("computer-use")) {
4071
- if (modelId.startsWith("o1-mini") || modelId.startsWith("o1-preview")) {
4072
- return {
4073
- ...defaults,
4074
- isReasoningModel: true,
4075
- systemMessageMode: "remove"
4076
- };
4077
- }
4078
4074
  return {
4079
4075
  ...defaults,
4080
4076
  isReasoningModel: true,
@@ -4457,7 +4453,7 @@ var OpenAITranscriptionModel = class {
4457
4453
  };
4458
4454
 
4459
4455
  // src/version.ts
4460
- var VERSION = true ? "2.0.59" : "0.0.0-test";
4456
+ var VERSION = true ? "2.0.61" : "0.0.0-test";
4461
4457
 
4462
4458
  // src/openai-provider.ts
4463
4459
  function createOpenAI(options = {}) {