@ai-sdk/openai 2.0.0-canary.6 → 2.0.0-canary.8
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 +34 -0
- package/dist/index.d.mts +10 -4
- package/dist/index.d.ts +10 -4
- package/dist/index.js +199 -66
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +201 -63
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +37 -9
- package/dist/internal/index.d.ts +37 -9
- package/dist/internal/index.js +295 -168
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +300 -169
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LanguageModelV2,
|
|
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
|
|
|
@@ -214,8 +214,8 @@ interface OpenAIEmbeddingSettings {
|
|
|
214
214
|
user?: string;
|
|
215
215
|
}
|
|
216
216
|
|
|
217
|
-
declare class OpenAIEmbeddingModel implements
|
|
218
|
-
readonly specificationVersion = "
|
|
217
|
+
declare class OpenAIEmbeddingModel implements EmbeddingModelV2<string> {
|
|
218
|
+
readonly specificationVersion = "v2";
|
|
219
219
|
readonly modelId: OpenAIEmbeddingModelId;
|
|
220
220
|
private readonly config;
|
|
221
221
|
private readonly settings;
|
|
@@ -223,7 +223,7 @@ declare class OpenAIEmbeddingModel implements EmbeddingModelV1<string> {
|
|
|
223
223
|
get maxEmbeddingsPerCall(): number;
|
|
224
224
|
get supportsParallelCalls(): boolean;
|
|
225
225
|
constructor(modelId: OpenAIEmbeddingModelId, settings: OpenAIEmbeddingSettings, config: OpenAIConfig);
|
|
226
|
-
doEmbed({ values, headers, abortSignal, }: Parameters<
|
|
226
|
+
doEmbed({ values, headers, abortSignal, }: Parameters<EmbeddingModelV2<string>['doEmbed']>[0]): Promise<Awaited<ReturnType<EmbeddingModelV2<string>['doEmbed']>>>;
|
|
227
227
|
}
|
|
228
228
|
|
|
229
229
|
type OpenAIImageModelId = 'dall-e-3' | 'dall-e-2' | (string & {});
|
|
@@ -278,7 +278,7 @@ type OpenAITranscriptionModelOptions = {
|
|
|
278
278
|
timestamp_granularities?: Array<'word' | 'segment'>;
|
|
279
279
|
};
|
|
280
280
|
|
|
281
|
-
declare const
|
|
281
|
+
declare const openAIProviderOptionsSchema: z.ZodObject<{
|
|
282
282
|
include: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
|
|
283
283
|
language: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
284
284
|
prompt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -299,7 +299,7 @@ declare const OpenAIProviderOptionsSchema: z.ZodObject<{
|
|
|
299
299
|
}>;
|
|
300
300
|
type OpenAITranscriptionCallOptions = Omit<TranscriptionModelV1CallOptions, 'providerOptions'> & {
|
|
301
301
|
providerOptions?: {
|
|
302
|
-
openai?: z.infer<typeof
|
|
302
|
+
openai?: z.infer<typeof openAIProviderOptionsSchema>;
|
|
303
303
|
};
|
|
304
304
|
};
|
|
305
305
|
interface OpenAITranscriptionModelConfig extends OpenAIConfig {
|
|
@@ -317,6 +317,34 @@ declare class OpenAITranscriptionModel implements TranscriptionModelV1 {
|
|
|
317
317
|
doGenerate(options: OpenAITranscriptionCallOptions): Promise<Awaited<ReturnType<TranscriptionModelV1['doGenerate']>>>;
|
|
318
318
|
}
|
|
319
319
|
|
|
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
|
+
|
|
320
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' | '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 & {});
|
|
321
349
|
|
|
322
350
|
declare class OpenAIResponsesLanguageModel implements LanguageModelV2 {
|
|
@@ -345,19 +373,19 @@ declare const openaiResponsesProviderOptionsSchema: z.ZodObject<{
|
|
|
345
373
|
reasoningEffort?: string | null | undefined;
|
|
346
374
|
store?: boolean | null | undefined;
|
|
347
375
|
metadata?: any;
|
|
376
|
+
instructions?: string | null | undefined;
|
|
348
377
|
previousResponseId?: string | null | undefined;
|
|
349
378
|
strictSchemas?: boolean | null | undefined;
|
|
350
|
-
instructions?: string | null | undefined;
|
|
351
379
|
}, {
|
|
352
380
|
user?: string | null | undefined;
|
|
353
381
|
parallelToolCalls?: boolean | null | undefined;
|
|
354
382
|
reasoningEffort?: string | null | undefined;
|
|
355
383
|
store?: boolean | null | undefined;
|
|
356
384
|
metadata?: any;
|
|
385
|
+
instructions?: string | null | undefined;
|
|
357
386
|
previousResponseId?: string | null | undefined;
|
|
358
387
|
strictSchemas?: boolean | null | undefined;
|
|
359
|
-
instructions?: string | null | undefined;
|
|
360
388
|
}>;
|
|
361
389
|
type OpenAIResponsesProviderOptions = z.infer<typeof openaiResponsesProviderOptionsSchema>;
|
|
362
390
|
|
|
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 };
|
|
391
|
+
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,4 +1,4 @@
|
|
|
1
|
-
import { LanguageModelV2,
|
|
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
|
|
|
@@ -214,8 +214,8 @@ interface OpenAIEmbeddingSettings {
|
|
|
214
214
|
user?: string;
|
|
215
215
|
}
|
|
216
216
|
|
|
217
|
-
declare class OpenAIEmbeddingModel implements
|
|
218
|
-
readonly specificationVersion = "
|
|
217
|
+
declare class OpenAIEmbeddingModel implements EmbeddingModelV2<string> {
|
|
218
|
+
readonly specificationVersion = "v2";
|
|
219
219
|
readonly modelId: OpenAIEmbeddingModelId;
|
|
220
220
|
private readonly config;
|
|
221
221
|
private readonly settings;
|
|
@@ -223,7 +223,7 @@ declare class OpenAIEmbeddingModel implements EmbeddingModelV1<string> {
|
|
|
223
223
|
get maxEmbeddingsPerCall(): number;
|
|
224
224
|
get supportsParallelCalls(): boolean;
|
|
225
225
|
constructor(modelId: OpenAIEmbeddingModelId, settings: OpenAIEmbeddingSettings, config: OpenAIConfig);
|
|
226
|
-
doEmbed({ values, headers, abortSignal, }: Parameters<
|
|
226
|
+
doEmbed({ values, headers, abortSignal, }: Parameters<EmbeddingModelV2<string>['doEmbed']>[0]): Promise<Awaited<ReturnType<EmbeddingModelV2<string>['doEmbed']>>>;
|
|
227
227
|
}
|
|
228
228
|
|
|
229
229
|
type OpenAIImageModelId = 'dall-e-3' | 'dall-e-2' | (string & {});
|
|
@@ -278,7 +278,7 @@ type OpenAITranscriptionModelOptions = {
|
|
|
278
278
|
timestamp_granularities?: Array<'word' | 'segment'>;
|
|
279
279
|
};
|
|
280
280
|
|
|
281
|
-
declare const
|
|
281
|
+
declare const openAIProviderOptionsSchema: z.ZodObject<{
|
|
282
282
|
include: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
|
|
283
283
|
language: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
284
284
|
prompt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -299,7 +299,7 @@ declare const OpenAIProviderOptionsSchema: z.ZodObject<{
|
|
|
299
299
|
}>;
|
|
300
300
|
type OpenAITranscriptionCallOptions = Omit<TranscriptionModelV1CallOptions, 'providerOptions'> & {
|
|
301
301
|
providerOptions?: {
|
|
302
|
-
openai?: z.infer<typeof
|
|
302
|
+
openai?: z.infer<typeof openAIProviderOptionsSchema>;
|
|
303
303
|
};
|
|
304
304
|
};
|
|
305
305
|
interface OpenAITranscriptionModelConfig extends OpenAIConfig {
|
|
@@ -317,6 +317,34 @@ declare class OpenAITranscriptionModel implements TranscriptionModelV1 {
|
|
|
317
317
|
doGenerate(options: OpenAITranscriptionCallOptions): Promise<Awaited<ReturnType<TranscriptionModelV1['doGenerate']>>>;
|
|
318
318
|
}
|
|
319
319
|
|
|
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
|
+
|
|
320
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' | '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 & {});
|
|
321
349
|
|
|
322
350
|
declare class OpenAIResponsesLanguageModel implements LanguageModelV2 {
|
|
@@ -345,19 +373,19 @@ declare const openaiResponsesProviderOptionsSchema: z.ZodObject<{
|
|
|
345
373
|
reasoningEffort?: string | null | undefined;
|
|
346
374
|
store?: boolean | null | undefined;
|
|
347
375
|
metadata?: any;
|
|
376
|
+
instructions?: string | null | undefined;
|
|
348
377
|
previousResponseId?: string | null | undefined;
|
|
349
378
|
strictSchemas?: boolean | null | undefined;
|
|
350
|
-
instructions?: string | null | undefined;
|
|
351
379
|
}, {
|
|
352
380
|
user?: string | null | undefined;
|
|
353
381
|
parallelToolCalls?: boolean | null | undefined;
|
|
354
382
|
reasoningEffort?: string | null | undefined;
|
|
355
383
|
store?: boolean | null | undefined;
|
|
356
384
|
metadata?: any;
|
|
385
|
+
instructions?: string | null | undefined;
|
|
357
386
|
previousResponseId?: string | null | undefined;
|
|
358
387
|
strictSchemas?: boolean | null | undefined;
|
|
359
|
-
instructions?: string | null | undefined;
|
|
360
388
|
}>;
|
|
361
389
|
type OpenAIResponsesProviderOptions = z.infer<typeof openaiResponsesProviderOptionsSchema>;
|
|
362
390
|
|
|
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 };
|
|
391
|
+
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 };
|