@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.
package/dist/index.mjs CHANGED
@@ -2185,7 +2185,7 @@ async function convertToOpenAIResponsesInput({
2185
2185
  store,
2186
2186
  hasLocalShellTool = false
2187
2187
  }) {
2188
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
2188
+ var _a, _b, _c, _d;
2189
2189
  const input = [];
2190
2190
  const warnings = [];
2191
2191
  for (const { role, content } of prompt) {
@@ -2266,10 +2266,15 @@ async function convertToOpenAIResponsesInput({
2266
2266
  for (const part of content) {
2267
2267
  switch (part.type) {
2268
2268
  case "text": {
2269
+ const id = (_b = (_a = part.providerOptions) == null ? void 0 : _a.openai) == null ? void 0 : _b.itemId;
2270
+ if (store && id != null) {
2271
+ input.push({ type: "item_reference", id });
2272
+ break;
2273
+ }
2269
2274
  input.push({
2270
2275
  role: "assistant",
2271
2276
  content: [{ type: "output_text", text: part.text }],
2272
- id: (_c = (_b = (_a = part.providerOptions) == null ? void 0 : _a.openai) == null ? void 0 : _b.itemId) != null ? _c : void 0
2277
+ id
2273
2278
  });
2274
2279
  break;
2275
2280
  }
@@ -2278,6 +2283,11 @@ async function convertToOpenAIResponsesInput({
2278
2283
  if (part.providerExecuted) {
2279
2284
  break;
2280
2285
  }
2286
+ const id = (_d = (_c = part.providerOptions) == null ? void 0 : _c.openai) == null ? void 0 : _d.itemId;
2287
+ if (store && id != null) {
2288
+ input.push({ type: "item_reference", id });
2289
+ break;
2290
+ }
2281
2291
  if (hasLocalShellTool && part.toolName === "local_shell") {
2282
2292
  const parsedInput = await validateTypes({
2283
2293
  value: part.input,
@@ -2286,7 +2296,7 @@ async function convertToOpenAIResponsesInput({
2286
2296
  input.push({
2287
2297
  type: "local_shell_call",
2288
2298
  call_id: part.toolCallId,
2289
- id: (_f = (_e = (_d = part.providerOptions) == null ? void 0 : _d.openai) == null ? void 0 : _e.itemId) != null ? _f : void 0,
2299
+ id,
2290
2300
  action: {
2291
2301
  type: "exec",
2292
2302
  command: parsedInput.action.command,
@@ -2303,7 +2313,7 @@ async function convertToOpenAIResponsesInput({
2303
2313
  call_id: part.toolCallId,
2304
2314
  name: part.toolName,
2305
2315
  arguments: JSON.stringify(part.input),
2306
- id: (_i = (_h = (_g = part.providerOptions) == null ? void 0 : _g.openai) == null ? void 0 : _h.itemId) != null ? _i : void 0
2316
+ id
2307
2317
  });
2308
2318
  break;
2309
2319
  }
@@ -2953,6 +2963,7 @@ var openaiResponsesProviderOptionsSchema = lazyValidator9(
2953
2963
  include: z17.array(
2954
2964
  z17.enum([
2955
2965
  "reasoning.encrypted_content",
2966
+ // handled internally by default, only needed for unknown reasoning models
2956
2967
  "file_search_call.results",
2957
2968
  "message.output_text.logprobs"
2958
2969
  ])
@@ -3204,7 +3215,11 @@ var OpenAIResponsesLanguageModel = class {
3204
3215
  const strictJsonSchema = (_b = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _b : false;
3205
3216
  let include = openaiOptions == null ? void 0 : openaiOptions.include;
3206
3217
  function addInclude(key) {
3207
- include = include != null ? [...include, key] : [key];
3218
+ if (include == null) {
3219
+ include = [key];
3220
+ } else if (!include.includes(key)) {
3221
+ include = [...include, key];
3222
+ }
3208
3223
  }
3209
3224
  function hasOpenAITool(id) {
3210
3225
  return (tools == null ? void 0 : tools.find(
@@ -3224,6 +3239,10 @@ var OpenAIResponsesLanguageModel = class {
3224
3239
  if (hasOpenAITool("openai.code_interpreter")) {
3225
3240
  addInclude("code_interpreter_call.outputs");
3226
3241
  }
3242
+ const store = openaiOptions == null ? void 0 : openaiOptions.store;
3243
+ if (store === false && modelConfig.isReasoningModel) {
3244
+ addInclude("reasoning.encrypted_content");
3245
+ }
3227
3246
  const baseArgs = {
3228
3247
  model: this.modelId,
3229
3248
  input,
@@ -3251,7 +3270,7 @@ var OpenAIResponsesLanguageModel = class {
3251
3270
  metadata: openaiOptions == null ? void 0 : openaiOptions.metadata,
3252
3271
  parallel_tool_calls: openaiOptions == null ? void 0 : openaiOptions.parallelToolCalls,
3253
3272
  previous_response_id: openaiOptions == null ? void 0 : openaiOptions.previousResponseId,
3254
- store: openaiOptions == null ? void 0 : openaiOptions.store,
3273
+ store,
3255
3274
  user: openaiOptions == null ? void 0 : openaiOptions.user,
3256
3275
  instructions: openaiOptions == null ? void 0 : openaiOptions.instructions,
3257
3276
  service_tier: openaiOptions == null ? void 0 : openaiOptions.serviceTier,
@@ -4496,7 +4515,7 @@ var OpenAITranscriptionModel = class {
4496
4515
  };
4497
4516
 
4498
4517
  // src/version.ts
4499
- var VERSION = true ? "2.0.48" : "0.0.0-test";
4518
+ var VERSION = true ? "2.0.50" : "0.0.0-test";
4500
4519
 
4501
4520
  // src/openai-provider.ts
4502
4521
  function createOpenAI(options = {}) {