@ai-sdk/openai 3.0.125 → 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"),
@@ -7028,6 +7033,11 @@ var OpenAIResponsesLanguageModel = class {
7028
7033
  id: value.item.call_id,
7029
7034
  toolName
7030
7035
  });
7036
+ controller.enqueue({
7037
+ type: "tool-input-delta",
7038
+ id: value.item.call_id,
7039
+ delta: '"'
7040
+ });
7031
7041
  } else if (value.item.type === "web_search_call") {
7032
7042
  ongoingToolCalls[value.output_index] = {
7033
7043
  toolName: toolNameMapping.toCustomToolName(
@@ -7316,6 +7326,11 @@ var OpenAIResponsesLanguageModel = class {
7316
7326
  const toolName = toolNameMapping.toCustomToolName(
7317
7327
  value.item.name
7318
7328
  );
7329
+ controller.enqueue({
7330
+ type: "tool-input-delta",
7331
+ id: value.item.call_id,
7332
+ delta: '"'
7333
+ });
7319
7334
  controller.enqueue({
7320
7335
  type: "tool-input-end",
7321
7336
  id: value.item.call_id
@@ -7642,7 +7657,7 @@ var OpenAIResponsesLanguageModel = class {
7642
7657
  controller.enqueue({
7643
7658
  type: "tool-input-delta",
7644
7659
  id: toolCall.toolCallId,
7645
- delta: value.delta
7660
+ delta: escapeJSONDelta(value.delta)
7646
7661
  });
7647
7662
  }
7648
7663
  } else if (isResponseApplyPatchCallOperationDiffDeltaChunk(value)) {
@@ -8425,7 +8440,7 @@ var OpenAITranscriptionModel = class {
8425
8440
  };
8426
8441
 
8427
8442
  // src/version.ts
8428
- var VERSION = true ? "3.0.125" : "0.0.0-test";
8443
+ var VERSION = true ? "3.0.127" : "0.0.0-test";
8429
8444
 
8430
8445
  // src/openai-provider.ts
8431
8446
  function createOpenAI(options = {}) {