@ai-sdk/openai 2.0.0-canary.2 → 2.0.0-canary.4

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.
@@ -1,4 +1,4 @@
1
- import { LanguageModelV2, EmbeddingModelV1, ImageModelV1 } from '@ai-sdk/provider';
1
+ import { LanguageModelV2, EmbeddingModelV1, ImageModelV1, TranscriptionModelV1CallOptions, TranscriptionModelV1 } from '@ai-sdk/provider';
2
2
  import { FetchFunction } from '@ai-sdk/provider-utils';
3
3
  import { z } from 'zod';
4
4
 
@@ -244,6 +244,71 @@ declare class OpenAIImageModel implements ImageModelV1 {
244
244
  doGenerate({ prompt, n, size, aspectRatio, seed, providerOptions, headers, abortSignal, }: Parameters<ImageModelV1['doGenerate']>[0]): Promise<Awaited<ReturnType<ImageModelV1['doGenerate']>>>;
245
245
  }
246
246
 
247
+ type OpenAITranscriptionModelId = 'whisper-1' | 'gpt-4o-mini-transcribe' | 'gpt-4o-transcribe' | (string & {});
248
+ type OpenAITranscriptionModelOptions = {
249
+ /**
250
+ * Additional information to include in the transcription response.
251
+ */
252
+ include?: string[];
253
+ /**
254
+ * The language of the input audio in ISO-639-1 format.
255
+ */
256
+ language?: string;
257
+ /**
258
+ * An optional text to guide the model's style or continue a previous audio segment.
259
+ */
260
+ prompt?: string;
261
+ /**
262
+ * The sampling temperature, between 0 and 1.
263
+ * @default 0
264
+ */
265
+ temperature?: number;
266
+ /**
267
+ * The timestamp granularities to populate for this transcription.
268
+ * @default ['segment']
269
+ */
270
+ timestamp_granularities?: Array<'word' | 'segment'>;
271
+ };
272
+
273
+ declare const OpenAIProviderOptionsSchema: z.ZodObject<{
274
+ include: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
275
+ language: z.ZodOptional<z.ZodString>;
276
+ prompt: z.ZodOptional<z.ZodString>;
277
+ temperature: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
278
+ timestampGranularities: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodEnum<["word", "segment"]>, "many">>>;
279
+ }, "strip", z.ZodTypeAny, {
280
+ temperature: number;
281
+ timestampGranularities: ("word" | "segment")[];
282
+ prompt?: string | undefined;
283
+ include?: string[] | undefined;
284
+ language?: string | undefined;
285
+ }, {
286
+ prompt?: string | undefined;
287
+ temperature?: number | undefined;
288
+ include?: string[] | undefined;
289
+ language?: string | undefined;
290
+ timestampGranularities?: ("word" | "segment")[] | undefined;
291
+ }>;
292
+ type OpenAITranscriptionCallOptions = Omit<TranscriptionModelV1CallOptions, 'providerOptions'> & {
293
+ providerOptions?: {
294
+ openai?: z.infer<typeof OpenAIProviderOptionsSchema>;
295
+ };
296
+ };
297
+ interface OpenAITranscriptionModelConfig extends OpenAIConfig {
298
+ _internal?: {
299
+ currentDate?: () => Date;
300
+ };
301
+ }
302
+ declare class OpenAITranscriptionModel implements TranscriptionModelV1 {
303
+ readonly modelId: OpenAITranscriptionModelId;
304
+ private readonly config;
305
+ readonly specificationVersion = "v1";
306
+ get provider(): string;
307
+ constructor(modelId: OpenAITranscriptionModelId, config: OpenAITranscriptionModelConfig);
308
+ private getArgs;
309
+ doGenerate(options: OpenAITranscriptionCallOptions): Promise<Awaited<ReturnType<TranscriptionModelV1['doGenerate']>>>;
310
+ }
311
+
247
312
  type OpenAIResponsesModelId = 'o1' | 'o1-2024-12-17' | 'o1-mini' | 'o1-mini-2024-09-12' | 'o1-preview' | 'o1-preview-2024-09-12' | 'o3-mini' | 'o3-mini-2025-01-31' | 'gpt-4o' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-mini' | 'gpt-4o-mini-2024-07-18' | 'gpt-4-turbo' | 'gpt-4-turbo-2024-04-09' | 'gpt-4-turbo-preview' | 'gpt-4-0125-preview' | 'gpt-4-1106-preview' | 'gpt-4' | 'gpt-4-0613' | 'gpt-4.5-preview' | 'gpt-4.5-preview-2025-02-27' | 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo' | 'gpt-3.5-turbo-1106' | 'chatgpt-4o-latest' | (string & {});
248
313
 
249
314
  declare class OpenAIResponsesLanguageModel implements LanguageModelV2 {
@@ -287,4 +352,4 @@ declare const openaiResponsesProviderOptionsSchema: z.ZodObject<{
287
352
  }>;
288
353
  type OpenAIResponsesProviderOptions = z.infer<typeof openaiResponsesProviderOptionsSchema>;
289
354
 
290
- export { OpenAIChatLanguageModel, type OpenAIChatModelId, type OpenAIChatSettings, OpenAICompletionLanguageModel, type OpenAICompletionModelId, type OpenAICompletionSettings, OpenAIEmbeddingModel, type OpenAIEmbeddingModelId, type OpenAIEmbeddingSettings, OpenAIImageModel, type OpenAIImageModelId, type OpenAIImageSettings, OpenAIResponsesLanguageModel, type OpenAIResponsesProviderOptions, modelMaxImagesPerCall };
355
+ export { OpenAIChatLanguageModel, type OpenAIChatModelId, type OpenAIChatSettings, OpenAICompletionLanguageModel, type OpenAICompletionModelId, type OpenAICompletionSettings, OpenAIEmbeddingModel, type OpenAIEmbeddingModelId, type OpenAIEmbeddingSettings, OpenAIImageModel, type OpenAIImageModelId, type OpenAIImageSettings, OpenAIResponsesLanguageModel, type OpenAIResponsesProviderOptions, type OpenAITranscriptionCallOptions, OpenAITranscriptionModel, type OpenAITranscriptionModelId, type OpenAITranscriptionModelOptions, modelMaxImagesPerCall };
@@ -1,4 +1,4 @@
1
- import { LanguageModelV2, EmbeddingModelV1, ImageModelV1 } from '@ai-sdk/provider';
1
+ import { LanguageModelV2, EmbeddingModelV1, ImageModelV1, TranscriptionModelV1CallOptions, TranscriptionModelV1 } from '@ai-sdk/provider';
2
2
  import { FetchFunction } from '@ai-sdk/provider-utils';
3
3
  import { z } from 'zod';
4
4
 
@@ -244,6 +244,71 @@ declare class OpenAIImageModel implements ImageModelV1 {
244
244
  doGenerate({ prompt, n, size, aspectRatio, seed, providerOptions, headers, abortSignal, }: Parameters<ImageModelV1['doGenerate']>[0]): Promise<Awaited<ReturnType<ImageModelV1['doGenerate']>>>;
245
245
  }
246
246
 
247
+ type OpenAITranscriptionModelId = 'whisper-1' | 'gpt-4o-mini-transcribe' | 'gpt-4o-transcribe' | (string & {});
248
+ type OpenAITranscriptionModelOptions = {
249
+ /**
250
+ * Additional information to include in the transcription response.
251
+ */
252
+ include?: string[];
253
+ /**
254
+ * The language of the input audio in ISO-639-1 format.
255
+ */
256
+ language?: string;
257
+ /**
258
+ * An optional text to guide the model's style or continue a previous audio segment.
259
+ */
260
+ prompt?: string;
261
+ /**
262
+ * The sampling temperature, between 0 and 1.
263
+ * @default 0
264
+ */
265
+ temperature?: number;
266
+ /**
267
+ * The timestamp granularities to populate for this transcription.
268
+ * @default ['segment']
269
+ */
270
+ timestamp_granularities?: Array<'word' | 'segment'>;
271
+ };
272
+
273
+ declare const OpenAIProviderOptionsSchema: z.ZodObject<{
274
+ include: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
275
+ language: z.ZodOptional<z.ZodString>;
276
+ prompt: z.ZodOptional<z.ZodString>;
277
+ temperature: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
278
+ timestampGranularities: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodEnum<["word", "segment"]>, "many">>>;
279
+ }, "strip", z.ZodTypeAny, {
280
+ temperature: number;
281
+ timestampGranularities: ("word" | "segment")[];
282
+ prompt?: string | undefined;
283
+ include?: string[] | undefined;
284
+ language?: string | undefined;
285
+ }, {
286
+ prompt?: string | undefined;
287
+ temperature?: number | undefined;
288
+ include?: string[] | undefined;
289
+ language?: string | undefined;
290
+ timestampGranularities?: ("word" | "segment")[] | undefined;
291
+ }>;
292
+ type OpenAITranscriptionCallOptions = Omit<TranscriptionModelV1CallOptions, 'providerOptions'> & {
293
+ providerOptions?: {
294
+ openai?: z.infer<typeof OpenAIProviderOptionsSchema>;
295
+ };
296
+ };
297
+ interface OpenAITranscriptionModelConfig extends OpenAIConfig {
298
+ _internal?: {
299
+ currentDate?: () => Date;
300
+ };
301
+ }
302
+ declare class OpenAITranscriptionModel implements TranscriptionModelV1 {
303
+ readonly modelId: OpenAITranscriptionModelId;
304
+ private readonly config;
305
+ readonly specificationVersion = "v1";
306
+ get provider(): string;
307
+ constructor(modelId: OpenAITranscriptionModelId, config: OpenAITranscriptionModelConfig);
308
+ private getArgs;
309
+ doGenerate(options: OpenAITranscriptionCallOptions): Promise<Awaited<ReturnType<TranscriptionModelV1['doGenerate']>>>;
310
+ }
311
+
247
312
  type OpenAIResponsesModelId = 'o1' | 'o1-2024-12-17' | 'o1-mini' | 'o1-mini-2024-09-12' | 'o1-preview' | 'o1-preview-2024-09-12' | 'o3-mini' | 'o3-mini-2025-01-31' | 'gpt-4o' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-mini' | 'gpt-4o-mini-2024-07-18' | 'gpt-4-turbo' | 'gpt-4-turbo-2024-04-09' | 'gpt-4-turbo-preview' | 'gpt-4-0125-preview' | 'gpt-4-1106-preview' | 'gpt-4' | 'gpt-4-0613' | 'gpt-4.5-preview' | 'gpt-4.5-preview-2025-02-27' | 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo' | 'gpt-3.5-turbo-1106' | 'chatgpt-4o-latest' | (string & {});
248
313
 
249
314
  declare class OpenAIResponsesLanguageModel implements LanguageModelV2 {
@@ -287,4 +352,4 @@ declare const openaiResponsesProviderOptionsSchema: z.ZodObject<{
287
352
  }>;
288
353
  type OpenAIResponsesProviderOptions = z.infer<typeof openaiResponsesProviderOptionsSchema>;
289
354
 
290
- export { OpenAIChatLanguageModel, type OpenAIChatModelId, type OpenAIChatSettings, OpenAICompletionLanguageModel, type OpenAICompletionModelId, type OpenAICompletionSettings, OpenAIEmbeddingModel, type OpenAIEmbeddingModelId, type OpenAIEmbeddingSettings, OpenAIImageModel, type OpenAIImageModelId, type OpenAIImageSettings, OpenAIResponsesLanguageModel, type OpenAIResponsesProviderOptions, modelMaxImagesPerCall };
355
+ export { OpenAIChatLanguageModel, type OpenAIChatModelId, type OpenAIChatSettings, OpenAICompletionLanguageModel, type OpenAICompletionModelId, type OpenAICompletionSettings, OpenAIEmbeddingModel, type OpenAIEmbeddingModelId, type OpenAIEmbeddingSettings, OpenAIImageModel, type OpenAIImageModelId, type OpenAIImageSettings, OpenAIResponsesLanguageModel, type OpenAIResponsesProviderOptions, type OpenAITranscriptionCallOptions, OpenAITranscriptionModel, type OpenAITranscriptionModelId, type OpenAITranscriptionModelOptions, modelMaxImagesPerCall };