@ai-sdk/openai 4.0.110 → 4.0.113

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.
@@ -18,91 +18,92 @@ export type OpenAITranscriptionModelId =
18
18
  | (string & {});
19
19
 
20
20
  // https://platform.openai.com/docs/api-reference/audio/createTranscription
21
- export const openAITranscriptionModelOptions = lazySchema(() =>
22
- zodSchema(
23
- z.object({
24
- /**
25
- * Additional information to include in the transcription response.
26
- */
21
+ /**
22
+ * Shape of the OpenAI transcription model options. Exported so that routers
23
+ * that also call the OpenAI transcription API (e.g. Azure) can accept these
24
+ * options under their own providerOptions key.
25
+ */
26
+ export const openAITranscriptionModelOptionsShape = () => ({
27
+ /**
28
+ * Additional information to include in the transcription response.
29
+ */
27
30
 
28
- include: z.array(z.string()).optional(),
31
+ include: z.array(z.string()).optional(),
29
32
 
30
- /**
31
- * The language of the input audio in ISO-639-1 format.
32
- */
33
- language: z.string().optional(),
33
+ /**
34
+ * The language of the input audio in ISO-639-1 format.
35
+ */
36
+ language: z.string().optional(),
34
37
 
35
- /**
36
- * Expected languages for REST transcription, e.g. with gpt-transcribe.
37
- * Use this instead of language. The API validates model support.
38
- */
39
- languages: z.array(z.string()).optional(),
38
+ /**
39
+ * Expected languages for REST transcription, e.g. with gpt-transcribe.
40
+ * Use this instead of language. The API validates model support.
41
+ */
42
+ languages: z.array(z.string()).optional(),
40
43
 
41
- /**
42
- * Vocabulary hints for REST transcription, e.g. names or technical terms.
43
- * The API validates model support.
44
- */
45
- keywords: z.array(z.string()).optional(),
44
+ /**
45
+ * Vocabulary hints for REST transcription, e.g. names or technical terms.
46
+ * The API validates model support.
47
+ */
48
+ keywords: z.array(z.string()).optional(),
46
49
 
47
- /**
48
- * An optional text to guide the model's style or continue a previous audio segment.
49
- */
50
- prompt: z.string().optional(),
50
+ /**
51
+ * An optional text to guide the model's style or continue a previous audio segment.
52
+ */
53
+ prompt: z.string().optional(),
51
54
 
52
- /**
53
- * The sampling temperature, between 0 and 1.
54
- * @default 0
55
- */
56
- temperature: z.number().min(0).max(1).default(0).optional(),
55
+ /**
56
+ * The sampling temperature, between 0 and 1.
57
+ * @default 0
58
+ */
59
+ temperature: z.number().min(0).max(1).default(0).optional(),
57
60
 
58
- /**
59
- * The timestamp granularities to populate for this transcription.
60
- * Defaults to ['segment'] when the response format is verbose_json.
61
- */
62
- timestampGranularities: z.array(z.enum(['word', 'segment'])).optional(),
61
+ /**
62
+ * The timestamp granularities to populate for this transcription.
63
+ * Defaults to ['segment'] when the response format is verbose_json.
64
+ */
65
+ timestampGranularities: z.array(z.enum(['word', 'segment'])).optional(),
63
66
 
64
- /**
65
- * The format of the transcription response.
66
- */
67
- responseFormat: z
68
- .enum(['json', 'verbose_json', 'diarized_json'])
69
- .optional(),
67
+ /**
68
+ * The format of the transcription response.
69
+ */
70
+ responseFormat: z.enum(['json', 'verbose_json', 'diarized_json']).optional(),
71
+
72
+ /**
73
+ * Controls how the audio is split into chunks before transcription.
74
+ */
75
+ chunkingStrategy: z
76
+ .union([
77
+ z.literal('auto'),
78
+ z.object({
79
+ type: z.literal('server_vad'),
80
+ threshold: z.number().min(0).max(1).optional(),
81
+ prefixPaddingMs: z.number().int().min(0).optional(),
82
+ silenceDurationMs: z.number().int().min(0).optional(),
83
+ }),
84
+ ])
85
+ .optional(),
70
86
 
87
+ /**
88
+ * Options for streaming transcription models such as `gpt-live-transcribe`.
89
+ */
90
+ streaming: z
91
+ .object({
71
92
  /**
72
- * Controls how the audio is split into chunks before transcription.
93
+ * Latency/accuracy tradeoff for realtime transcription.
73
94
  */
74
- chunkingStrategy: z
75
- .union([
76
- z.literal('auto'),
77
- z.object({
78
- type: z.literal('server_vad'),
79
- threshold: z.number().min(0).max(1).optional(),
80
- prefixPaddingMs: z.number().int().min(0).optional(),
81
- silenceDurationMs: z.number().int().min(0).optional(),
82
- }),
83
- ])
84
- .optional(),
95
+ delay: z.enum(['minimal', 'low', 'medium', 'high', 'xhigh']).optional(),
85
96
 
86
97
  /**
87
- * Options for streaming transcription models such as `gpt-live-transcribe`.
98
+ * Additional fields to include in realtime transcription events.
88
99
  */
89
- streaming: z
90
- .object({
91
- /**
92
- * Latency/accuracy tradeoff for realtime transcription.
93
- */
94
- delay: z
95
- .enum(['minimal', 'low', 'medium', 'high', 'xhigh'])
96
- .optional(),
100
+ include: z.array(z.string()).optional(),
101
+ })
102
+ .optional(),
103
+ });
97
104
 
98
- /**
99
- * Additional fields to include in realtime transcription events.
100
- */
101
- include: z.array(z.string()).optional(),
102
- })
103
- .optional(),
104
- }),
105
- ),
105
+ export const openAITranscriptionModelOptions = lazySchema(() =>
106
+ zodSchema(z.object(openAITranscriptionModelOptionsShape())),
106
107
  );
107
108
 
108
109
  export type OpenAITranscriptionModelOptions = InferSchema<