@ai-sdk/openai 3.0.57 → 3.0.59

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.59
4
+
5
+ ### Patch Changes
6
+
7
+ - 38966ab: fix(openai, openai-compatible): only send null content for assistant messages with tool calls
8
+
9
+ ## 3.0.58
10
+
11
+ ### Patch Changes
12
+
13
+ - 2370948: feat(openai): preserve `namespace` on function_call output items
14
+
3
15
  ## 3.0.57
4
16
 
5
17
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -280,6 +280,7 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
280
280
  call_id: string;
281
281
  name: string;
282
282
  arguments: string;
283
+ namespace?: string | null | undefined;
283
284
  } | {
284
285
  type: "web_search_call";
285
286
  id: string;
@@ -397,6 +398,7 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
397
398
  name: string;
398
399
  arguments: string;
399
400
  status: "completed";
401
+ namespace?: string | null | undefined;
400
402
  } | {
401
403
  type: "custom_tool_call";
402
404
  id: string;
package/dist/index.d.ts CHANGED
@@ -280,6 +280,7 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
280
280
  call_id: string;
281
281
  name: string;
282
282
  arguments: string;
283
+ namespace?: string | null | undefined;
283
284
  } | {
284
285
  type: "web_search_call";
285
286
  id: string;
@@ -397,6 +398,7 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
397
398
  name: string;
398
399
  arguments: string;
399
400
  status: "completed";
401
+ namespace?: string | null | undefined;
400
402
  } | {
401
403
  type: "custom_tool_call";
402
404
  id: string;
package/dist/index.js CHANGED
@@ -252,7 +252,7 @@ function convertToOpenAIChatMessages({
252
252
  }
253
253
  messages.push({
254
254
  role: "assistant",
255
- content: text || null,
255
+ content: toolCalls.length > 0 ? text || null : text,
256
256
  tool_calls: toolCalls.length > 0 ? toolCalls : void 0
257
257
  });
258
258
  break;
@@ -3445,7 +3445,8 @@ var openaiResponsesChunkSchema = (0, import_provider_utils27.lazySchema)(
3445
3445
  id: import_v422.z.string(),
3446
3446
  call_id: import_v422.z.string(),
3447
3447
  name: import_v422.z.string(),
3448
- arguments: import_v422.z.string()
3448
+ arguments: import_v422.z.string(),
3449
+ namespace: import_v422.z.string().nullish()
3449
3450
  }),
3450
3451
  import_v422.z.object({
3451
3452
  type: import_v422.z.literal("web_search_call"),
@@ -3587,7 +3588,8 @@ var openaiResponsesChunkSchema = (0, import_provider_utils27.lazySchema)(
3587
3588
  call_id: import_v422.z.string(),
3588
3589
  name: import_v422.z.string(),
3589
3590
  arguments: import_v422.z.string(),
3590
- status: import_v422.z.literal("completed")
3591
+ status: import_v422.z.literal("completed"),
3592
+ namespace: import_v422.z.string().nullish()
3591
3593
  }),
3592
3594
  import_v422.z.object({
3593
3595
  type: import_v422.z.literal("custom_tool_call"),
@@ -4047,7 +4049,8 @@ var openaiResponsesResponseSchema = (0, import_provider_utils27.lazySchema)(
4047
4049
  call_id: import_v422.z.string(),
4048
4050
  name: import_v422.z.string(),
4049
4051
  arguments: import_v422.z.string(),
4050
- id: import_v422.z.string()
4052
+ id: import_v422.z.string(),
4053
+ namespace: import_v422.z.string().nullish()
4051
4054
  }),
4052
4055
  import_v422.z.object({
4053
4056
  type: import_v422.z.literal("custom_tool_call"),
@@ -5231,7 +5234,8 @@ var OpenAIResponsesLanguageModel = class {
5231
5234
  input: part.arguments,
5232
5235
  providerMetadata: {
5233
5236
  [providerOptionsName]: {
5234
- itemId: part.id
5237
+ itemId: part.id,
5238
+ ...part.namespace != null && { namespace: part.namespace }
5235
5239
  }
5236
5240
  }
5237
5241
  });
@@ -5714,7 +5718,14 @@ var OpenAIResponsesLanguageModel = class {
5714
5718
  hasFunctionCall = true;
5715
5719
  controller.enqueue({
5716
5720
  type: "tool-input-end",
5717
- id: value.item.call_id
5721
+ id: value.item.call_id,
5722
+ ...value.item.namespace != null && {
5723
+ providerMetadata: {
5724
+ [providerOptionsName]: {
5725
+ namespace: value.item.namespace
5726
+ }
5727
+ }
5728
+ }
5718
5729
  });
5719
5730
  controller.enqueue({
5720
5731
  type: "tool-call",
@@ -5723,7 +5734,10 @@ var OpenAIResponsesLanguageModel = class {
5723
5734
  input: value.item.arguments,
5724
5735
  providerMetadata: {
5725
5736
  [providerOptionsName]: {
5726
- itemId: value.item.id
5737
+ itemId: value.item.id,
5738
+ ...value.item.namespace != null && {
5739
+ namespace: value.item.namespace
5740
+ }
5727
5741
  }
5728
5742
  }
5729
5743
  });
@@ -6737,7 +6751,7 @@ var OpenAITranscriptionModel = class {
6737
6751
  };
6738
6752
 
6739
6753
  // src/version.ts
6740
- var VERSION = true ? "3.0.57" : "0.0.0-test";
6754
+ var VERSION = true ? "3.0.59" : "0.0.0-test";
6741
6755
 
6742
6756
  // src/openai-provider.ts
6743
6757
  function createOpenAI(options = {}) {