@ai-sdk/openai 3.0.72 → 3.0.73

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,11 @@
1
1
  # @ai-sdk/openai
2
2
 
3
+ ## 3.0.73
4
+
5
+ ### Patch Changes
6
+
7
+ - 1274c07: fix(provider/openai): send client-executed tool calls as full function_call items in the Responses API so they pair with their function_call_output by call_id
8
+
3
9
  ## 3.0.72
4
10
 
5
11
  ### 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, _r, _s, _t, _u, _v;
2754
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w;
2755
2755
  let input = [];
2756
2756
  const warnings = [];
2757
2757
  const processedApprovalIds = /* @__PURE__ */ new Set();
@@ -2888,10 +2888,11 @@ async function convertToOpenAIResponsesInput({
2888
2888
  }
2889
2889
  break;
2890
2890
  }
2891
- if (store && id != null) {
2892
- if (hasPreviousResponseId) {
2893
- break;
2894
- }
2891
+ if (hasPreviousResponseId && store && id != null) {
2892
+ break;
2893
+ }
2894
+ const isProviderDefinedToolCall = hasLocalShellTool && resolvedToolName === "local_shell" || hasShellTool && resolvedToolName === "shell" || hasApplyPatchTool && resolvedToolName === "apply_patch" || ((_m = customProviderToolNames == null ? void 0 : customProviderToolNames.has(resolvedToolName)) != null ? _m : false);
2895
+ if (store && id != null && isProviderDefinedToolCall) {
2895
2896
  input.push({ type: "item_reference", id });
2896
2897
  break;
2897
2898
  }
@@ -2962,7 +2963,6 @@ async function convertToOpenAIResponsesInput({
2962
2963
  call_id: part.toolCallId,
2963
2964
  name: resolvedToolName,
2964
2965
  arguments: serializeToolCallArguments2(part.input),
2965
- id,
2966
2966
  ...namespace != null && { namespace }
2967
2967
  });
2968
2968
  break;
@@ -2979,7 +2979,7 @@ async function convertToOpenAIResponsesInput({
2979
2979
  part.toolName
2980
2980
  );
2981
2981
  if (resolvedResultToolName === "tool_search") {
2982
- const itemId = (_o = (_n = (_m = part.providerOptions) == null ? void 0 : _m[providerOptionsName]) == null ? void 0 : _n.itemId) != null ? _o : part.toolCallId;
2982
+ const itemId = (_p = (_o = (_n = part.providerOptions) == null ? void 0 : _n[providerOptionsName]) == null ? void 0 : _o.itemId) != null ? _p : part.toolCallId;
2983
2983
  if (store) {
2984
2984
  input.push({ type: "item_reference", id: itemId });
2985
2985
  } else if (part.output.type === "json") {
@@ -3020,7 +3020,7 @@ async function convertToOpenAIResponsesInput({
3020
3020
  break;
3021
3021
  }
3022
3022
  if (store) {
3023
- const itemId = (_r = (_q = (_p = part.providerOptions) == null ? void 0 : _p[providerOptionsName]) == null ? void 0 : _q.itemId) != null ? _r : part.toolCallId;
3023
+ const itemId = (_s = (_r = (_q = part.providerOptions) == null ? void 0 : _q[providerOptionsName]) == null ? void 0 : _r.itemId) != null ? _s : part.toolCallId;
3024
3024
  input.push({ type: "item_reference", id: itemId });
3025
3025
  } else {
3026
3026
  warnings.push({
@@ -3130,7 +3130,7 @@ async function convertToOpenAIResponsesInput({
3130
3130
  }
3131
3131
  const output = part.output;
3132
3132
  if (output.type === "execution-denied") {
3133
- const approvalId = (_t = (_s = output.providerOptions) == null ? void 0 : _s.openai) == null ? void 0 : _t.approvalId;
3133
+ const approvalId = (_u = (_t = output.providerOptions) == null ? void 0 : _t.openai) == null ? void 0 : _u.approvalId;
3134
3134
  if (approvalId) {
3135
3135
  continue;
3136
3136
  }
@@ -3204,7 +3204,7 @@ async function convertToOpenAIResponsesInput({
3204
3204
  outputValue = output.value;
3205
3205
  break;
3206
3206
  case "execution-denied":
3207
- outputValue = (_u = output.reason) != null ? _u : "Tool execution denied.";
3207
+ outputValue = (_v = output.reason) != null ? _v : "Tool execution denied.";
3208
3208
  break;
3209
3209
  case "json":
3210
3210
  case "error-json":
@@ -3265,7 +3265,7 @@ async function convertToOpenAIResponsesInput({
3265
3265
  contentValue = output.value;
3266
3266
  break;
3267
3267
  case "execution-denied":
3268
- contentValue = (_v = output.reason) != null ? _v : "Tool execution denied.";
3268
+ contentValue = (_w = output.reason) != null ? _w : "Tool execution denied.";
3269
3269
  break;
3270
3270
  case "json":
3271
3271
  case "error-json":
@@ -6845,7 +6845,7 @@ var OpenAITranscriptionModel = class {
6845
6845
  };
6846
6846
 
6847
6847
  // src/version.ts
6848
- var VERSION = true ? "3.0.72" : "0.0.0-test";
6848
+ var VERSION = true ? "3.0.73" : "0.0.0-test";
6849
6849
 
6850
6850
  // src/openai-provider.ts
6851
6851
  function createOpenAI(options = {}) {