@ai-sdk/openai 3.0.0-beta.31 → 3.0.0-beta.33

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,20 @@
1
1
  # @ai-sdk/openai
2
2
 
3
+ ## 3.0.0-beta.33
4
+
5
+ ### Patch Changes
6
+
7
+ - 7756857: fix(provider/openai): add truncation parameter support for Responses API
8
+
9
+ ## 3.0.0-beta.32
10
+
11
+ ### Patch Changes
12
+
13
+ - 3794514: feat: flexible tool output content support
14
+ - Updated dependencies [3794514]
15
+ - @ai-sdk/provider-utils@4.0.0-beta.19
16
+ - @ai-sdk/provider@3.0.0-beta.8
17
+
3
18
  ## 3.0.0-beta.31
4
19
 
5
20
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -328,6 +328,7 @@ declare const openaiResponsesProviderOptionsSchema: _ai_sdk_provider_utils.LazyS
328
328
  store?: boolean | null | undefined;
329
329
  strictJsonSchema?: boolean | null | undefined;
330
330
  textVerbosity?: "low" | "medium" | "high" | null | undefined;
331
+ truncation?: "auto" | "disabled" | null | undefined;
331
332
  user?: string | null | undefined;
332
333
  }>;
333
334
  type OpenAIResponsesProviderOptions = InferSchema<typeof openaiResponsesProviderOptionsSchema>;
package/dist/index.d.ts CHANGED
@@ -328,6 +328,7 @@ declare const openaiResponsesProviderOptionsSchema: _ai_sdk_provider_utils.LazyS
328
328
  store?: boolean | null | undefined;
329
329
  strictJsonSchema?: boolean | null | undefined;
330
330
  textVerbosity?: "low" | "medium" | "high" | null | undefined;
331
+ truncation?: "auto" | "disabled" | null | undefined;
331
332
  user?: string | null | undefined;
332
333
  }>;
333
334
  type OpenAIResponsesProviderOptions = InferSchema<typeof openaiResponsesProviderOptionsSchema>;
package/dist/index.js CHANGED
@@ -2339,22 +2339,33 @@ async function convertToOpenAIResponsesInput({
2339
2339
  break;
2340
2340
  case "content":
2341
2341
  contentValue = output.value.map((item) => {
2342
+ var _a2;
2342
2343
  switch (item.type) {
2343
2344
  case "text": {
2344
2345
  return { type: "input_text", text: item.text };
2345
2346
  }
2346
- case "media": {
2347
- return item.mediaType.startsWith("image/") ? {
2347
+ case "image-data": {
2348
+ return {
2348
2349
  type: "input_image",
2349
2350
  image_url: `data:${item.mediaType};base64,${item.data}`
2350
- } : {
2351
+ };
2352
+ }
2353
+ case "file-data": {
2354
+ return {
2351
2355
  type: "input_file",
2352
- filename: "data",
2356
+ filename: (_a2 = item.filename) != null ? _a2 : "data",
2353
2357
  file_data: `data:${item.mediaType};base64,${item.data}`
2354
2358
  };
2355
2359
  }
2360
+ default: {
2361
+ warnings.push({
2362
+ type: "other",
2363
+ message: `unsupported tool content part type: ${item.type}`
2364
+ });
2365
+ return void 0;
2366
+ }
2356
2367
  }
2357
- });
2368
+ }).filter(import_provider_utils20.isNonNullable);
2358
2369
  break;
2359
2370
  }
2360
2371
  input.push({
@@ -2922,6 +2933,7 @@ var openaiResponsesProviderOptionsSchema = (0, import_provider_utils22.lazySchem
2922
2933
  store: import_v417.z.boolean().nullish(),
2923
2934
  strictJsonSchema: import_v417.z.boolean().nullish(),
2924
2935
  textVerbosity: import_v417.z.enum(["low", "medium", "high"]).nullish(),
2936
+ truncation: import_v417.z.enum(["auto", "disabled"]).nullish(),
2925
2937
  user: import_v417.z.string().nullish()
2926
2938
  })
2927
2939
  )
@@ -3200,6 +3212,7 @@ var OpenAIResponsesLanguageModel = class {
3200
3212
  prompt_cache_key: openaiOptions == null ? void 0 : openaiOptions.promptCacheKey,
3201
3213
  safety_identifier: openaiOptions == null ? void 0 : openaiOptions.safetyIdentifier,
3202
3214
  top_logprobs: topLogprobs,
3215
+ truncation: openaiOptions == null ? void 0 : openaiOptions.truncation,
3203
3216
  // model-specific settings:
3204
3217
  ...modelConfig.isReasoningModel && ((openaiOptions == null ? void 0 : openaiOptions.reasoningEffort) != null || (openaiOptions == null ? void 0 : openaiOptions.reasoningSummary) != null) && {
3205
3218
  reasoning: {
@@ -3210,9 +3223,6 @@ var OpenAIResponsesLanguageModel = class {
3210
3223
  summary: openaiOptions.reasoningSummary
3211
3224
  }
3212
3225
  }
3213
- },
3214
- ...modelConfig.requiredAutoTruncation && {
3215
- truncation: "auto"
3216
3226
  }
3217
3227
  };
3218
3228
  if (modelConfig.isReasoningModel) {
@@ -4068,7 +4078,6 @@ function getResponsesModelConfig(modelId) {
4068
4078
  const supportsFlexProcessing2 = modelId.startsWith("o3") || modelId.startsWith("o4-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-chat");
4069
4079
  const supportsPriorityProcessing2 = modelId.startsWith("gpt-4") || modelId.startsWith("gpt-5-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-nano") && !modelId.startsWith("gpt-5-chat") || modelId.startsWith("o3") || modelId.startsWith("o4-mini");
4070
4080
  const defaults = {
4071
- requiredAutoTruncation: false,
4072
4081
  systemMessageMode: "system",
4073
4082
  supportsFlexProcessing: supportsFlexProcessing2,
4074
4083
  supportsPriorityProcessing: supportsPriorityProcessing2
@@ -4465,7 +4474,7 @@ var OpenAITranscriptionModel = class {
4465
4474
  };
4466
4475
 
4467
4476
  // src/version.ts
4468
- var VERSION = true ? "3.0.0-beta.31" : "0.0.0-test";
4477
+ var VERSION = true ? "3.0.0-beta.33" : "0.0.0-test";
4469
4478
 
4470
4479
  // src/openai-provider.ts
4471
4480
  function createOpenAI(options = {}) {