@ai-sdk/openai 3.0.126 → 3.0.128

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.
@@ -3758,6 +3758,7 @@ async function convertToOpenAIResponsesInput({
3758
3758
  fileIdPrefixes,
3759
3759
  passThroughUnsupportedFiles = false,
3760
3760
  store,
3761
+ isReasoningModel = false,
3761
3762
  hasConversation = false,
3762
3763
  hasPreviousResponseId = false,
3763
3764
  configurationUpdateUnsupportedReason,
@@ -3930,6 +3931,7 @@ async function convertToOpenAIResponsesInput({
3930
3931
  }
3931
3932
  case "assistant": {
3932
3933
  const reasoningMessages = {};
3934
+ let hasPrecedingReasoning = false;
3933
3935
  for (const part of content) {
3934
3936
  switch (part.type) {
3935
3937
  case "text": {
@@ -3939,7 +3941,8 @@ async function convertToOpenAIResponsesInput({
3939
3941
  if (hasConversation && id != null) {
3940
3942
  break;
3941
3943
  }
3942
- if (store && id != null) {
3944
+ const canUseItemId = id != null && (!isReasoningModel || hasPrecedingReasoning);
3945
+ if (store && canUseItemId) {
3943
3946
  input.push({ type: "item_reference", id });
3944
3947
  break;
3945
3948
  }
@@ -3947,7 +3950,7 @@ async function convertToOpenAIResponsesInput({
3947
3950
  ...explicitMessageItemType && { type: "message" },
3948
3951
  role: "assistant",
3949
3952
  content: [{ type: "output_text", text: part.text }],
3950
- id,
3953
+ id: canUseItemId ? id : void 0,
3951
3954
  ...phase != null && { phase }
3952
3955
  });
3953
3956
  break;
@@ -4181,6 +4184,7 @@ async function convertToOpenAIResponsesInput({
4181
4184
  break;
4182
4185
  }
4183
4186
  case "reasoning": {
4187
+ hasPrecedingReasoning = true;
4184
4188
  const providerOptions2 = await parseProviderOptions7({
4185
4189
  provider: providerOptionsName,
4186
4190
  providerOptions: part.providerOptions,
@@ -6430,6 +6434,7 @@ var OpenAIResponsesLanguageModel = class {
6430
6434
  fileIdPrefixes: this.config.fileIdPrefixes,
6431
6435
  passThroughUnsupportedFiles: (_d = openaiOptions == null ? void 0 : openaiOptions.passThroughUnsupportedFiles) != null ? _d : false,
6432
6436
  store: (_e = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _e : true,
6437
+ isReasoningModel,
6433
6438
  hasConversation: (openaiOptions == null ? void 0 : openaiOptions.conversation) != null,
6434
6439
  hasPreviousResponseId: (openaiOptions == null ? void 0 : openaiOptions.previousResponseId) != null,
6435
6440
  hasLocalShellTool: hasOpenAITool("openai.local_shell"),