@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.
@@ -2207,7 +2207,7 @@ async function convertToOpenAIResponsesInput({
2207
2207
  store,
2208
2208
  hasLocalShellTool = false
2209
2209
  }) {
2210
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
2210
+ var _a, _b, _c, _d;
2211
2211
  const input = [];
2212
2212
  const warnings = [];
2213
2213
  for (const { role, content } of prompt) {
@@ -2288,10 +2288,15 @@ async function convertToOpenAIResponsesInput({
2288
2288
  for (const part of content) {
2289
2289
  switch (part.type) {
2290
2290
  case "text": {
2291
+ const id = (_b = (_a = part.providerOptions) == null ? void 0 : _a.openai) == null ? void 0 : _b.itemId;
2292
+ if (store && id != null) {
2293
+ input.push({ type: "item_reference", id });
2294
+ break;
2295
+ }
2291
2296
  input.push({
2292
2297
  role: "assistant",
2293
2298
  content: [{ type: "output_text", text: part.text }],
2294
- id: (_c = (_b = (_a = part.providerOptions) == null ? void 0 : _a.openai) == null ? void 0 : _b.itemId) != null ? _c : void 0
2299
+ id
2295
2300
  });
2296
2301
  break;
2297
2302
  }
@@ -2300,6 +2305,11 @@ async function convertToOpenAIResponsesInput({
2300
2305
  if (part.providerExecuted) {
2301
2306
  break;
2302
2307
  }
2308
+ const id = (_d = (_c = part.providerOptions) == null ? void 0 : _c.openai) == null ? void 0 : _d.itemId;
2309
+ if (store && id != null) {
2310
+ input.push({ type: "item_reference", id });
2311
+ break;
2312
+ }
2303
2313
  if (hasLocalShellTool && part.toolName === "local_shell") {
2304
2314
  const parsedInput = await validateTypes({
2305
2315
  value: part.input,
@@ -2308,7 +2318,7 @@ async function convertToOpenAIResponsesInput({
2308
2318
  input.push({
2309
2319
  type: "local_shell_call",
2310
2320
  call_id: part.toolCallId,
2311
- id: (_f = (_e = (_d = part.providerOptions) == null ? void 0 : _d.openai) == null ? void 0 : _e.itemId) != null ? _f : void 0,
2321
+ id,
2312
2322
  action: {
2313
2323
  type: "exec",
2314
2324
  command: parsedInput.action.command,
@@ -2325,7 +2335,7 @@ async function convertToOpenAIResponsesInput({
2325
2335
  call_id: part.toolCallId,
2326
2336
  name: part.toolName,
2327
2337
  arguments: JSON.stringify(part.input),
2328
- id: (_i = (_h = (_g = part.providerOptions) == null ? void 0 : _g.openai) == null ? void 0 : _h.itemId) != null ? _i : void 0
2338
+ id
2329
2339
  });
2330
2340
  break;
2331
2341
  }
@@ -2975,6 +2985,7 @@ var openaiResponsesProviderOptionsSchema = lazyValidator12(
2975
2985
  include: z15.array(
2976
2986
  z15.enum([
2977
2987
  "reasoning.encrypted_content",
2988
+ // handled internally by default, only needed for unknown reasoning models
2978
2989
  "file_search_call.results",
2979
2990
  "message.output_text.logprobs"
2980
2991
  ])
@@ -3494,7 +3505,11 @@ var OpenAIResponsesLanguageModel = class {
3494
3505
  const strictJsonSchema = (_b = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _b : false;
3495
3506
  let include = openaiOptions == null ? void 0 : openaiOptions.include;
3496
3507
  function addInclude(key) {
3497
- include = include != null ? [...include, key] : [key];
3508
+ if (include == null) {
3509
+ include = [key];
3510
+ } else if (!include.includes(key)) {
3511
+ include = [...include, key];
3512
+ }
3498
3513
  }
3499
3514
  function hasOpenAITool(id) {
3500
3515
  return (tools == null ? void 0 : tools.find(
@@ -3514,6 +3529,10 @@ var OpenAIResponsesLanguageModel = class {
3514
3529
  if (hasOpenAITool("openai.code_interpreter")) {
3515
3530
  addInclude("code_interpreter_call.outputs");
3516
3531
  }
3532
+ const store = openaiOptions == null ? void 0 : openaiOptions.store;
3533
+ if (store === false && modelConfig.isReasoningModel) {
3534
+ addInclude("reasoning.encrypted_content");
3535
+ }
3517
3536
  const baseArgs = {
3518
3537
  model: this.modelId,
3519
3538
  input,
@@ -3541,7 +3560,7 @@ var OpenAIResponsesLanguageModel = class {
3541
3560
  metadata: openaiOptions == null ? void 0 : openaiOptions.metadata,
3542
3561
  parallel_tool_calls: openaiOptions == null ? void 0 : openaiOptions.parallelToolCalls,
3543
3562
  previous_response_id: openaiOptions == null ? void 0 : openaiOptions.previousResponseId,
3544
- store: openaiOptions == null ? void 0 : openaiOptions.store,
3563
+ store,
3545
3564
  user: openaiOptions == null ? void 0 : openaiOptions.user,
3546
3565
  instructions: openaiOptions == null ? void 0 : openaiOptions.instructions,
3547
3566
  service_tier: openaiOptions == null ? void 0 : openaiOptions.serviceTier,