@ai-sdk/openai 3.0.66 → 3.0.68

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,21 @@
1
1
  # @ai-sdk/openai
2
2
 
3
+ ## 3.0.68
4
+
5
+ ### Patch Changes
6
+
7
+ - c65c952: fix(openai): round-trip `namespace` on function_call input items
8
+
9
+ When `tool_search` dispatches a deferred tool, the resulting `function_call` carries a `namespace` field identifying which deferred-tool group the model picked. `#14789` preserved this on the read side (`providerMetadata.openai.namespace`), but the write side still serialized `function_call` input items without `namespace`. Multi-step / multi-turn conversations then failed with `Missing namespace for function_call '<name>'. ... Round-trip the model's function_call item with its namespace field included.`
10
+
11
+ `convert-to-openai-responses-input.ts` now reads `namespace` from `providerOptions.openai.namespace` (or `providerMetadata.openai.namespace`) on `tool-call` parts and includes it on the serialized `function_call` item, mirroring how `itemId` is round-tripped.
12
+
13
+ ## 3.0.67
14
+
15
+ ### Patch Changes
16
+
17
+ - c679fec: feat(provider/azure):web search tool in the Azure OpenAI Responses API.
18
+
3
19
  ## 3.0.66
4
20
 
5
21
  ### Patch Changes
package/dist/index.js CHANGED
@@ -2751,7 +2751,7 @@ async function convertToOpenAIResponsesInput({
2751
2751
  hasApplyPatchTool = false,
2752
2752
  customProviderToolNames
2753
2753
  }) {
2754
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
2754
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
2755
2755
  let input = [];
2756
2756
  const warnings = [];
2757
2757
  const processedApprovalIds = /* @__PURE__ */ new Set();
@@ -2852,6 +2852,7 @@ async function convertToOpenAIResponsesInput({
2852
2852
  }
2853
2853
  case "tool-call": {
2854
2854
  const id = (_f = (_c = (_b = part.providerOptions) == null ? void 0 : _b[providerOptionsName]) == null ? void 0 : _c.itemId) != null ? _f : (_e = (_d = part.providerMetadata) == null ? void 0 : _d[providerOptionsName]) == null ? void 0 : _e.itemId;
2855
+ const namespace = (_k = (_h = (_g = part.providerOptions) == null ? void 0 : _g[providerOptionsName]) == null ? void 0 : _h.namespace) != null ? _k : (_j = (_i = part.providerMetadata) == null ? void 0 : _i[providerOptionsName]) == null ? void 0 : _j.namespace;
2855
2856
  if (hasConversation && id != null) {
2856
2857
  break;
2857
2858
  }
@@ -2875,7 +2876,7 @@ async function convertToOpenAIResponsesInput({
2875
2876
  type: "tool_search_call",
2876
2877
  id: id != null ? id : part.toolCallId,
2877
2878
  execution,
2878
- call_id: (_g = parsedInput.call_id) != null ? _g : null,
2879
+ call_id: (_l = parsedInput.call_id) != null ? _l : null,
2879
2880
  status: "completed",
2880
2881
  arguments: parsedInput.arguments
2881
2882
  });
@@ -2961,7 +2962,8 @@ async function convertToOpenAIResponsesInput({
2961
2962
  call_id: part.toolCallId,
2962
2963
  name: resolvedToolName,
2963
2964
  arguments: serializeToolCallArguments2(part.input),
2964
- id
2965
+ id,
2966
+ ...namespace != null && { namespace }
2965
2967
  });
2966
2968
  break;
2967
2969
  }
@@ -2977,7 +2979,7 @@ async function convertToOpenAIResponsesInput({
2977
2979
  part.toolName
2978
2980
  );
2979
2981
  if (resolvedResultToolName === "tool_search") {
2980
- const itemId = (_j = (_i = (_h = part.providerOptions) == null ? void 0 : _h[providerOptionsName]) == null ? void 0 : _i.itemId) != null ? _j : part.toolCallId;
2982
+ const itemId = (_o = (_n = (_m = part.providerOptions) == null ? void 0 : _m[providerOptionsName]) == null ? void 0 : _n.itemId) != null ? _o : part.toolCallId;
2981
2983
  if (store) {
2982
2984
  input.push({ type: "item_reference", id: itemId });
2983
2985
  } else if (part.output.type === "json") {
@@ -3018,7 +3020,7 @@ async function convertToOpenAIResponsesInput({
3018
3020
  break;
3019
3021
  }
3020
3022
  if (store) {
3021
- const itemId = (_m = (_l = (_k = part.providerOptions) == null ? void 0 : _k[providerOptionsName]) == null ? void 0 : _l.itemId) != null ? _m : part.toolCallId;
3023
+ const itemId = (_r = (_q = (_p = part.providerOptions) == null ? void 0 : _p[providerOptionsName]) == null ? void 0 : _q.itemId) != null ? _r : part.toolCallId;
3022
3024
  input.push({ type: "item_reference", id: itemId });
3023
3025
  } else {
3024
3026
  warnings.push({
@@ -3128,7 +3130,7 @@ async function convertToOpenAIResponsesInput({
3128
3130
  }
3129
3131
  const output = part.output;
3130
3132
  if (output.type === "execution-denied") {
3131
- const approvalId = (_o = (_n = output.providerOptions) == null ? void 0 : _n.openai) == null ? void 0 : _o.approvalId;
3133
+ const approvalId = (_t = (_s = output.providerOptions) == null ? void 0 : _s.openai) == null ? void 0 : _t.approvalId;
3132
3134
  if (approvalId) {
3133
3135
  continue;
3134
3136
  }
@@ -3202,7 +3204,7 @@ async function convertToOpenAIResponsesInput({
3202
3204
  outputValue = output.value;
3203
3205
  break;
3204
3206
  case "execution-denied":
3205
- outputValue = (_p = output.reason) != null ? _p : "Tool execution denied.";
3207
+ outputValue = (_u = output.reason) != null ? _u : "Tool execution denied.";
3206
3208
  break;
3207
3209
  case "json":
3208
3210
  case "error-json":
@@ -3263,7 +3265,7 @@ async function convertToOpenAIResponsesInput({
3263
3265
  contentValue = output.value;
3264
3266
  break;
3265
3267
  case "execution-denied":
3266
- contentValue = (_q = output.reason) != null ? _q : "Tool execution denied.";
3268
+ contentValue = (_v = output.reason) != null ? _v : "Tool execution denied.";
3267
3269
  break;
3268
3270
  case "json":
3269
3271
  case "error-json":
@@ -6812,7 +6814,7 @@ var OpenAITranscriptionModel = class {
6812
6814
  };
6813
6815
 
6814
6816
  // src/version.ts
6815
- var VERSION = true ? "3.0.66" : "0.0.0-test";
6817
+ var VERSION = true ? "3.0.68" : "0.0.0-test";
6816
6818
 
6817
6819
  // src/openai-provider.ts
6818
6820
  function createOpenAI(options = {}) {