@ai-sdk/openai 3.0.0-beta.26 → 3.0.0-beta.27

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @ai-sdk/openai
2
2
 
3
+ ## 3.0.0-beta.27
4
+
5
+ ### Patch Changes
6
+
7
+ - f1277fe: feat(provider/openai): send assistant text and tool call parts as reference ids when store: true
8
+
3
9
  ## 3.0.0-beta.26
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -2129,7 +2129,7 @@ async function convertToOpenAIResponsesInput({
2129
2129
  store,
2130
2130
  hasLocalShellTool = false
2131
2131
  }) {
2132
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
2132
+ var _a, _b, _c, _d, _e;
2133
2133
  const input = [];
2134
2134
  const warnings = [];
2135
2135
  for (const { role, content } of prompt) {
@@ -2210,10 +2210,15 @@ async function convertToOpenAIResponsesInput({
2210
2210
  for (const part of content) {
2211
2211
  switch (part.type) {
2212
2212
  case "text": {
2213
+ const id = (_b = (_a = part.providerOptions) == null ? void 0 : _a.openai) == null ? void 0 : _b.itemId;
2214
+ if (store && id != null) {
2215
+ input.push({ type: "item_reference", id });
2216
+ break;
2217
+ }
2213
2218
  input.push({
2214
2219
  role: "assistant",
2215
2220
  content: [{ type: "output_text", text: part.text }],
2216
- id: (_c = (_b = (_a = part.providerOptions) == null ? void 0 : _a.openai) == null ? void 0 : _b.itemId) != null ? _c : void 0
2221
+ id
2217
2222
  });
2218
2223
  break;
2219
2224
  }
@@ -2222,6 +2227,11 @@ async function convertToOpenAIResponsesInput({
2222
2227
  if (part.providerExecuted) {
2223
2228
  break;
2224
2229
  }
2230
+ const id = (_d = (_c = part.providerOptions) == null ? void 0 : _c.openai) == null ? void 0 : _d.itemId;
2231
+ if (store && id != null) {
2232
+ input.push({ type: "item_reference", id });
2233
+ break;
2234
+ }
2225
2235
  if (hasLocalShellTool && part.toolName === "local_shell") {
2226
2236
  const parsedInput = await (0, import_provider_utils20.validateTypes)({
2227
2237
  value: part.input,
@@ -2230,7 +2240,7 @@ async function convertToOpenAIResponsesInput({
2230
2240
  input.push({
2231
2241
  type: "local_shell_call",
2232
2242
  call_id: part.toolCallId,
2233
- id: (_f = (_e = (_d = part.providerOptions) == null ? void 0 : _d.openai) == null ? void 0 : _e.itemId) != null ? _f : void 0,
2243
+ id,
2234
2244
  action: {
2235
2245
  type: "exec",
2236
2246
  command: parsedInput.action.command,
@@ -2247,7 +2257,7 @@ async function convertToOpenAIResponsesInput({
2247
2257
  call_id: part.toolCallId,
2248
2258
  name: part.toolName,
2249
2259
  arguments: JSON.stringify(part.input),
2250
- id: (_i = (_h = (_g = part.providerOptions) == null ? void 0 : _g.openai) == null ? void 0 : _h.itemId) != null ? _i : void 0
2260
+ id
2251
2261
  });
2252
2262
  break;
2253
2263
  }
@@ -2340,7 +2350,7 @@ async function convertToOpenAIResponsesInput({
2340
2350
  contentValue = output.value;
2341
2351
  break;
2342
2352
  case "execution-denied":
2343
- contentValue = (_j = output.reason) != null ? _j : "Tool execution denied.";
2353
+ contentValue = (_e = output.reason) != null ? _e : "Tool execution denied.";
2344
2354
  break;
2345
2355
  case "json":
2346
2356
  case "error-json":
@@ -4441,7 +4451,7 @@ var OpenAITranscriptionModel = class {
4441
4451
  };
4442
4452
 
4443
4453
  // src/version.ts
4444
- var VERSION = true ? "3.0.0-beta.26" : "0.0.0-test";
4454
+ var VERSION = true ? "3.0.0-beta.27" : "0.0.0-test";
4445
4455
 
4446
4456
  // src/openai-provider.ts
4447
4457
  function createOpenAI(options = {}) {