@ai-sdk/openai 3.0.126 → 3.0.127

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
@@ -3807,6 +3807,7 @@ async function convertToOpenAIResponsesInput({
3807
3807
  fileIdPrefixes,
3808
3808
  passThroughUnsupportedFiles = false,
3809
3809
  store,
3810
+ isReasoningModel = false,
3810
3811
  hasConversation = false,
3811
3812
  hasPreviousResponseId = false,
3812
3813
  configurationUpdateUnsupportedReason,
@@ -3979,6 +3980,7 @@ async function convertToOpenAIResponsesInput({
3979
3980
  }
3980
3981
  case "assistant": {
3981
3982
  const reasoningMessages = {};
3983
+ let hasPrecedingReasoning = false;
3982
3984
  for (const part of content) {
3983
3985
  switch (part.type) {
3984
3986
  case "text": {
@@ -3988,7 +3990,8 @@ async function convertToOpenAIResponsesInput({
3988
3990
  if (hasConversation && id != null) {
3989
3991
  break;
3990
3992
  }
3991
- if (store && id != null) {
3993
+ const canUseItemId = id != null && (!isReasoningModel || hasPrecedingReasoning);
3994
+ if (store && canUseItemId) {
3992
3995
  input.push({ type: "item_reference", id });
3993
3996
  break;
3994
3997
  }
@@ -3996,7 +3999,7 @@ async function convertToOpenAIResponsesInput({
3996
3999
  ...explicitMessageItemType && { type: "message" },
3997
4000
  role: "assistant",
3998
4001
  content: [{ type: "output_text", text: part.text }],
3999
- id,
4002
+ id: canUseItemId ? id : void 0,
4000
4003
  ...phase != null && { phase }
4001
4004
  });
4002
4005
  break;
@@ -4230,6 +4233,7 @@ async function convertToOpenAIResponsesInput({
4230
4233
  break;
4231
4234
  }
4232
4235
  case "reasoning": {
4236
+ hasPrecedingReasoning = true;
4233
4237
  const providerOptions2 = await parseProviderOptions5({
4234
4238
  provider: providerOptionsName,
4235
4239
  providerOptions: part.providerOptions,
@@ -6188,6 +6192,7 @@ var OpenAIResponsesLanguageModel = class {
6188
6192
  fileIdPrefixes: this.config.fileIdPrefixes,
6189
6193
  passThroughUnsupportedFiles: (_d = openaiOptions == null ? void 0 : openaiOptions.passThroughUnsupportedFiles) != null ? _d : false,
6190
6194
  store: (_e = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _e : true,
6195
+ isReasoningModel,
6191
6196
  hasConversation: (openaiOptions == null ? void 0 : openaiOptions.conversation) != null,
6192
6197
  hasPreviousResponseId: (openaiOptions == null ? void 0 : openaiOptions.previousResponseId) != null,
6193
6198
  hasLocalShellTool: hasOpenAITool("openai.local_shell"),
@@ -8435,7 +8440,7 @@ var OpenAITranscriptionModel = class {
8435
8440
  };
8436
8441
 
8437
8442
  // src/version.ts
8438
- var VERSION = true ? "3.0.126" : "0.0.0-test";
8443
+ var VERSION = true ? "3.0.127" : "0.0.0-test";
8439
8444
 
8440
8445
  // src/openai-provider.ts
8441
8446
  function createOpenAI(options = {}) {