@ai-sdk/openai 2.0.0-canary.7 → 2.0.0-canary.9
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 +21 -0
- package/dist/index.d.mts +9 -3
- package/dist/index.d.ts +9 -3
- package/dist/index.js +187 -61
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +189 -58
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +35 -6
- package/dist/internal/index.d.ts +35 -6
- package/dist/internal/index.js +284 -164
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +288 -164
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +6 -5
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { LanguageModelV2, EmbeddingModelV2, ImageModelV1, TranscriptionModelV1CallOptions, TranscriptionModelV1 } from '@ai-sdk/provider';
|
|
1
|
+
import { LanguageModelV2, EmbeddingModelV2, ImageModelV1, TranscriptionModelV1CallOptions, TranscriptionModelV1, SpeechModelV1 } from '@ai-sdk/provider';
|
|
2
2
|
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
|
-
type OpenAIChatModelId = '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-audio-preview' | 'gpt-4o-audio-preview-2024-10-01' | 'gpt-4o-audio-preview-2024-12-17' | 'gpt-4o-search-preview' | 'gpt-4o-search-preview-2025-03-11' | '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 & {});
|
|
5
|
+
type OpenAIChatModelId = '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' | 'o3' | 'o3-2025-04-16' | 'o4-mini' | 'o4-mini-2025-04-16' | 'gpt-4.1' | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-nano' | 'gpt-4.1-nano-2025-04-14' | 'gpt-4o' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-audio-preview' | 'gpt-4o-audio-preview-2024-10-01' | 'gpt-4o-audio-preview-2024-12-17' | 'gpt-4o-search-preview' | 'gpt-4o-search-preview-2025-03-11' | 'gpt-4o-mini-search-preview' | 'gpt-4o-mini-search-preview-2025-03-11' | '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 & {});
|
|
6
6
|
declare const openaiProviderOptions: z.ZodObject<{
|
|
7
7
|
/**
|
|
8
8
|
* Modify the likelihood of specified tokens appearing in the completion.
|
|
@@ -317,11 +317,40 @@ declare class OpenAITranscriptionModel implements TranscriptionModelV1 {
|
|
|
317
317
|
doGenerate(options: OpenAITranscriptionCallOptions): Promise<Awaited<ReturnType<TranscriptionModelV1['doGenerate']>>>;
|
|
318
318
|
}
|
|
319
319
|
|
|
320
|
-
type
|
|
320
|
+
type OpenAISpeechModelId = 'tts-1' | 'tts-1-hd' | 'gpt-4o-mini-tts' | (string & {});
|
|
321
|
+
|
|
322
|
+
declare const OpenAIProviderOptionsSchema: z.ZodObject<{
|
|
323
|
+
instructions: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
324
|
+
speed: z.ZodOptional<z.ZodNullable<z.ZodDefault<z.ZodNumber>>>;
|
|
325
|
+
}, "strip", z.ZodTypeAny, {
|
|
326
|
+
instructions?: string | null | undefined;
|
|
327
|
+
speed?: number | null | undefined;
|
|
328
|
+
}, {
|
|
329
|
+
instructions?: string | null | undefined;
|
|
330
|
+
speed?: number | null | undefined;
|
|
331
|
+
}>;
|
|
332
|
+
type OpenAISpeechCallOptions = z.infer<typeof OpenAIProviderOptionsSchema>;
|
|
333
|
+
interface OpenAISpeechModelConfig extends OpenAIConfig {
|
|
334
|
+
_internal?: {
|
|
335
|
+
currentDate?: () => Date;
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
declare class OpenAISpeechModel implements SpeechModelV1 {
|
|
339
|
+
readonly modelId: OpenAISpeechModelId;
|
|
340
|
+
private readonly config;
|
|
341
|
+
readonly specificationVersion = "v1";
|
|
342
|
+
get provider(): string;
|
|
343
|
+
constructor(modelId: OpenAISpeechModelId, config: OpenAISpeechModelConfig);
|
|
344
|
+
private getArgs;
|
|
345
|
+
doGenerate(options: Parameters<SpeechModelV1['doGenerate']>[0]): Promise<Awaited<ReturnType<SpeechModelV1['doGenerate']>>>;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
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' | 'o3' | 'o3-2025-04-16' | 'o4-mini' | 'o4-mini-2025-04-16' | 'gpt-4.1' | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-nano' | 'gpt-4.1-nano-2025-04-14' | 'gpt-4o' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-audio-preview' | 'gpt-4o-audio-preview-2024-10-01' | 'gpt-4o-audio-preview-2024-12-17' | 'gpt-4o-search-preview' | 'gpt-4o-search-preview-2025-03-11' | 'gpt-4o-mini-search-preview' | 'gpt-4o-mini-search-preview-2025-03-11' | '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 & {});
|
|
321
349
|
|
|
322
350
|
declare class OpenAIResponsesLanguageModel implements LanguageModelV2 {
|
|
323
351
|
readonly specificationVersion = "v2";
|
|
324
352
|
readonly defaultObjectGenerationMode = "json";
|
|
353
|
+
readonly supportsStructuredOutputs = true;
|
|
325
354
|
readonly modelId: OpenAIResponsesModelId;
|
|
326
355
|
private readonly config;
|
|
327
356
|
constructor(modelId: OpenAIResponsesModelId, config: OpenAIConfig);
|
|
@@ -345,19 +374,19 @@ declare const openaiResponsesProviderOptionsSchema: z.ZodObject<{
|
|
|
345
374
|
reasoningEffort?: string | null | undefined;
|
|
346
375
|
store?: boolean | null | undefined;
|
|
347
376
|
metadata?: any;
|
|
377
|
+
instructions?: string | null | undefined;
|
|
348
378
|
previousResponseId?: string | null | undefined;
|
|
349
379
|
strictSchemas?: boolean | null | undefined;
|
|
350
|
-
instructions?: string | null | undefined;
|
|
351
380
|
}, {
|
|
352
381
|
user?: string | null | undefined;
|
|
353
382
|
parallelToolCalls?: boolean | null | undefined;
|
|
354
383
|
reasoningEffort?: string | null | undefined;
|
|
355
384
|
store?: boolean | null | undefined;
|
|
356
385
|
metadata?: any;
|
|
386
|
+
instructions?: string | null | undefined;
|
|
357
387
|
previousResponseId?: string | null | undefined;
|
|
358
388
|
strictSchemas?: boolean | null | undefined;
|
|
359
|
-
instructions?: string | null | undefined;
|
|
360
389
|
}>;
|
|
361
390
|
type OpenAIResponsesProviderOptions = z.infer<typeof openaiResponsesProviderOptionsSchema>;
|
|
362
391
|
|
|
363
|
-
export { OpenAIChatLanguageModel, type OpenAIChatModelId, type OpenAIChatSettings, OpenAICompletionLanguageModel, type OpenAICompletionModelId, type OpenAICompletionSettings, OpenAIEmbeddingModel, type OpenAIEmbeddingModelId, type OpenAIEmbeddingSettings, OpenAIImageModel, type OpenAIImageModelId, type OpenAIImageSettings, type OpenAIProviderOptions, OpenAIResponsesLanguageModel, type OpenAIResponsesProviderOptions, type OpenAITranscriptionCallOptions, OpenAITranscriptionModel, type OpenAITranscriptionModelId, type OpenAITranscriptionModelOptions, modelMaxImagesPerCall, openaiProviderOptions };
|
|
392
|
+
export { OpenAIChatLanguageModel, type OpenAIChatModelId, type OpenAIChatSettings, OpenAICompletionLanguageModel, type OpenAICompletionModelId, type OpenAICompletionSettings, OpenAIEmbeddingModel, type OpenAIEmbeddingModelId, type OpenAIEmbeddingSettings, OpenAIImageModel, type OpenAIImageModelId, type OpenAIImageSettings, type OpenAIProviderOptions, OpenAIResponsesLanguageModel, type OpenAIResponsesProviderOptions, type OpenAISpeechCallOptions, OpenAISpeechModel, type OpenAISpeechModelId, type OpenAITranscriptionCallOptions, OpenAITranscriptionModel, type OpenAITranscriptionModelId, type OpenAITranscriptionModelOptions, modelMaxImagesPerCall, openaiProviderOptions };
|
package/dist/internal/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { LanguageModelV2, EmbeddingModelV2, ImageModelV1, TranscriptionModelV1CallOptions, TranscriptionModelV1 } from '@ai-sdk/provider';
|
|
1
|
+
import { LanguageModelV2, EmbeddingModelV2, ImageModelV1, TranscriptionModelV1CallOptions, TranscriptionModelV1, SpeechModelV1 } from '@ai-sdk/provider';
|
|
2
2
|
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
|
-
type OpenAIChatModelId = '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-audio-preview' | 'gpt-4o-audio-preview-2024-10-01' | 'gpt-4o-audio-preview-2024-12-17' | 'gpt-4o-search-preview' | 'gpt-4o-search-preview-2025-03-11' | '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 & {});
|
|
5
|
+
type OpenAIChatModelId = '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' | 'o3' | 'o3-2025-04-16' | 'o4-mini' | 'o4-mini-2025-04-16' | 'gpt-4.1' | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-nano' | 'gpt-4.1-nano-2025-04-14' | 'gpt-4o' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-audio-preview' | 'gpt-4o-audio-preview-2024-10-01' | 'gpt-4o-audio-preview-2024-12-17' | 'gpt-4o-search-preview' | 'gpt-4o-search-preview-2025-03-11' | 'gpt-4o-mini-search-preview' | 'gpt-4o-mini-search-preview-2025-03-11' | '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 & {});
|
|
6
6
|
declare const openaiProviderOptions: z.ZodObject<{
|
|
7
7
|
/**
|
|
8
8
|
* Modify the likelihood of specified tokens appearing in the completion.
|
|
@@ -317,11 +317,40 @@ declare class OpenAITranscriptionModel implements TranscriptionModelV1 {
|
|
|
317
317
|
doGenerate(options: OpenAITranscriptionCallOptions): Promise<Awaited<ReturnType<TranscriptionModelV1['doGenerate']>>>;
|
|
318
318
|
}
|
|
319
319
|
|
|
320
|
-
type
|
|
320
|
+
type OpenAISpeechModelId = 'tts-1' | 'tts-1-hd' | 'gpt-4o-mini-tts' | (string & {});
|
|
321
|
+
|
|
322
|
+
declare const OpenAIProviderOptionsSchema: z.ZodObject<{
|
|
323
|
+
instructions: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
324
|
+
speed: z.ZodOptional<z.ZodNullable<z.ZodDefault<z.ZodNumber>>>;
|
|
325
|
+
}, "strip", z.ZodTypeAny, {
|
|
326
|
+
instructions?: string | null | undefined;
|
|
327
|
+
speed?: number | null | undefined;
|
|
328
|
+
}, {
|
|
329
|
+
instructions?: string | null | undefined;
|
|
330
|
+
speed?: number | null | undefined;
|
|
331
|
+
}>;
|
|
332
|
+
type OpenAISpeechCallOptions = z.infer<typeof OpenAIProviderOptionsSchema>;
|
|
333
|
+
interface OpenAISpeechModelConfig extends OpenAIConfig {
|
|
334
|
+
_internal?: {
|
|
335
|
+
currentDate?: () => Date;
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
declare class OpenAISpeechModel implements SpeechModelV1 {
|
|
339
|
+
readonly modelId: OpenAISpeechModelId;
|
|
340
|
+
private readonly config;
|
|
341
|
+
readonly specificationVersion = "v1";
|
|
342
|
+
get provider(): string;
|
|
343
|
+
constructor(modelId: OpenAISpeechModelId, config: OpenAISpeechModelConfig);
|
|
344
|
+
private getArgs;
|
|
345
|
+
doGenerate(options: Parameters<SpeechModelV1['doGenerate']>[0]): Promise<Awaited<ReturnType<SpeechModelV1['doGenerate']>>>;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
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' | 'o3' | 'o3-2025-04-16' | 'o4-mini' | 'o4-mini-2025-04-16' | 'gpt-4.1' | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-nano' | 'gpt-4.1-nano-2025-04-14' | 'gpt-4o' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-audio-preview' | 'gpt-4o-audio-preview-2024-10-01' | 'gpt-4o-audio-preview-2024-12-17' | 'gpt-4o-search-preview' | 'gpt-4o-search-preview-2025-03-11' | 'gpt-4o-mini-search-preview' | 'gpt-4o-mini-search-preview-2025-03-11' | '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 & {});
|
|
321
349
|
|
|
322
350
|
declare class OpenAIResponsesLanguageModel implements LanguageModelV2 {
|
|
323
351
|
readonly specificationVersion = "v2";
|
|
324
352
|
readonly defaultObjectGenerationMode = "json";
|
|
353
|
+
readonly supportsStructuredOutputs = true;
|
|
325
354
|
readonly modelId: OpenAIResponsesModelId;
|
|
326
355
|
private readonly config;
|
|
327
356
|
constructor(modelId: OpenAIResponsesModelId, config: OpenAIConfig);
|
|
@@ -345,19 +374,19 @@ declare const openaiResponsesProviderOptionsSchema: z.ZodObject<{
|
|
|
345
374
|
reasoningEffort?: string | null | undefined;
|
|
346
375
|
store?: boolean | null | undefined;
|
|
347
376
|
metadata?: any;
|
|
377
|
+
instructions?: string | null | undefined;
|
|
348
378
|
previousResponseId?: string | null | undefined;
|
|
349
379
|
strictSchemas?: boolean | null | undefined;
|
|
350
|
-
instructions?: string | null | undefined;
|
|
351
380
|
}, {
|
|
352
381
|
user?: string | null | undefined;
|
|
353
382
|
parallelToolCalls?: boolean | null | undefined;
|
|
354
383
|
reasoningEffort?: string | null | undefined;
|
|
355
384
|
store?: boolean | null | undefined;
|
|
356
385
|
metadata?: any;
|
|
386
|
+
instructions?: string | null | undefined;
|
|
357
387
|
previousResponseId?: string | null | undefined;
|
|
358
388
|
strictSchemas?: boolean | null | undefined;
|
|
359
|
-
instructions?: string | null | undefined;
|
|
360
389
|
}>;
|
|
361
390
|
type OpenAIResponsesProviderOptions = z.infer<typeof openaiResponsesProviderOptionsSchema>;
|
|
362
391
|
|
|
363
|
-
export { OpenAIChatLanguageModel, type OpenAIChatModelId, type OpenAIChatSettings, OpenAICompletionLanguageModel, type OpenAICompletionModelId, type OpenAICompletionSettings, OpenAIEmbeddingModel, type OpenAIEmbeddingModelId, type OpenAIEmbeddingSettings, OpenAIImageModel, type OpenAIImageModelId, type OpenAIImageSettings, type OpenAIProviderOptions, OpenAIResponsesLanguageModel, type OpenAIResponsesProviderOptions, type OpenAITranscriptionCallOptions, OpenAITranscriptionModel, type OpenAITranscriptionModelId, type OpenAITranscriptionModelOptions, modelMaxImagesPerCall, openaiProviderOptions };
|
|
392
|
+
export { OpenAIChatLanguageModel, type OpenAIChatModelId, type OpenAIChatSettings, OpenAICompletionLanguageModel, type OpenAICompletionModelId, type OpenAICompletionSettings, OpenAIEmbeddingModel, type OpenAIEmbeddingModelId, type OpenAIEmbeddingSettings, OpenAIImageModel, type OpenAIImageModelId, type OpenAIImageSettings, type OpenAIProviderOptions, OpenAIResponsesLanguageModel, type OpenAIResponsesProviderOptions, type OpenAISpeechCallOptions, OpenAISpeechModel, type OpenAISpeechModelId, type OpenAITranscriptionCallOptions, OpenAITranscriptionModel, type OpenAITranscriptionModelId, type OpenAITranscriptionModelOptions, modelMaxImagesPerCall, openaiProviderOptions };
|