@ai-sdk/openai 0.0.0-013d7476-20250808163325
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 +1814 -0
- package/LICENSE +13 -0
- package/README.md +36 -0
- package/dist/index.d.mts +191 -0
- package/dist/index.d.ts +191 -0
- package/dist/index.js +3361 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +3394 -0
- package/dist/index.mjs.map +1 -0
- package/dist/internal/index.d.mts +229 -0
- package/dist/internal/index.d.ts +229 -0
- package/dist/internal/index.js +3286 -0
- package/dist/internal/index.js.map +1 -0
- package/dist/internal/index.mjs +3305 -0
- package/dist/internal/index.mjs.map +1 -0
- package/internal.d.ts +1 -0
- package/package.json +72 -0
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import { LanguageModelV2, EmbeddingModelV2, ImageModelV2, TranscriptionModelV2CallOptions, TranscriptionModelV2, SpeechModelV2 } from '@ai-sdk/provider';
|
|
2
|
+
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
3
|
+
import { z } from 'zod/v4';
|
|
4
|
+
|
|
5
|
+
type OpenAIChatModelId = 'o1' | 'o1-2024-12-17' | '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' | 'gpt-5' | 'gpt-5-2025-08-07' | 'gpt-5-mini' | 'gpt-5-mini-2025-08-07' | 'gpt-5-nano' | 'gpt-5-nano-2025-08-07' | 'gpt-5-chat-latest' | (string & {});
|
|
6
|
+
declare const openaiProviderOptions: z.ZodObject<{
|
|
7
|
+
logitBias: z.ZodOptional<z.ZodRecord<z.ZodCoercedNumber<string>, z.ZodNumber>>;
|
|
8
|
+
logprobs: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber]>>;
|
|
9
|
+
parallelToolCalls: z.ZodOptional<z.ZodBoolean>;
|
|
10
|
+
user: z.ZodOptional<z.ZodString>;
|
|
11
|
+
reasoningEffort: z.ZodOptional<z.ZodEnum<{
|
|
12
|
+
low: "low";
|
|
13
|
+
medium: "medium";
|
|
14
|
+
high: "high";
|
|
15
|
+
}>>;
|
|
16
|
+
maxCompletionTokens: z.ZodOptional<z.ZodNumber>;
|
|
17
|
+
store: z.ZodOptional<z.ZodBoolean>;
|
|
18
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
19
|
+
prediction: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
20
|
+
structuredOutputs: z.ZodOptional<z.ZodBoolean>;
|
|
21
|
+
serviceTier: z.ZodOptional<z.ZodEnum<{
|
|
22
|
+
auto: "auto";
|
|
23
|
+
flex: "flex";
|
|
24
|
+
priority: "priority";
|
|
25
|
+
}>>;
|
|
26
|
+
strictJsonSchema: z.ZodOptional<z.ZodBoolean>;
|
|
27
|
+
}, z.core.$strip>;
|
|
28
|
+
type OpenAIProviderOptions = z.infer<typeof openaiProviderOptions>;
|
|
29
|
+
|
|
30
|
+
type OpenAIChatConfig = {
|
|
31
|
+
provider: string;
|
|
32
|
+
headers: () => Record<string, string | undefined>;
|
|
33
|
+
url: (options: {
|
|
34
|
+
modelId: string;
|
|
35
|
+
path: string;
|
|
36
|
+
}) => string;
|
|
37
|
+
fetch?: FetchFunction;
|
|
38
|
+
};
|
|
39
|
+
declare class OpenAIChatLanguageModel implements LanguageModelV2 {
|
|
40
|
+
readonly specificationVersion = "v2";
|
|
41
|
+
readonly modelId: OpenAIChatModelId;
|
|
42
|
+
readonly supportedUrls: {
|
|
43
|
+
'image/*': RegExp[];
|
|
44
|
+
};
|
|
45
|
+
private readonly config;
|
|
46
|
+
constructor(modelId: OpenAIChatModelId, config: OpenAIChatConfig);
|
|
47
|
+
get provider(): string;
|
|
48
|
+
private getArgs;
|
|
49
|
+
doGenerate(options: Parameters<LanguageModelV2['doGenerate']>[0]): Promise<Awaited<ReturnType<LanguageModelV2['doGenerate']>>>;
|
|
50
|
+
doStream(options: Parameters<LanguageModelV2['doStream']>[0]): Promise<Awaited<ReturnType<LanguageModelV2['doStream']>>>;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
type OpenAICompletionModelId = 'gpt-3.5-turbo-instruct' | (string & {});
|
|
54
|
+
declare const openaiCompletionProviderOptions: z.ZodObject<{
|
|
55
|
+
echo: z.ZodOptional<z.ZodBoolean>;
|
|
56
|
+
logitBias: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
57
|
+
suffix: z.ZodOptional<z.ZodString>;
|
|
58
|
+
user: z.ZodOptional<z.ZodString>;
|
|
59
|
+
logprobs: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber]>>;
|
|
60
|
+
}, z.core.$strip>;
|
|
61
|
+
type OpenAICompletionProviderOptions = z.infer<typeof openaiCompletionProviderOptions>;
|
|
62
|
+
|
|
63
|
+
type OpenAICompletionConfig = {
|
|
64
|
+
provider: string;
|
|
65
|
+
headers: () => Record<string, string | undefined>;
|
|
66
|
+
url: (options: {
|
|
67
|
+
modelId: string;
|
|
68
|
+
path: string;
|
|
69
|
+
}) => string;
|
|
70
|
+
fetch?: FetchFunction;
|
|
71
|
+
};
|
|
72
|
+
declare class OpenAICompletionLanguageModel implements LanguageModelV2 {
|
|
73
|
+
readonly specificationVersion = "v2";
|
|
74
|
+
readonly modelId: OpenAICompletionModelId;
|
|
75
|
+
private readonly config;
|
|
76
|
+
private get providerOptionsName();
|
|
77
|
+
constructor(modelId: OpenAICompletionModelId, config: OpenAICompletionConfig);
|
|
78
|
+
get provider(): string;
|
|
79
|
+
readonly supportedUrls: Record<string, RegExp[]>;
|
|
80
|
+
private getArgs;
|
|
81
|
+
doGenerate(options: Parameters<LanguageModelV2['doGenerate']>[0]): Promise<Awaited<ReturnType<LanguageModelV2['doGenerate']>>>;
|
|
82
|
+
doStream(options: Parameters<LanguageModelV2['doStream']>[0]): Promise<Awaited<ReturnType<LanguageModelV2['doStream']>>>;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
type OpenAIConfig = {
|
|
86
|
+
provider: string;
|
|
87
|
+
url: (options: {
|
|
88
|
+
modelId: string;
|
|
89
|
+
path: string;
|
|
90
|
+
}) => string;
|
|
91
|
+
headers: () => Record<string, string | undefined>;
|
|
92
|
+
fetch?: FetchFunction;
|
|
93
|
+
generateId?: () => string;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
type OpenAIEmbeddingModelId = 'text-embedding-3-small' | 'text-embedding-3-large' | 'text-embedding-ada-002' | (string & {});
|
|
97
|
+
declare const openaiEmbeddingProviderOptions: z.ZodObject<{
|
|
98
|
+
dimensions: z.ZodOptional<z.ZodNumber>;
|
|
99
|
+
user: z.ZodOptional<z.ZodString>;
|
|
100
|
+
}, z.core.$strip>;
|
|
101
|
+
type OpenAIEmbeddingProviderOptions = z.infer<typeof openaiEmbeddingProviderOptions>;
|
|
102
|
+
|
|
103
|
+
declare class OpenAIEmbeddingModel implements EmbeddingModelV2<string> {
|
|
104
|
+
readonly specificationVersion = "v2";
|
|
105
|
+
readonly modelId: OpenAIEmbeddingModelId;
|
|
106
|
+
readonly maxEmbeddingsPerCall = 2048;
|
|
107
|
+
readonly supportsParallelCalls = true;
|
|
108
|
+
private readonly config;
|
|
109
|
+
get provider(): string;
|
|
110
|
+
constructor(modelId: OpenAIEmbeddingModelId, config: OpenAIConfig);
|
|
111
|
+
doEmbed({ values, headers, abortSignal, providerOptions, }: Parameters<EmbeddingModelV2<string>['doEmbed']>[0]): Promise<Awaited<ReturnType<EmbeddingModelV2<string>['doEmbed']>>>;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
type OpenAIImageModelId = 'gpt-image-1' | 'dall-e-3' | 'dall-e-2' | (string & {});
|
|
115
|
+
declare const modelMaxImagesPerCall: Record<OpenAIImageModelId, number>;
|
|
116
|
+
declare const hasDefaultResponseFormat: Set<string>;
|
|
117
|
+
|
|
118
|
+
interface OpenAIImageModelConfig extends OpenAIConfig {
|
|
119
|
+
_internal?: {
|
|
120
|
+
currentDate?: () => Date;
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
declare class OpenAIImageModel implements ImageModelV2 {
|
|
124
|
+
readonly modelId: OpenAIImageModelId;
|
|
125
|
+
private readonly config;
|
|
126
|
+
readonly specificationVersion = "v2";
|
|
127
|
+
get maxImagesPerCall(): number;
|
|
128
|
+
get provider(): string;
|
|
129
|
+
constructor(modelId: OpenAIImageModelId, config: OpenAIImageModelConfig);
|
|
130
|
+
doGenerate({ prompt, n, size, aspectRatio, seed, providerOptions, headers, abortSignal, }: Parameters<ImageModelV2['doGenerate']>[0]): Promise<Awaited<ReturnType<ImageModelV2['doGenerate']>>>;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
type OpenAITranscriptionModelId = 'whisper-1' | 'gpt-4o-mini-transcribe' | 'gpt-4o-transcribe' | (string & {});
|
|
134
|
+
declare const openAITranscriptionProviderOptions: z.ZodObject<{
|
|
135
|
+
include: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
136
|
+
language: z.ZodOptional<z.ZodString>;
|
|
137
|
+
prompt: z.ZodOptional<z.ZodString>;
|
|
138
|
+
temperature: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
139
|
+
timestampGranularities: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
140
|
+
word: "word";
|
|
141
|
+
segment: "segment";
|
|
142
|
+
}>>>>;
|
|
143
|
+
}, z.core.$strip>;
|
|
144
|
+
type OpenAITranscriptionProviderOptions = z.infer<typeof openAITranscriptionProviderOptions>;
|
|
145
|
+
|
|
146
|
+
type OpenAITranscriptionCallOptions = Omit<TranscriptionModelV2CallOptions, 'providerOptions'> & {
|
|
147
|
+
providerOptions?: {
|
|
148
|
+
openai?: OpenAITranscriptionProviderOptions;
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
interface OpenAITranscriptionModelConfig extends OpenAIConfig {
|
|
152
|
+
_internal?: {
|
|
153
|
+
currentDate?: () => Date;
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
declare class OpenAITranscriptionModel implements TranscriptionModelV2 {
|
|
157
|
+
readonly modelId: OpenAITranscriptionModelId;
|
|
158
|
+
private readonly config;
|
|
159
|
+
readonly specificationVersion = "v2";
|
|
160
|
+
get provider(): string;
|
|
161
|
+
constructor(modelId: OpenAITranscriptionModelId, config: OpenAITranscriptionModelConfig);
|
|
162
|
+
private getArgs;
|
|
163
|
+
doGenerate(options: OpenAITranscriptionCallOptions): Promise<Awaited<ReturnType<TranscriptionModelV2['doGenerate']>>>;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
type OpenAISpeechModelId = 'tts-1' | 'tts-1-hd' | 'gpt-4o-mini-tts' | (string & {});
|
|
167
|
+
|
|
168
|
+
declare const OpenAIProviderOptionsSchema: z.ZodObject<{
|
|
169
|
+
instructions: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
170
|
+
speed: z.ZodOptional<z.ZodNullable<z.ZodDefault<z.ZodNumber>>>;
|
|
171
|
+
}, z.core.$strip>;
|
|
172
|
+
type OpenAISpeechCallOptions = z.infer<typeof OpenAIProviderOptionsSchema>;
|
|
173
|
+
interface OpenAISpeechModelConfig extends OpenAIConfig {
|
|
174
|
+
_internal?: {
|
|
175
|
+
currentDate?: () => Date;
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
declare class OpenAISpeechModel implements SpeechModelV2 {
|
|
179
|
+
readonly modelId: OpenAISpeechModelId;
|
|
180
|
+
private readonly config;
|
|
181
|
+
readonly specificationVersion = "v2";
|
|
182
|
+
get provider(): string;
|
|
183
|
+
constructor(modelId: OpenAISpeechModelId, config: OpenAISpeechModelConfig);
|
|
184
|
+
private getArgs;
|
|
185
|
+
doGenerate(options: Parameters<SpeechModelV2['doGenerate']>[0]): Promise<Awaited<ReturnType<SpeechModelV2['doGenerate']>>>;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
declare const openaiResponsesModelIds: readonly ["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", "o1", "o1-2024-12-17", "o3-mini", "o3-mini-2025-01-31", "o3", "o3-2025-04-16", "o4-mini", "o4-mini-2025-04-16", "codex-mini-latest", "computer-use-preview", "gpt-5", "gpt-5-2025-08-07", "gpt-5-mini", "gpt-5-mini-2025-08-07", "gpt-5-nano", "gpt-5-nano-2025-08-07", "gpt-5-chat-latest"];
|
|
189
|
+
type OpenAIResponsesModelId = (typeof openaiResponsesModelIds)[number] | (string & {});
|
|
190
|
+
|
|
191
|
+
declare class OpenAIResponsesLanguageModel implements LanguageModelV2 {
|
|
192
|
+
readonly specificationVersion = "v2";
|
|
193
|
+
readonly modelId: OpenAIResponsesModelId;
|
|
194
|
+
private readonly config;
|
|
195
|
+
constructor(modelId: OpenAIResponsesModelId, config: OpenAIConfig);
|
|
196
|
+
readonly supportedUrls: Record<string, RegExp[]>;
|
|
197
|
+
get provider(): string;
|
|
198
|
+
private getArgs;
|
|
199
|
+
doGenerate(options: Parameters<LanguageModelV2['doGenerate']>[0]): Promise<Awaited<ReturnType<LanguageModelV2['doGenerate']>>>;
|
|
200
|
+
doStream(options: Parameters<LanguageModelV2['doStream']>[0]): Promise<Awaited<ReturnType<LanguageModelV2['doStream']>>>;
|
|
201
|
+
}
|
|
202
|
+
declare const openaiResponsesProviderOptionsSchema: z.ZodObject<{
|
|
203
|
+
metadata: z.ZodOptional<z.ZodNullable<z.ZodAny>>;
|
|
204
|
+
parallelToolCalls: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
205
|
+
previousResponseId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
206
|
+
store: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
207
|
+
user: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
208
|
+
reasoningEffort: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
209
|
+
strictJsonSchema: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
210
|
+
instructions: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
211
|
+
reasoningSummary: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
212
|
+
serviceTier: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
213
|
+
auto: "auto";
|
|
214
|
+
flex: "flex";
|
|
215
|
+
priority: "priority";
|
|
216
|
+
}>>>;
|
|
217
|
+
include: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodEnum<{
|
|
218
|
+
"reasoning.encrypted_content": "reasoning.encrypted_content";
|
|
219
|
+
"file_search_call.results": "file_search_call.results";
|
|
220
|
+
}>>>>;
|
|
221
|
+
textVerbosity: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
222
|
+
low: "low";
|
|
223
|
+
medium: "medium";
|
|
224
|
+
high: "high";
|
|
225
|
+
}>>>;
|
|
226
|
+
}, z.core.$strip>;
|
|
227
|
+
type OpenAIResponsesProviderOptions = z.infer<typeof openaiResponsesProviderOptionsSchema>;
|
|
228
|
+
|
|
229
|
+
export { OpenAIChatLanguageModel, type OpenAIChatModelId, OpenAICompletionLanguageModel, type OpenAICompletionModelId, type OpenAICompletionProviderOptions, OpenAIEmbeddingModel, type OpenAIEmbeddingModelId, type OpenAIEmbeddingProviderOptions, OpenAIImageModel, type OpenAIImageModelId, type OpenAIProviderOptions, OpenAIResponsesLanguageModel, type OpenAIResponsesProviderOptions, type OpenAISpeechCallOptions, OpenAISpeechModel, type OpenAISpeechModelId, type OpenAITranscriptionCallOptions, OpenAITranscriptionModel, type OpenAITranscriptionModelId, type OpenAITranscriptionProviderOptions, hasDefaultResponseFormat, modelMaxImagesPerCall, openAITranscriptionProviderOptions, openaiCompletionProviderOptions, openaiEmbeddingProviderOptions, openaiProviderOptions };
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import { LanguageModelV2, EmbeddingModelV2, ImageModelV2, TranscriptionModelV2CallOptions, TranscriptionModelV2, SpeechModelV2 } from '@ai-sdk/provider';
|
|
2
|
+
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
3
|
+
import { z } from 'zod/v4';
|
|
4
|
+
|
|
5
|
+
type OpenAIChatModelId = 'o1' | 'o1-2024-12-17' | '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' | 'gpt-5' | 'gpt-5-2025-08-07' | 'gpt-5-mini' | 'gpt-5-mini-2025-08-07' | 'gpt-5-nano' | 'gpt-5-nano-2025-08-07' | 'gpt-5-chat-latest' | (string & {});
|
|
6
|
+
declare const openaiProviderOptions: z.ZodObject<{
|
|
7
|
+
logitBias: z.ZodOptional<z.ZodRecord<z.ZodCoercedNumber<string>, z.ZodNumber>>;
|
|
8
|
+
logprobs: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber]>>;
|
|
9
|
+
parallelToolCalls: z.ZodOptional<z.ZodBoolean>;
|
|
10
|
+
user: z.ZodOptional<z.ZodString>;
|
|
11
|
+
reasoningEffort: z.ZodOptional<z.ZodEnum<{
|
|
12
|
+
low: "low";
|
|
13
|
+
medium: "medium";
|
|
14
|
+
high: "high";
|
|
15
|
+
}>>;
|
|
16
|
+
maxCompletionTokens: z.ZodOptional<z.ZodNumber>;
|
|
17
|
+
store: z.ZodOptional<z.ZodBoolean>;
|
|
18
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
19
|
+
prediction: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
20
|
+
structuredOutputs: z.ZodOptional<z.ZodBoolean>;
|
|
21
|
+
serviceTier: z.ZodOptional<z.ZodEnum<{
|
|
22
|
+
auto: "auto";
|
|
23
|
+
flex: "flex";
|
|
24
|
+
priority: "priority";
|
|
25
|
+
}>>;
|
|
26
|
+
strictJsonSchema: z.ZodOptional<z.ZodBoolean>;
|
|
27
|
+
}, z.core.$strip>;
|
|
28
|
+
type OpenAIProviderOptions = z.infer<typeof openaiProviderOptions>;
|
|
29
|
+
|
|
30
|
+
type OpenAIChatConfig = {
|
|
31
|
+
provider: string;
|
|
32
|
+
headers: () => Record<string, string | undefined>;
|
|
33
|
+
url: (options: {
|
|
34
|
+
modelId: string;
|
|
35
|
+
path: string;
|
|
36
|
+
}) => string;
|
|
37
|
+
fetch?: FetchFunction;
|
|
38
|
+
};
|
|
39
|
+
declare class OpenAIChatLanguageModel implements LanguageModelV2 {
|
|
40
|
+
readonly specificationVersion = "v2";
|
|
41
|
+
readonly modelId: OpenAIChatModelId;
|
|
42
|
+
readonly supportedUrls: {
|
|
43
|
+
'image/*': RegExp[];
|
|
44
|
+
};
|
|
45
|
+
private readonly config;
|
|
46
|
+
constructor(modelId: OpenAIChatModelId, config: OpenAIChatConfig);
|
|
47
|
+
get provider(): string;
|
|
48
|
+
private getArgs;
|
|
49
|
+
doGenerate(options: Parameters<LanguageModelV2['doGenerate']>[0]): Promise<Awaited<ReturnType<LanguageModelV2['doGenerate']>>>;
|
|
50
|
+
doStream(options: Parameters<LanguageModelV2['doStream']>[0]): Promise<Awaited<ReturnType<LanguageModelV2['doStream']>>>;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
type OpenAICompletionModelId = 'gpt-3.5-turbo-instruct' | (string & {});
|
|
54
|
+
declare const openaiCompletionProviderOptions: z.ZodObject<{
|
|
55
|
+
echo: z.ZodOptional<z.ZodBoolean>;
|
|
56
|
+
logitBias: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
57
|
+
suffix: z.ZodOptional<z.ZodString>;
|
|
58
|
+
user: z.ZodOptional<z.ZodString>;
|
|
59
|
+
logprobs: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber]>>;
|
|
60
|
+
}, z.core.$strip>;
|
|
61
|
+
type OpenAICompletionProviderOptions = z.infer<typeof openaiCompletionProviderOptions>;
|
|
62
|
+
|
|
63
|
+
type OpenAICompletionConfig = {
|
|
64
|
+
provider: string;
|
|
65
|
+
headers: () => Record<string, string | undefined>;
|
|
66
|
+
url: (options: {
|
|
67
|
+
modelId: string;
|
|
68
|
+
path: string;
|
|
69
|
+
}) => string;
|
|
70
|
+
fetch?: FetchFunction;
|
|
71
|
+
};
|
|
72
|
+
declare class OpenAICompletionLanguageModel implements LanguageModelV2 {
|
|
73
|
+
readonly specificationVersion = "v2";
|
|
74
|
+
readonly modelId: OpenAICompletionModelId;
|
|
75
|
+
private readonly config;
|
|
76
|
+
private get providerOptionsName();
|
|
77
|
+
constructor(modelId: OpenAICompletionModelId, config: OpenAICompletionConfig);
|
|
78
|
+
get provider(): string;
|
|
79
|
+
readonly supportedUrls: Record<string, RegExp[]>;
|
|
80
|
+
private getArgs;
|
|
81
|
+
doGenerate(options: Parameters<LanguageModelV2['doGenerate']>[0]): Promise<Awaited<ReturnType<LanguageModelV2['doGenerate']>>>;
|
|
82
|
+
doStream(options: Parameters<LanguageModelV2['doStream']>[0]): Promise<Awaited<ReturnType<LanguageModelV2['doStream']>>>;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
type OpenAIConfig = {
|
|
86
|
+
provider: string;
|
|
87
|
+
url: (options: {
|
|
88
|
+
modelId: string;
|
|
89
|
+
path: string;
|
|
90
|
+
}) => string;
|
|
91
|
+
headers: () => Record<string, string | undefined>;
|
|
92
|
+
fetch?: FetchFunction;
|
|
93
|
+
generateId?: () => string;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
type OpenAIEmbeddingModelId = 'text-embedding-3-small' | 'text-embedding-3-large' | 'text-embedding-ada-002' | (string & {});
|
|
97
|
+
declare const openaiEmbeddingProviderOptions: z.ZodObject<{
|
|
98
|
+
dimensions: z.ZodOptional<z.ZodNumber>;
|
|
99
|
+
user: z.ZodOptional<z.ZodString>;
|
|
100
|
+
}, z.core.$strip>;
|
|
101
|
+
type OpenAIEmbeddingProviderOptions = z.infer<typeof openaiEmbeddingProviderOptions>;
|
|
102
|
+
|
|
103
|
+
declare class OpenAIEmbeddingModel implements EmbeddingModelV2<string> {
|
|
104
|
+
readonly specificationVersion = "v2";
|
|
105
|
+
readonly modelId: OpenAIEmbeddingModelId;
|
|
106
|
+
readonly maxEmbeddingsPerCall = 2048;
|
|
107
|
+
readonly supportsParallelCalls = true;
|
|
108
|
+
private readonly config;
|
|
109
|
+
get provider(): string;
|
|
110
|
+
constructor(modelId: OpenAIEmbeddingModelId, config: OpenAIConfig);
|
|
111
|
+
doEmbed({ values, headers, abortSignal, providerOptions, }: Parameters<EmbeddingModelV2<string>['doEmbed']>[0]): Promise<Awaited<ReturnType<EmbeddingModelV2<string>['doEmbed']>>>;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
type OpenAIImageModelId = 'gpt-image-1' | 'dall-e-3' | 'dall-e-2' | (string & {});
|
|
115
|
+
declare const modelMaxImagesPerCall: Record<OpenAIImageModelId, number>;
|
|
116
|
+
declare const hasDefaultResponseFormat: Set<string>;
|
|
117
|
+
|
|
118
|
+
interface OpenAIImageModelConfig extends OpenAIConfig {
|
|
119
|
+
_internal?: {
|
|
120
|
+
currentDate?: () => Date;
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
declare class OpenAIImageModel implements ImageModelV2 {
|
|
124
|
+
readonly modelId: OpenAIImageModelId;
|
|
125
|
+
private readonly config;
|
|
126
|
+
readonly specificationVersion = "v2";
|
|
127
|
+
get maxImagesPerCall(): number;
|
|
128
|
+
get provider(): string;
|
|
129
|
+
constructor(modelId: OpenAIImageModelId, config: OpenAIImageModelConfig);
|
|
130
|
+
doGenerate({ prompt, n, size, aspectRatio, seed, providerOptions, headers, abortSignal, }: Parameters<ImageModelV2['doGenerate']>[0]): Promise<Awaited<ReturnType<ImageModelV2['doGenerate']>>>;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
type OpenAITranscriptionModelId = 'whisper-1' | 'gpt-4o-mini-transcribe' | 'gpt-4o-transcribe' | (string & {});
|
|
134
|
+
declare const openAITranscriptionProviderOptions: z.ZodObject<{
|
|
135
|
+
include: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
136
|
+
language: z.ZodOptional<z.ZodString>;
|
|
137
|
+
prompt: z.ZodOptional<z.ZodString>;
|
|
138
|
+
temperature: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
139
|
+
timestampGranularities: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
140
|
+
word: "word";
|
|
141
|
+
segment: "segment";
|
|
142
|
+
}>>>>;
|
|
143
|
+
}, z.core.$strip>;
|
|
144
|
+
type OpenAITranscriptionProviderOptions = z.infer<typeof openAITranscriptionProviderOptions>;
|
|
145
|
+
|
|
146
|
+
type OpenAITranscriptionCallOptions = Omit<TranscriptionModelV2CallOptions, 'providerOptions'> & {
|
|
147
|
+
providerOptions?: {
|
|
148
|
+
openai?: OpenAITranscriptionProviderOptions;
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
interface OpenAITranscriptionModelConfig extends OpenAIConfig {
|
|
152
|
+
_internal?: {
|
|
153
|
+
currentDate?: () => Date;
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
declare class OpenAITranscriptionModel implements TranscriptionModelV2 {
|
|
157
|
+
readonly modelId: OpenAITranscriptionModelId;
|
|
158
|
+
private readonly config;
|
|
159
|
+
readonly specificationVersion = "v2";
|
|
160
|
+
get provider(): string;
|
|
161
|
+
constructor(modelId: OpenAITranscriptionModelId, config: OpenAITranscriptionModelConfig);
|
|
162
|
+
private getArgs;
|
|
163
|
+
doGenerate(options: OpenAITranscriptionCallOptions): Promise<Awaited<ReturnType<TranscriptionModelV2['doGenerate']>>>;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
type OpenAISpeechModelId = 'tts-1' | 'tts-1-hd' | 'gpt-4o-mini-tts' | (string & {});
|
|
167
|
+
|
|
168
|
+
declare const OpenAIProviderOptionsSchema: z.ZodObject<{
|
|
169
|
+
instructions: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
170
|
+
speed: z.ZodOptional<z.ZodNullable<z.ZodDefault<z.ZodNumber>>>;
|
|
171
|
+
}, z.core.$strip>;
|
|
172
|
+
type OpenAISpeechCallOptions = z.infer<typeof OpenAIProviderOptionsSchema>;
|
|
173
|
+
interface OpenAISpeechModelConfig extends OpenAIConfig {
|
|
174
|
+
_internal?: {
|
|
175
|
+
currentDate?: () => Date;
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
declare class OpenAISpeechModel implements SpeechModelV2 {
|
|
179
|
+
readonly modelId: OpenAISpeechModelId;
|
|
180
|
+
private readonly config;
|
|
181
|
+
readonly specificationVersion = "v2";
|
|
182
|
+
get provider(): string;
|
|
183
|
+
constructor(modelId: OpenAISpeechModelId, config: OpenAISpeechModelConfig);
|
|
184
|
+
private getArgs;
|
|
185
|
+
doGenerate(options: Parameters<SpeechModelV2['doGenerate']>[0]): Promise<Awaited<ReturnType<SpeechModelV2['doGenerate']>>>;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
declare const openaiResponsesModelIds: readonly ["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", "o1", "o1-2024-12-17", "o3-mini", "o3-mini-2025-01-31", "o3", "o3-2025-04-16", "o4-mini", "o4-mini-2025-04-16", "codex-mini-latest", "computer-use-preview", "gpt-5", "gpt-5-2025-08-07", "gpt-5-mini", "gpt-5-mini-2025-08-07", "gpt-5-nano", "gpt-5-nano-2025-08-07", "gpt-5-chat-latest"];
|
|
189
|
+
type OpenAIResponsesModelId = (typeof openaiResponsesModelIds)[number] | (string & {});
|
|
190
|
+
|
|
191
|
+
declare class OpenAIResponsesLanguageModel implements LanguageModelV2 {
|
|
192
|
+
readonly specificationVersion = "v2";
|
|
193
|
+
readonly modelId: OpenAIResponsesModelId;
|
|
194
|
+
private readonly config;
|
|
195
|
+
constructor(modelId: OpenAIResponsesModelId, config: OpenAIConfig);
|
|
196
|
+
readonly supportedUrls: Record<string, RegExp[]>;
|
|
197
|
+
get provider(): string;
|
|
198
|
+
private getArgs;
|
|
199
|
+
doGenerate(options: Parameters<LanguageModelV2['doGenerate']>[0]): Promise<Awaited<ReturnType<LanguageModelV2['doGenerate']>>>;
|
|
200
|
+
doStream(options: Parameters<LanguageModelV2['doStream']>[0]): Promise<Awaited<ReturnType<LanguageModelV2['doStream']>>>;
|
|
201
|
+
}
|
|
202
|
+
declare const openaiResponsesProviderOptionsSchema: z.ZodObject<{
|
|
203
|
+
metadata: z.ZodOptional<z.ZodNullable<z.ZodAny>>;
|
|
204
|
+
parallelToolCalls: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
205
|
+
previousResponseId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
206
|
+
store: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
207
|
+
user: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
208
|
+
reasoningEffort: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
209
|
+
strictJsonSchema: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
210
|
+
instructions: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
211
|
+
reasoningSummary: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
212
|
+
serviceTier: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
213
|
+
auto: "auto";
|
|
214
|
+
flex: "flex";
|
|
215
|
+
priority: "priority";
|
|
216
|
+
}>>>;
|
|
217
|
+
include: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodEnum<{
|
|
218
|
+
"reasoning.encrypted_content": "reasoning.encrypted_content";
|
|
219
|
+
"file_search_call.results": "file_search_call.results";
|
|
220
|
+
}>>>>;
|
|
221
|
+
textVerbosity: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
222
|
+
low: "low";
|
|
223
|
+
medium: "medium";
|
|
224
|
+
high: "high";
|
|
225
|
+
}>>>;
|
|
226
|
+
}, z.core.$strip>;
|
|
227
|
+
type OpenAIResponsesProviderOptions = z.infer<typeof openaiResponsesProviderOptionsSchema>;
|
|
228
|
+
|
|
229
|
+
export { OpenAIChatLanguageModel, type OpenAIChatModelId, OpenAICompletionLanguageModel, type OpenAICompletionModelId, type OpenAICompletionProviderOptions, OpenAIEmbeddingModel, type OpenAIEmbeddingModelId, type OpenAIEmbeddingProviderOptions, OpenAIImageModel, type OpenAIImageModelId, type OpenAIProviderOptions, OpenAIResponsesLanguageModel, type OpenAIResponsesProviderOptions, type OpenAISpeechCallOptions, OpenAISpeechModel, type OpenAISpeechModelId, type OpenAITranscriptionCallOptions, OpenAITranscriptionModel, type OpenAITranscriptionModelId, type OpenAITranscriptionProviderOptions, hasDefaultResponseFormat, modelMaxImagesPerCall, openAITranscriptionProviderOptions, openaiCompletionProviderOptions, openaiEmbeddingProviderOptions, openaiProviderOptions };
|