@ai-sdk/openai 2.0.11 → 2.0.12

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.
@@ -1119,13 +1119,13 @@ var openaiChatChunkSchema = z5.union([
1119
1119
  openaiErrorDataSchema
1120
1120
  ]);
1121
1121
  function isReasoningModel(modelId) {
1122
- return modelId.startsWith("o") || modelId.startsWith("gpt-5");
1122
+ return (modelId.startsWith("o") || modelId.startsWith("gpt-5")) && !modelId.startsWith("gpt-5-chat");
1123
1123
  }
1124
1124
  function supportsFlexProcessing(modelId) {
1125
- return modelId.startsWith("o3") || modelId.startsWith("o4-mini") || modelId.startsWith("gpt-5");
1125
+ return modelId.startsWith("o3") || modelId.startsWith("o4-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-chat");
1126
1126
  }
1127
1127
  function supportsPriorityProcessing(modelId) {
1128
- return modelId.startsWith("gpt-4") || modelId.startsWith("gpt-5-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-nano") || modelId.startsWith("o3") || modelId.startsWith("o4-mini");
1128
+ return 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");
1129
1129
  }
1130
1130
  function getSystemMessageMode(modelId) {
1131
1131
  var _a, _b;
@@ -1922,6 +1922,8 @@ var OpenAITranscriptionModel = class {
1922
1922
  include: openAIOptions.include,
1923
1923
  language: openAIOptions.language,
1924
1924
  prompt: openAIOptions.prompt,
1925
+ response_format: "verbose_json",
1926
+ // always use verbose_json to get segments
1925
1927
  temperature: openAIOptions.temperature,
1926
1928
  timestamp_granularities: openAIOptions.timestampGranularities
1927
1929
  };
@@ -1937,7 +1939,7 @@ var OpenAITranscriptionModel = class {
1937
1939
  };
1938
1940
  }
1939
1941
  async doGenerate(options) {
1940
- var _a, _b, _c, _d, _e, _f;
1942
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1941
1943
  const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
1942
1944
  const { formData, warnings } = await this.getArgs(options);
1943
1945
  const {
@@ -1961,13 +1963,17 @@ var OpenAITranscriptionModel = class {
1961
1963
  const language = response.language != null && response.language in languageMap ? languageMap[response.language] : void 0;
1962
1964
  return {
1963
1965
  text: response.text,
1964
- segments: (_e = (_d = response.words) == null ? void 0 : _d.map((word) => ({
1966
+ segments: (_g = (_f = (_d = response.segments) == null ? void 0 : _d.map((segment) => ({
1967
+ text: segment.text,
1968
+ startSecond: segment.start,
1969
+ endSecond: segment.end
1970
+ }))) != null ? _f : (_e = response.words) == null ? void 0 : _e.map((word) => ({
1965
1971
  text: word.word,
1966
1972
  startSecond: word.start,
1967
1973
  endSecond: word.end
1968
- }))) != null ? _e : [],
1974
+ }))) != null ? _g : [],
1969
1975
  language,
1970
- durationInSeconds: (_f = response.duration) != null ? _f : void 0,
1976
+ durationInSeconds: (_h = response.duration) != null ? _h : void 0,
1971
1977
  warnings,
1972
1978
  response: {
1973
1979
  timestamp: currentDate,
@@ -1988,6 +1994,20 @@ var openaiTranscriptionResponseSchema = z12.object({
1988
1994
  start: z12.number(),
1989
1995
  end: z12.number()
1990
1996
  })
1997
+ ).nullish(),
1998
+ segments: z12.array(
1999
+ z12.object({
2000
+ id: z12.number(),
2001
+ seek: z12.number(),
2002
+ start: z12.number(),
2003
+ end: z12.number(),
2004
+ text: z12.string(),
2005
+ tokens: z12.array(z12.number()),
2006
+ temperature: z12.number(),
2007
+ avg_logprob: z12.number(),
2008
+ compression_ratio: z12.number(),
2009
+ no_speech_prob: z12.number()
2010
+ })
1991
2011
  ).nullish()
1992
2012
  });
1993
2013
 
@@ -3408,6 +3428,13 @@ function isErrorChunk(chunk) {
3408
3428
  return chunk.type === "error";
3409
3429
  }
3410
3430
  function getResponsesModelConfig(modelId) {
3431
+ if (modelId.startsWith("gpt-5-chat")) {
3432
+ return {
3433
+ isReasoningModel: false,
3434
+ systemMessageMode: "system",
3435
+ requiredAutoTruncation: false
3436
+ };
3437
+ }
3411
3438
  if (modelId.startsWith("o") || modelId.startsWith("gpt-5") || modelId.startsWith("codex-") || modelId.startsWith("computer-use")) {
3412
3439
  if (modelId.startsWith("o1-mini") || modelId.startsWith("o1-preview")) {
3413
3440
  return {
@@ -3429,10 +3456,10 @@ function getResponsesModelConfig(modelId) {
3429
3456
  };
3430
3457
  }
3431
3458
  function supportsFlexProcessing2(modelId) {
3432
- return modelId.startsWith("o3") || modelId.startsWith("o4-mini") || modelId.startsWith("gpt-5");
3459
+ return modelId.startsWith("o3") || modelId.startsWith("o4-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-chat");
3433
3460
  }
3434
3461
  function supportsPriorityProcessing2(modelId) {
3435
- return modelId.startsWith("gpt-4") || modelId.startsWith("gpt-5-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-nano") || modelId.startsWith("o3") || modelId.startsWith("o4-mini");
3462
+ return 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");
3436
3463
  }
3437
3464
  var openaiResponsesProviderOptionsSchema = z16.object({
3438
3465
  metadata: z16.any().nullish(),