@ai-sdk/openai 3.0.0-beta.27 → 3.0.0-beta.28

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/dist/index.mjs CHANGED
@@ -1943,7 +1943,7 @@ var localShell = createProviderDefinedToolFactoryWithOutputSchema4({
1943
1943
 
1944
1944
  // src/tool/web-search.ts
1945
1945
  import {
1946
- createProviderDefinedToolFactory,
1946
+ createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema5,
1947
1947
  lazySchema as lazySchema12,
1948
1948
  zodSchema as zodSchema12
1949
1949
  } from "@ai-sdk/provider-utils";
@@ -1951,9 +1951,7 @@ import { z as z13 } from "zod/v4";
1951
1951
  var webSearchArgsSchema = lazySchema12(
1952
1952
  () => zodSchema12(
1953
1953
  z13.object({
1954
- filters: z13.object({
1955
- allowedDomains: z13.array(z13.string()).optional()
1956
- }).optional(),
1954
+ filters: z13.object({ allowedDomains: z13.array(z13.string()).optional() }).optional(),
1957
1955
  searchContextSize: z13.enum(["low", "medium", "high"]).optional(),
1958
1956
  userLocation: z13.object({
1959
1957
  type: z13.literal("approximate"),
@@ -1965,16 +1963,17 @@ var webSearchArgsSchema = lazySchema12(
1965
1963
  })
1966
1964
  )
1967
1965
  );
1968
- var webSearchInputSchema = lazySchema12(
1966
+ var webSearchInputSchema = lazySchema12(() => zodSchema12(z13.object({})));
1967
+ var webSearchOutputSchema = lazySchema12(
1969
1968
  () => zodSchema12(
1970
1969
  z13.object({
1971
1970
  action: z13.discriminatedUnion("type", [
1972
1971
  z13.object({
1973
1972
  type: z13.literal("search"),
1974
- query: z13.string().nullish()
1973
+ query: z13.string().optional()
1975
1974
  }),
1976
1975
  z13.object({
1977
- type: z13.literal("open_page"),
1976
+ type: z13.literal("openPage"),
1978
1977
  url: z13.string()
1979
1978
  }),
1980
1979
  z13.object({
@@ -1982,22 +1981,21 @@ var webSearchInputSchema = lazySchema12(
1982
1981
  url: z13.string(),
1983
1982
  pattern: z13.string()
1984
1983
  })
1985
- ]).nullish()
1984
+ ])
1986
1985
  })
1987
1986
  )
1988
1987
  );
1989
- var webSearchToolFactory = createProviderDefinedToolFactory({
1988
+ var webSearchToolFactory = createProviderDefinedToolFactoryWithOutputSchema5({
1990
1989
  id: "openai.web_search",
1991
1990
  name: "web_search",
1992
- inputSchema: webSearchInputSchema
1991
+ inputSchema: webSearchInputSchema,
1992
+ outputSchema: webSearchOutputSchema
1993
1993
  });
1994
- var webSearch = (args = {}) => {
1995
- return webSearchToolFactory(args);
1996
- };
1994
+ var webSearch = (args = {}) => webSearchToolFactory(args);
1997
1995
 
1998
1996
  // src/tool/web-search-preview.ts
1999
1997
  import {
2000
- createProviderDefinedToolFactory as createProviderDefinedToolFactory2,
1998
+ createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema6,
2001
1999
  lazySchema as lazySchema13,
2002
2000
  zodSchema as zodSchema13
2003
2001
  } from "@ai-sdk/provider-utils";
@@ -2005,51 +2003,30 @@ import { z as z14 } from "zod/v4";
2005
2003
  var webSearchPreviewArgsSchema = lazySchema13(
2006
2004
  () => zodSchema13(
2007
2005
  z14.object({
2008
- /**
2009
- * Search context size to use for the web search.
2010
- * - high: Most comprehensive context, highest cost, slower response
2011
- * - medium: Balanced context, cost, and latency (default)
2012
- * - low: Least context, lowest cost, fastest response
2013
- */
2014
2006
  searchContextSize: z14.enum(["low", "medium", "high"]).optional(),
2015
- /**
2016
- * User location information to provide geographically relevant search results.
2017
- */
2018
2007
  userLocation: z14.object({
2019
- /**
2020
- * Type of location (always 'approximate')
2021
- */
2022
2008
  type: z14.literal("approximate"),
2023
- /**
2024
- * Two-letter ISO country code (e.g., 'US', 'GB')
2025
- */
2026
2009
  country: z14.string().optional(),
2027
- /**
2028
- * City name (free text, e.g., 'Minneapolis')
2029
- */
2030
2010
  city: z14.string().optional(),
2031
- /**
2032
- * Region name (free text, e.g., 'Minnesota')
2033
- */
2034
2011
  region: z14.string().optional(),
2035
- /**
2036
- * IANA timezone (e.g., 'America/Chicago')
2037
- */
2038
2012
  timezone: z14.string().optional()
2039
2013
  }).optional()
2040
2014
  })
2041
2015
  )
2042
2016
  );
2043
2017
  var webSearchPreviewInputSchema = lazySchema13(
2018
+ () => zodSchema13(z14.object({}))
2019
+ );
2020
+ var webSearchPreviewOutputSchema = lazySchema13(
2044
2021
  () => zodSchema13(
2045
2022
  z14.object({
2046
2023
  action: z14.discriminatedUnion("type", [
2047
2024
  z14.object({
2048
2025
  type: z14.literal("search"),
2049
- query: z14.string().nullish()
2026
+ query: z14.string().optional()
2050
2027
  }),
2051
2028
  z14.object({
2052
- type: z14.literal("open_page"),
2029
+ type: z14.literal("openPage"),
2053
2030
  url: z14.string()
2054
2031
  }),
2055
2032
  z14.object({
@@ -2057,14 +2034,15 @@ var webSearchPreviewInputSchema = lazySchema13(
2057
2034
  url: z14.string(),
2058
2035
  pattern: z14.string()
2059
2036
  })
2060
- ]).nullish()
2037
+ ])
2061
2038
  })
2062
2039
  )
2063
2040
  );
2064
- var webSearchPreview = createProviderDefinedToolFactory2({
2041
+ var webSearchPreview = createProviderDefinedToolFactoryWithOutputSchema6({
2065
2042
  id: "openai.web_search_preview",
2066
2043
  name: "web_search_preview",
2067
- inputSchema: webSearchPreviewInputSchema
2044
+ inputSchema: webSearchPreviewInputSchema,
2045
+ outputSchema: webSearchPreviewOutputSchema
2068
2046
  });
2069
2047
 
2070
2048
  // src/openai-tools.ts
@@ -2533,11 +2511,7 @@ var openaiResponsesChunkSchema = lazySchema14(
2533
2511
  z16.object({
2534
2512
  type: z16.literal("web_search_call"),
2535
2513
  id: z16.string(),
2536
- status: z16.string(),
2537
- action: z16.object({
2538
- type: z16.literal("search"),
2539
- query: z16.string().optional()
2540
- }).nullish()
2514
+ status: z16.string()
2541
2515
  }),
2542
2516
  z16.object({
2543
2517
  type: z16.literal("computer_call"),
@@ -2623,7 +2597,7 @@ var openaiResponsesChunkSchema = lazySchema14(
2623
2597
  url: z16.string(),
2624
2598
  pattern: z16.string()
2625
2599
  })
2626
- ]).nullish()
2600
+ ])
2627
2601
  }),
2628
2602
  z16.object({
2629
2603
  type: z16.literal("file_search_call"),
@@ -2804,7 +2778,7 @@ var openaiResponsesResponseSchema = lazySchema14(
2804
2778
  url: z16.string(),
2805
2779
  pattern: z16.string()
2806
2780
  })
2807
- ]).nullish()
2781
+ ])
2808
2782
  }),
2809
2783
  z16.object({
2810
2784
  type: z16.literal("file_search_call"),
@@ -3505,14 +3479,14 @@ var OpenAIResponsesLanguageModel = class {
3505
3479
  type: "tool-call",
3506
3480
  toolCallId: part.id,
3507
3481
  toolName: webSearchToolName != null ? webSearchToolName : "web_search",
3508
- input: JSON.stringify({ action: part.action }),
3482
+ input: JSON.stringify({}),
3509
3483
  providerExecuted: true
3510
3484
  });
3511
3485
  content.push({
3512
3486
  type: "tool-result",
3513
3487
  toolCallId: part.id,
3514
3488
  toolName: webSearchToolName != null ? webSearchToolName : "web_search",
3515
- result: { status: part.status },
3489
+ result: mapWebSearchOutput(part.action),
3516
3490
  providerExecuted: true
3517
3491
  });
3518
3492
  break;
@@ -3696,6 +3670,17 @@ var OpenAIResponsesLanguageModel = class {
3696
3670
  toolName: webSearchToolName != null ? webSearchToolName : "web_search",
3697
3671
  providerExecuted: true
3698
3672
  });
3673
+ controller.enqueue({
3674
+ type: "tool-input-end",
3675
+ id: value.item.id
3676
+ });
3677
+ controller.enqueue({
3678
+ type: "tool-call",
3679
+ toolCallId: value.item.id,
3680
+ toolName: "web_search",
3681
+ input: JSON.stringify({}),
3682
+ providerExecuted: true
3683
+ });
3699
3684
  } else if (value.item.type === "computer_call") {
3700
3685
  ongoingToolCalls[value.output_index] = {
3701
3686
  toolName: "computer_use",
@@ -3789,22 +3774,11 @@ var OpenAIResponsesLanguageModel = class {
3789
3774
  });
3790
3775
  } else if (value.item.type === "web_search_call") {
3791
3776
  ongoingToolCalls[value.output_index] = void 0;
3792
- controller.enqueue({
3793
- type: "tool-input-end",
3794
- id: value.item.id
3795
- });
3796
- controller.enqueue({
3797
- type: "tool-call",
3798
- toolCallId: value.item.id,
3799
- toolName: "web_search",
3800
- input: JSON.stringify({ action: value.item.action }),
3801
- providerExecuted: true
3802
- });
3803
3777
  controller.enqueue({
3804
3778
  type: "tool-result",
3805
3779
  toolCallId: value.item.id,
3806
3780
  toolName: "web_search",
3807
- result: { status: value.item.status },
3781
+ result: mapWebSearchOutput(value.item.action),
3808
3782
  providerExecuted: true
3809
3783
  });
3810
3784
  } else if (value.item.type === "computer_call") {
@@ -4149,6 +4123,19 @@ function getResponsesModelConfig(modelId) {
4149
4123
  isReasoningModel: false
4150
4124
  };
4151
4125
  }
4126
+ function mapWebSearchOutput(action) {
4127
+ var _a;
4128
+ switch (action.type) {
4129
+ case "search":
4130
+ return { action: { type: "search", query: (_a = action.query) != null ? _a : void 0 } };
4131
+ case "open_page":
4132
+ return { action: { type: "openPage", url: action.url } };
4133
+ case "find":
4134
+ return {
4135
+ action: { type: "find", url: action.url, pattern: action.pattern }
4136
+ };
4137
+ }
4138
+ }
4152
4139
 
4153
4140
  // src/speech/openai-speech-model.ts
4154
4141
  import {
@@ -4515,7 +4502,7 @@ var OpenAITranscriptionModel = class {
4515
4502
  };
4516
4503
 
4517
4504
  // src/version.ts
4518
- var VERSION = true ? "3.0.0-beta.27" : "0.0.0-test";
4505
+ var VERSION = true ? "3.0.0-beta.28" : "0.0.0-test";
4519
4506
 
4520
4507
  // src/openai-provider.ts
4521
4508
  function createOpenAI(options = {}) {