@ai-sdk/openai 3.0.0-beta.60 → 3.0.0-beta.62

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.62
4
+
5
+ ### Patch Changes
6
+
7
+ - 64aa48f: Azure OpenAI enabled web-search-preview
8
+
9
+ ## 3.0.0-beta.61
10
+
11
+ ### Patch Changes
12
+
13
+ - 23f132b: fix: error schema for Responses API
14
+
3
15
  ## 3.0.0-beta.60
4
16
 
5
17
  ### Patch Changes
package/dist/index.js CHANGED
@@ -2801,6 +2801,8 @@ var openaiResponsesChunkSchema = (0, import_provider_utils22.lazySchema)(
2801
2801
  annotation: import_v417.z.discriminatedUnion("type", [
2802
2802
  import_v417.z.object({
2803
2803
  type: import_v417.z.literal("url_citation"),
2804
+ start_index: import_v417.z.number(),
2805
+ end_index: import_v417.z.number(),
2804
2806
  url: import_v417.z.string(),
2805
2807
  title: import_v417.z.string()
2806
2808
  }),
@@ -2847,10 +2849,13 @@ var openaiResponsesChunkSchema = (0, import_provider_utils22.lazySchema)(
2847
2849
  }),
2848
2850
  import_v417.z.object({
2849
2851
  type: import_v417.z.literal("error"),
2850
- code: import_v417.z.string(),
2851
- message: import_v417.z.string(),
2852
- param: import_v417.z.string().nullish(),
2853
- sequence_number: import_v417.z.number()
2852
+ sequence_number: import_v417.z.number(),
2853
+ error: import_v417.z.object({
2854
+ type: import_v417.z.string(),
2855
+ code: import_v417.z.string(),
2856
+ message: import_v417.z.string(),
2857
+ param: import_v417.z.string().nullish()
2858
+ })
2854
2859
  }),
2855
2860
  import_v417.z.object({ type: import_v417.z.string() }).loose().transform((value) => ({
2856
2861
  type: "unknown_chunk",
@@ -2863,13 +2868,15 @@ var openaiResponsesChunkSchema = (0, import_provider_utils22.lazySchema)(
2863
2868
  var openaiResponsesResponseSchema = (0, import_provider_utils22.lazySchema)(
2864
2869
  () => (0, import_provider_utils22.zodSchema)(
2865
2870
  import_v417.z.object({
2866
- id: import_v417.z.string(),
2867
- created_at: import_v417.z.number(),
2871
+ id: import_v417.z.string().optional(),
2872
+ created_at: import_v417.z.number().optional(),
2868
2873
  error: import_v417.z.object({
2869
- code: import_v417.z.string(),
2870
- message: import_v417.z.string()
2874
+ message: import_v417.z.string(),
2875
+ type: import_v417.z.string(),
2876
+ param: import_v417.z.string().nullish(),
2877
+ code: import_v417.z.string()
2871
2878
  }).nullish(),
2872
- model: import_v417.z.string(),
2879
+ model: import_v417.z.string().optional(),
2873
2880
  output: import_v417.z.array(
2874
2881
  import_v417.z.discriminatedUnion("type", [
2875
2882
  import_v417.z.object({
@@ -3072,7 +3079,7 @@ var openaiResponsesResponseSchema = (0, import_provider_utils22.lazySchema)(
3072
3079
  approval_request_id: import_v417.z.string()
3073
3080
  })
3074
3081
  ])
3075
- ),
3082
+ ).optional(),
3076
3083
  service_tier: import_v417.z.string().nullish(),
3077
3084
  incomplete_details: import_v417.z.object({ reason: import_v417.z.string() }).nullish(),
3078
3085
  usage: import_v417.z.object({
@@ -3080,7 +3087,7 @@ var openaiResponsesResponseSchema = (0, import_provider_utils22.lazySchema)(
3080
3087
  input_tokens_details: import_v417.z.object({ cached_tokens: import_v417.z.number().nullish() }).nullish(),
3081
3088
  output_tokens: import_v417.z.number(),
3082
3089
  output_tokens_details: import_v417.z.object({ reasoning_tokens: import_v417.z.number().nullish() }).nullish()
3083
- })
3090
+ }).optional()
3084
3091
  })
3085
3092
  )
3086
3093
  );
@@ -3960,6 +3967,7 @@ var OpenAIResponsesLanguageModel = class {
3960
3967
  if (typeof response.service_tier === "string") {
3961
3968
  providerMetadata.openai.serviceTier = response.service_tier;
3962
3969
  }
3970
+ const usage = response.usage;
3963
3971
  return {
3964
3972
  content,
3965
3973
  finishReason: mapOpenAIResponseFinishReason({
@@ -3967,11 +3975,11 @@ var OpenAIResponsesLanguageModel = class {
3967
3975
  hasFunctionCall
3968
3976
  }),
3969
3977
  usage: {
3970
- inputTokens: response.usage.input_tokens,
3971
- outputTokens: response.usage.output_tokens,
3972
- totalTokens: response.usage.input_tokens + response.usage.output_tokens,
3973
- reasoningTokens: (_z = (_y = response.usage.output_tokens_details) == null ? void 0 : _y.reasoning_tokens) != null ? _z : void 0,
3974
- cachedInputTokens: (_B = (_A = response.usage.input_tokens_details) == null ? void 0 : _A.cached_tokens) != null ? _B : void 0
3978
+ inputTokens: usage.input_tokens,
3979
+ outputTokens: usage.output_tokens,
3980
+ totalTokens: usage.input_tokens + usage.output_tokens,
3981
+ reasoningTokens: (_z = (_y = usage.output_tokens_details) == null ? void 0 : _y.reasoning_tokens) != null ? _z : void 0,
3982
+ cachedInputTokens: (_B = (_A = usage.input_tokens_details) == null ? void 0 : _A.cached_tokens) != null ? _B : void 0
3975
3983
  },
3976
3984
  request: { body },
3977
3985
  response: {
@@ -4068,7 +4076,7 @@ var OpenAIResponsesLanguageModel = class {
4068
4076
  controller.enqueue({
4069
4077
  type: "tool-call",
4070
4078
  toolCallId: value.item.id,
4071
- toolName: "web_search",
4079
+ toolName: webSearchToolName != null ? webSearchToolName : "web_search",
4072
4080
  input: JSON.stringify({}),
4073
4081
  providerExecuted: true
4074
4082
  });
@@ -4176,7 +4184,7 @@ var OpenAIResponsesLanguageModel = class {
4176
4184
  controller.enqueue({
4177
4185
  type: "tool-result",
4178
4186
  toolCallId: value.item.id,
4179
- toolName: "web_search",
4187
+ toolName: webSearchToolName != null ? webSearchToolName : "web_search",
4180
4188
  result: mapWebSearchOutput(value.item.action)
4181
4189
  });
4182
4190
  } else if (value.item.type === "computer_call") {
@@ -4970,7 +4978,7 @@ var OpenAITranscriptionModel = class {
4970
4978
  };
4971
4979
 
4972
4980
  // src/version.ts
4973
- var VERSION = true ? "3.0.0-beta.60" : "0.0.0-test";
4981
+ var VERSION = true ? "3.0.0-beta.62" : "0.0.0-test";
4974
4982
 
4975
4983
  // src/openai-provider.ts
4976
4984
  function createOpenAI(options = {}) {