@ai-sdk/openai 3.0.0-beta.47 → 3.0.0-beta.49

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
+ ## 3.0.0-beta.49
4
+
5
+ ### Patch Changes
6
+
7
+ - 0273b74: fix(openai): add support for sources type 'api'
8
+
9
+ ## 3.0.0-beta.48
10
+
11
+ ### Patch Changes
12
+
13
+ - 60f4775: fix: remove code for unsuported o1-mini and o1-preview models
14
+
3
15
  ## 3.0.0-beta.47
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.
@@ -315,10 +318,13 @@ declare const openaiTools: {
315
318
  url: string;
316
319
  pattern: string;
317
320
  };
318
- sources?: {
321
+ sources?: Array<{
319
322
  type: "url";
320
323
  url: string;
321
- }[];
324
+ } | {
325
+ type: "api";
326
+ name: string;
327
+ }>;
322
328
  }>;
323
329
  };
324
330
 
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.
@@ -315,10 +318,13 @@ declare const openaiTools: {
315
318
  url: string;
316
319
  pattern: string;
317
320
  };
318
- sources?: {
321
+ sources?: Array<{
319
322
  type: "url";
320
323
  url: string;
321
- }[];
324
+ } | {
325
+ type: "api";
326
+ name: string;
327
+ }>;
322
328
  }>;
323
329
  };
324
330
 
package/dist/index.js CHANGED
@@ -1070,18 +1070,6 @@ function getSystemMessageMode(modelId) {
1070
1070
  return (_b = (_a = reasoningModels[modelId]) == null ? void 0 : _a.systemMessageMode) != null ? _b : "developer";
1071
1071
  }
1072
1072
  var reasoningModels = {
1073
- "o1-mini": {
1074
- systemMessageMode: "remove"
1075
- },
1076
- "o1-mini-2024-09-12": {
1077
- systemMessageMode: "remove"
1078
- },
1079
- "o1-preview": {
1080
- systemMessageMode: "remove"
1081
- },
1082
- "o1-preview-2024-09-12": {
1083
- systemMessageMode: "remove"
1084
- },
1085
1073
  o3: {
1086
1074
  systemMessageMode: "developer"
1087
1075
  },
@@ -1951,7 +1939,12 @@ var webSearchOutputSchema = (0, import_provider_utils18.lazySchema)(
1951
1939
  pattern: import_v413.z.string()
1952
1940
  })
1953
1941
  ]),
1954
- sources: import_v413.z.array(import_v413.z.object({ type: import_v413.z.literal("url"), url: import_v413.z.string() })).optional()
1942
+ sources: import_v413.z.array(
1943
+ import_v413.z.discriminatedUnion("type", [
1944
+ import_v413.z.object({ type: import_v413.z.literal("url"), url: import_v413.z.string() }),
1945
+ import_v413.z.object({ type: import_v413.z.literal("api"), name: import_v413.z.string() })
1946
+ ])
1947
+ ).optional()
1955
1948
  })
1956
1949
  )
1957
1950
  );
@@ -2552,7 +2545,12 @@ var openaiResponsesChunkSchema = (0, import_provider_utils21.lazySchema)(
2552
2545
  import_v416.z.object({
2553
2546
  type: import_v416.z.literal("search"),
2554
2547
  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()
2548
+ sources: import_v416.z.array(
2549
+ import_v416.z.discriminatedUnion("type", [
2550
+ import_v416.z.object({ type: import_v416.z.literal("url"), url: import_v416.z.string() }),
2551
+ import_v416.z.object({ type: import_v416.z.literal("api"), name: import_v416.z.string() })
2552
+ ])
2553
+ ).nullish()
2556
2554
  }),
2557
2555
  import_v416.z.object({
2558
2556
  type: import_v416.z.literal("open_page"),
@@ -2739,7 +2737,12 @@ var openaiResponsesResponseSchema = (0, import_provider_utils21.lazySchema)(
2739
2737
  import_v416.z.object({
2740
2738
  type: import_v416.z.literal("search"),
2741
2739
  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
+ sources: import_v416.z.array(
2741
+ import_v416.z.discriminatedUnion("type", [
2742
+ import_v416.z.object({ type: import_v416.z.literal("url"), url: import_v416.z.string() }),
2743
+ import_v416.z.object({ type: import_v416.z.literal("api"), name: import_v416.z.string() })
2744
+ ])
2745
+ ).nullish()
2743
2746
  }),
2744
2747
  import_v416.z.object({
2745
2748
  type: import_v416.z.literal("open_page"),
@@ -4095,13 +4098,6 @@ function getResponsesModelConfig(modelId) {
4095
4098
  };
4096
4099
  }
4097
4100
  if (modelId.startsWith("o") || modelId.startsWith("gpt-5") || modelId.startsWith("codex-") || modelId.startsWith("computer-use")) {
4098
- if (modelId.startsWith("o1-mini") || modelId.startsWith("o1-preview")) {
4099
- return {
4100
- ...defaults,
4101
- isReasoningModel: true,
4102
- systemMessageMode: "remove"
4103
- };
4104
- }
4105
4101
  return {
4106
4102
  ...defaults,
4107
4103
  isReasoningModel: true,
@@ -4484,7 +4480,7 @@ var OpenAITranscriptionModel = class {
4484
4480
  };
4485
4481
 
4486
4482
  // src/version.ts
4487
- var VERSION = true ? "3.0.0-beta.47" : "0.0.0-test";
4483
+ var VERSION = true ? "3.0.0-beta.49" : "0.0.0-test";
4488
4484
 
4489
4485
  // src/openai-provider.ts
4490
4486
  function createOpenAI(options = {}) {