@ai-sdk/openai 3.0.116 → 3.0.117

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/openai",
3
- "version": "3.0.116",
3
+ "version": "3.0.117",
4
4
  "license": "Apache-2.0",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/index.js",
@@ -37,7 +37,7 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@ai-sdk/provider": "3.0.17",
40
- "@ai-sdk/provider-utils": "4.0.53"
40
+ "@ai-sdk/provider-utils": "4.0.54"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/node": "20.17.24",
@@ -36,6 +36,11 @@ export const openaiChatResponseSchema = lazySchema(() =>
36
36
  message: z.object({
37
37
  role: z.literal('assistant').nullish(),
38
38
  content: z.string().nullish(),
39
+ audio: z
40
+ .object({
41
+ transcript: z.string().nullish(),
42
+ })
43
+ .nullish(),
39
44
  tool_calls: z
40
45
  .array(
41
46
  z.object({
@@ -380,7 +380,10 @@ export class OpenAIChatLanguageModel implements LanguageModelV3 {
380
380
  const content: Array<LanguageModelV3Content> = [];
381
381
 
382
382
  // text content:
383
- const text = choice.message.content;
383
+ const text =
384
+ choice.message.content != null && choice.message.content.length > 0
385
+ ? choice.message.content
386
+ : choice.message.audio?.transcript;
384
387
  if (text != null && text.length > 0) {
385
388
  content.push({ type: 'text', text });
386
389
  }
@@ -118,6 +118,10 @@ function createOpenAIStreamError({
118
118
  responseHeaders,
119
119
  responseBody: JSON.stringify(frame),
120
120
  data: frame,
121
+ isRetryable:
122
+ streamError == null
123
+ ? true
124
+ : isRetryableStreamError(streamError, getStatusCode(streamError)),
121
125
  });
122
126
  }
123
127
 
@@ -1517,7 +1517,7 @@ export class OpenAIResponsesLanguageModel implements LanguageModelV3 {
1517
1517
  } else if (value.item.type === 'shell_call_output') {
1518
1518
  // shell_call_output is handled in output_item.done
1519
1519
  } else if (value.item.type === 'message') {
1520
- ongoingAnnotations.splice(0, ongoingAnnotations.length);
1520
+ ongoingAnnotations.splice(0);
1521
1521
  activeMessagePhase = value.item.phase ?? undefined;
1522
1522
  controller.enqueue({
1523
1523
  type: 'text-start',