@ai-sdk/openai 2.0.134 → 2.0.135

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
@@ -2625,6 +2625,7 @@ async function convertToOpenAIResponsesInput({
2625
2625
  explicitMessageItemType = false,
2626
2626
  fileIdPrefixes,
2627
2627
  store,
2628
+ isReasoningModel = false,
2628
2629
  configurationUpdateUnsupportedReason,
2629
2630
  hasLocalShellTool = false,
2630
2631
  webSearchToolName
@@ -2778,12 +2779,14 @@ async function convertToOpenAIResponsesInput({
2778
2779
  case "assistant": {
2779
2780
  const reasoningMessages = {};
2780
2781
  const toolCallParts = {};
2782
+ let hasPrecedingReasoning = false;
2781
2783
  for (const part of content) {
2782
2784
  switch (part.type) {
2783
2785
  case "text": {
2784
2786
  const id = (_b = (_a2 = part.providerOptions) == null ? void 0 : _a2.openai) == null ? void 0 : _b.itemId;
2785
2787
  const phase = (_d = (_c = part.providerOptions) == null ? void 0 : _c.openai) == null ? void 0 : _d.phase;
2786
- if (store && id != null) {
2788
+ const canUseItemId = id != null && (!isReasoningModel || hasPrecedingReasoning);
2789
+ if (store && canUseItemId) {
2787
2790
  input.push({ type: "item_reference", id });
2788
2791
  break;
2789
2792
  }
@@ -2791,7 +2794,7 @@ async function convertToOpenAIResponsesInput({
2791
2794
  ...explicitMessageItemType && { type: "message" },
2792
2795
  role: "assistant",
2793
2796
  content: [{ type: "output_text", text: part.text }],
2794
- id,
2797
+ id: canUseItemId ? id : void 0,
2795
2798
  ...phase != null && { phase }
2796
2799
  });
2797
2800
  break;
@@ -2803,7 +2806,8 @@ async function convertToOpenAIResponsesInput({
2803
2806
  }
2804
2807
  const id = (_f = (_e = part.providerOptions) == null ? void 0 : _e.openai) == null ? void 0 : _f.itemId;
2805
2808
  const isAsync = (_h = (_g = part.providerOptions) == null ? void 0 : _g.openai) == null ? void 0 : _h.async;
2806
- if (store && id != null) {
2809
+ const canUseItemId = id != null && (!isReasoningModel || hasPrecedingReasoning);
2810
+ if (store && canUseItemId) {
2807
2811
  input.push({ type: "item_reference", id });
2808
2812
  break;
2809
2813
  }
@@ -2833,7 +2837,7 @@ async function convertToOpenAIResponsesInput({
2833
2837
  name: part.toolName,
2834
2838
  arguments: JSON.stringify(part.input),
2835
2839
  ...isAsync != null && { async: isAsync },
2836
- id
2840
+ id: canUseItemId ? id : void 0
2837
2841
  });
2838
2842
  break;
2839
2843
  }
@@ -2865,6 +2869,7 @@ async function convertToOpenAIResponsesInput({
2865
2869
  break;
2866
2870
  }
2867
2871
  case "reasoning": {
2872
+ hasPrecedingReasoning = true;
2868
2873
  const providerOptions2 = await parseProviderOptions5({
2869
2874
  provider: "openai",
2870
2875
  providerOptions: part.providerOptions,
@@ -3800,6 +3805,7 @@ var OpenAIResponsesLanguageModel = class {
3800
3805
  explicitMessageItemType: this.config.explicitMessageItemType,
3801
3806
  fileIdPrefixes: this.config.fileIdPrefixes,
3802
3807
  store: (_b = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _b : true,
3808
+ isReasoningModel: modelCapabilities.isReasoningModel,
3803
3809
  hasLocalShellTool: hasOpenAITool("openai.local_shell"),
3804
3810
  webSearchToolName
3805
3811
  });
@@ -5304,7 +5310,7 @@ var OpenAITranscriptionModel = class {
5304
5310
  };
5305
5311
 
5306
5312
  // src/version.ts
5307
- var VERSION = true ? "2.0.134" : "0.0.0-test";
5313
+ var VERSION = true ? "2.0.135" : "0.0.0-test";
5308
5314
 
5309
5315
  // src/openai-provider.ts
5310
5316
  function createOpenAI(options = {}) {