@ai-sdk/openai 2.0.0-beta.7 → 2.0.0-beta.9

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.
@@ -1988,7 +1988,7 @@ async function convertToOpenAIResponsesMessages({
1988
1988
  prompt,
1989
1989
  systemMessageMode
1990
1990
  }) {
1991
- var _a, _b;
1991
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1992
1992
  const messages = [];
1993
1993
  const warnings = [];
1994
1994
  for (const { role, content } of prompt) {
@@ -2023,7 +2023,7 @@ async function convertToOpenAIResponsesMessages({
2023
2023
  messages.push({
2024
2024
  role: "user",
2025
2025
  content: content.map((part, index) => {
2026
- var _a2, _b2, _c;
2026
+ var _a2, _b2, _c2;
2027
2027
  switch (part.type) {
2028
2028
  case "text": {
2029
2029
  return { type: "input_text", text: part.text };
@@ -2045,7 +2045,7 @@ async function convertToOpenAIResponsesMessages({
2045
2045
  }
2046
2046
  return {
2047
2047
  type: "input_file",
2048
- filename: (_c = part.filename) != null ? _c : `part-${index}.pdf`,
2048
+ filename: (_c2 = part.filename) != null ? _c2 : `part-${index}.pdf`,
2049
2049
  file_data: `data:application/pdf;base64,${part.data}`
2050
2050
  };
2051
2051
  } else {
@@ -2066,7 +2066,8 @@ async function convertToOpenAIResponsesMessages({
2066
2066
  case "text": {
2067
2067
  messages.push({
2068
2068
  role: "assistant",
2069
- content: [{ type: "output_text", text: part.text }]
2069
+ content: [{ type: "output_text", text: part.text }],
2070
+ id: (_c = (_b = (_a = part.providerOptions) == null ? void 0 : _a.openai) == null ? void 0 : _b.itemId) != null ? _c : void 0
2070
2071
  });
2071
2072
  break;
2072
2073
  }
@@ -2078,7 +2079,8 @@ async function convertToOpenAIResponsesMessages({
2078
2079
  type: "function_call",
2079
2080
  call_id: part.toolCallId,
2080
2081
  name: part.toolName,
2081
- arguments: JSON.stringify(part.input)
2082
+ arguments: JSON.stringify(part.input),
2083
+ id: (_f = (_e = (_d = part.providerOptions) == null ? void 0 : _d.openai) == null ? void 0 : _e.itemId) != null ? _f : void 0
2082
2084
  });
2083
2085
  break;
2084
2086
  }
@@ -2095,7 +2097,7 @@ async function convertToOpenAIResponsesMessages({
2095
2097
  providerOptions: part.providerOptions,
2096
2098
  schema: openaiResponsesReasoningProviderOptionsSchema
2097
2099
  });
2098
- const reasoningId = (_a = providerOptions == null ? void 0 : providerOptions.reasoning) == null ? void 0 : _a.id;
2100
+ const reasoningId = (_g = providerOptions == null ? void 0 : providerOptions.reasoning) == null ? void 0 : _g.id;
2099
2101
  if (reasoningId != null) {
2100
2102
  const existingReasoningMessage = reasoningMessages[reasoningId];
2101
2103
  const summaryParts = [];
@@ -2111,7 +2113,7 @@ async function convertToOpenAIResponsesMessages({
2111
2113
  reasoningMessages[reasoningId] = {
2112
2114
  type: "reasoning",
2113
2115
  id: reasoningId,
2114
- encrypted_content: (_b = providerOptions == null ? void 0 : providerOptions.reasoning) == null ? void 0 : _b.encryptedContent,
2116
+ encrypted_content: (_h = providerOptions == null ? void 0 : providerOptions.reasoning) == null ? void 0 : _h.encryptedContent,
2115
2117
  summary: summaryParts
2116
2118
  };
2117
2119
  messages.push(reasoningMessages[reasoningId]);
@@ -2456,6 +2458,7 @@ var OpenAIResponsesLanguageModel = class {
2456
2458
  import_v415.z.object({
2457
2459
  type: import_v415.z.literal("message"),
2458
2460
  role: import_v415.z.literal("assistant"),
2461
+ id: import_v415.z.string(),
2459
2462
  content: import_v415.z.array(
2460
2463
  import_v415.z.object({
2461
2464
  type: import_v415.z.literal("output_text"),
@@ -2476,7 +2479,8 @@ var OpenAIResponsesLanguageModel = class {
2476
2479
  type: import_v415.z.literal("function_call"),
2477
2480
  call_id: import_v415.z.string(),
2478
2481
  name: import_v415.z.string(),
2479
- arguments: import_v415.z.string()
2482
+ arguments: import_v415.z.string(),
2483
+ id: import_v415.z.string()
2480
2484
  }),
2481
2485
  import_v415.z.object({
2482
2486
  type: import_v415.z.literal("web_search_call"),
@@ -2546,7 +2550,12 @@ var OpenAIResponsesLanguageModel = class {
2546
2550
  for (const contentPart of part.content) {
2547
2551
  content.push({
2548
2552
  type: "text",
2549
- text: contentPart.text
2553
+ text: contentPart.text,
2554
+ providerMetadata: {
2555
+ openai: {
2556
+ itemId: part.id
2557
+ }
2558
+ }
2550
2559
  });
2551
2560
  for (const annotation of contentPart.annotations) {
2552
2561
  content.push({
@@ -2565,7 +2574,12 @@ var OpenAIResponsesLanguageModel = class {
2565
2574
  type: "tool-call",
2566
2575
  toolCallId: part.call_id,
2567
2576
  toolName: part.name,
2568
- input: part.arguments
2577
+ input: part.arguments,
2578
+ providerMetadata: {
2579
+ openai: {
2580
+ itemId: part.id
2581
+ }
2582
+ }
2569
2583
  });
2570
2584
  break;
2571
2585
  }
@@ -2718,7 +2732,12 @@ var OpenAIResponsesLanguageModel = class {
2718
2732
  } else if (value.item.type === "message") {
2719
2733
  controller.enqueue({
2720
2734
  type: "text-start",
2721
- id: value.item.id
2735
+ id: value.item.id,
2736
+ providerMetadata: {
2737
+ openai: {
2738
+ itemId: value.item.id
2739
+ }
2740
+ }
2722
2741
  });
2723
2742
  } else if (isResponseOutputItemAddedReasoningChunk(value)) {
2724
2743
  activeReasoning[value.item.id] = {
@@ -2750,7 +2769,12 @@ var OpenAIResponsesLanguageModel = class {
2750
2769
  type: "tool-call",
2751
2770
  toolCallId: value.item.call_id,
2752
2771
  toolName: value.item.name,
2753
- input: value.item.arguments
2772
+ input: value.item.arguments,
2773
+ providerMetadata: {
2774
+ openai: {
2775
+ itemId: value.item.id
2776
+ }
2777
+ }
2754
2778
  });
2755
2779
  } else if (value.item.type === "web_search_call") {
2756
2780
  ongoingToolCalls[value.output_index] = void 0;