@ai-sdk/openai 2.0.48 → 2.0.50

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.
@@ -2171,7 +2171,7 @@ async function convertToOpenAIResponsesInput({
2171
2171
  store,
2172
2172
  hasLocalShellTool = false
2173
2173
  }) {
2174
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
2174
+ var _a, _b, _c, _d;
2175
2175
  const input = [];
2176
2176
  const warnings = [];
2177
2177
  for (const { role, content } of prompt) {
@@ -2252,10 +2252,15 @@ async function convertToOpenAIResponsesInput({
2252
2252
  for (const part of content) {
2253
2253
  switch (part.type) {
2254
2254
  case "text": {
2255
+ const id = (_b = (_a = part.providerOptions) == null ? void 0 : _a.openai) == null ? void 0 : _b.itemId;
2256
+ if (store && id != null) {
2257
+ input.push({ type: "item_reference", id });
2258
+ break;
2259
+ }
2255
2260
  input.push({
2256
2261
  role: "assistant",
2257
2262
  content: [{ type: "output_text", text: part.text }],
2258
- id: (_c = (_b = (_a = part.providerOptions) == null ? void 0 : _a.openai) == null ? void 0 : _b.itemId) != null ? _c : void 0
2263
+ id
2259
2264
  });
2260
2265
  break;
2261
2266
  }
@@ -2264,6 +2269,11 @@ async function convertToOpenAIResponsesInput({
2264
2269
  if (part.providerExecuted) {
2265
2270
  break;
2266
2271
  }
2272
+ const id = (_d = (_c = part.providerOptions) == null ? void 0 : _c.openai) == null ? void 0 : _d.itemId;
2273
+ if (store && id != null) {
2274
+ input.push({ type: "item_reference", id });
2275
+ break;
2276
+ }
2267
2277
  if (hasLocalShellTool && part.toolName === "local_shell") {
2268
2278
  const parsedInput = await (0, import_provider_utils20.validateTypes)({
2269
2279
  value: part.input,
@@ -2272,7 +2282,7 @@ async function convertToOpenAIResponsesInput({
2272
2282
  input.push({
2273
2283
  type: "local_shell_call",
2274
2284
  call_id: part.toolCallId,
2275
- id: (_f = (_e = (_d = part.providerOptions) == null ? void 0 : _d.openai) == null ? void 0 : _e.itemId) != null ? _f : void 0,
2285
+ id,
2276
2286
  action: {
2277
2287
  type: "exec",
2278
2288
  command: parsedInput.action.command,
@@ -2289,7 +2299,7 @@ async function convertToOpenAIResponsesInput({
2289
2299
  call_id: part.toolCallId,
2290
2300
  name: part.toolName,
2291
2301
  arguments: JSON.stringify(part.input),
2292
- id: (_i = (_h = (_g = part.providerOptions) == null ? void 0 : _g.openai) == null ? void 0 : _h.itemId) != null ? _i : void 0
2302
+ id
2293
2303
  });
2294
2304
  break;
2295
2305
  }
@@ -2933,6 +2943,7 @@ var openaiResponsesProviderOptionsSchema = (0, import_provider_utils22.lazyValid
2933
2943
  include: import_v415.z.array(
2934
2944
  import_v415.z.enum([
2935
2945
  "reasoning.encrypted_content",
2946
+ // handled internally by default, only needed for unknown reasoning models
2936
2947
  "file_search_call.results",
2937
2948
  "message.output_text.logprobs"
2938
2949
  ])
@@ -3430,7 +3441,11 @@ var OpenAIResponsesLanguageModel = class {
3430
3441
  const strictJsonSchema = (_b = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _b : false;
3431
3442
  let include = openaiOptions == null ? void 0 : openaiOptions.include;
3432
3443
  function addInclude(key) {
3433
- include = include != null ? [...include, key] : [key];
3444
+ if (include == null) {
3445
+ include = [key];
3446
+ } else if (!include.includes(key)) {
3447
+ include = [...include, key];
3448
+ }
3434
3449
  }
3435
3450
  function hasOpenAITool(id) {
3436
3451
  return (tools == null ? void 0 : tools.find(
@@ -3450,6 +3465,10 @@ var OpenAIResponsesLanguageModel = class {
3450
3465
  if (hasOpenAITool("openai.code_interpreter")) {
3451
3466
  addInclude("code_interpreter_call.outputs");
3452
3467
  }
3468
+ const store = openaiOptions == null ? void 0 : openaiOptions.store;
3469
+ if (store === false && modelConfig.isReasoningModel) {
3470
+ addInclude("reasoning.encrypted_content");
3471
+ }
3453
3472
  const baseArgs = {
3454
3473
  model: this.modelId,
3455
3474
  input,
@@ -3477,7 +3496,7 @@ var OpenAIResponsesLanguageModel = class {
3477
3496
  metadata: openaiOptions == null ? void 0 : openaiOptions.metadata,
3478
3497
  parallel_tool_calls: openaiOptions == null ? void 0 : openaiOptions.parallelToolCalls,
3479
3498
  previous_response_id: openaiOptions == null ? void 0 : openaiOptions.previousResponseId,
3480
- store: openaiOptions == null ? void 0 : openaiOptions.store,
3499
+ store,
3481
3500
  user: openaiOptions == null ? void 0 : openaiOptions.user,
3482
3501
  instructions: openaiOptions == null ? void 0 : openaiOptions.instructions,
3483
3502
  service_tier: openaiOptions == null ? void 0 : openaiOptions.serviceTier,