@ai-sdk/openai 2.0.0-canary.5 → 2.0.0-canary.7

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,63 +1,84 @@
1
- import { LanguageModelV2, EmbeddingModelV1, ImageModelV1, TranscriptionModelV1CallOptions, TranscriptionModelV1 } from '@ai-sdk/provider';
1
+ import { LanguageModelV2, EmbeddingModelV2, ImageModelV1, TranscriptionModelV1CallOptions, TranscriptionModelV1 } 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-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
- interface OpenAIChatSettings {
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 & {});
6
+ declare const openaiProviderOptions: z.ZodObject<{
7
7
  /**
8
- Modify the likelihood of specified tokens appearing in the completion.
9
-
10
- Accepts a JSON object that maps tokens (specified by their token ID in
11
- the GPT tokenizer) to an associated bias value from -100 to 100. You
12
- can use this tokenizer tool to convert text to token IDs. Mathematically,
13
- the bias is added to the logits generated by the model prior to sampling.
14
- The exact effect will vary per model, but values between -1 and 1 should
15
- decrease or increase likelihood of selection; values like -100 or 100
16
- should result in a ban or exclusive selection of the relevant token.
17
-
18
- As an example, you can pass {"50256": -100} to prevent the <|endoftext|>
19
- token from being generated.
20
- */
21
- logitBias?: Record<number, number>;
8
+ * Modify the likelihood of specified tokens appearing in the completion.
9
+ *
10
+ * Accepts a JSON object that maps tokens (specified by their token ID in
11
+ * the GPT tokenizer) to an associated bias value from -100 to 100.
12
+ */
13
+ logitBias: z.ZodOptional<z.ZodRecord<z.ZodNumber, z.ZodNumber>>;
22
14
  /**
23
- Return the log probabilities of the tokens. Including logprobs will increase
24
- the response size and can slow down response times. However, it can
25
- be useful to better understand how the model is behaving.
26
-
27
- Setting to true will return the log probabilities of the tokens that
28
- were generated.
29
-
30
- Setting to a number will return the log probabilities of the top n
31
- tokens that were generated.
32
- */
33
- logprobs?: boolean | number;
15
+ * Return the log probabilities of the tokens.
16
+ *
17
+ * Setting to true will return the log probabilities of the tokens that
18
+ * were generated.
19
+ *
20
+ * Setting to a number will return the log probabilities of the top n
21
+ * tokens that were generated.
22
+ */
23
+ logprobs: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodNumber]>>;
34
24
  /**
35
- Whether to enable parallel function calling during tool use. Default to true.
25
+ * Whether to enable parallel function calling during tool use. Default to true.
36
26
  */
37
- parallelToolCalls?: boolean;
27
+ parallelToolCalls: z.ZodOptional<z.ZodBoolean>;
38
28
  /**
39
- Whether to use structured outputs. Defaults to false.
40
-
41
- When enabled, tool calls and object generation will be strict and follow the provided schema.
42
- */
43
- structuredOutputs?: boolean;
29
+ * A unique identifier representing your end-user, which can help OpenAI to
30
+ * monitor and detect abuse.
31
+ */
32
+ user: z.ZodOptional<z.ZodString>;
44
33
  /**
45
- Whether to use legacy function calling. Defaults to false.
46
-
47
- Required by some open source inference engines which do not support the `tools` API. May also
48
- provide a workaround for `parallelToolCalls` resulting in the provider buffering tool calls,
49
- which causes `streamObject` to be non-streaming.
50
-
51
- Prefer setting `parallelToolCalls: false` over this option.
52
-
53
- @deprecated this API is supported but deprecated by OpenAI.
34
+ * Reasoning effort for reasoning models. Defaults to `medium`.
54
35
  */
55
- useLegacyFunctionCalling?: boolean;
36
+ reasoningEffort: z.ZodOptional<z.ZodEnum<["low", "medium", "high"]>>;
56
37
  /**
57
- A unique identifier representing your end-user, which can help OpenAI to
58
- monitor and detect abuse. Learn more.
38
+ * Maximum number of completion tokens to generate. Useful for reasoning models.
39
+ */
40
+ maxCompletionTokens: z.ZodOptional<z.ZodNumber>;
41
+ /**
42
+ * Whether to enable persistence in responses API.
43
+ */
44
+ store: z.ZodOptional<z.ZodBoolean>;
45
+ /**
46
+ * Metadata to associate with the request.
47
+ */
48
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
49
+ /**
50
+ * Parameters for prediction mode.
51
+ */
52
+ prediction: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
53
+ }, "strip", z.ZodTypeAny, {
54
+ user?: string | undefined;
55
+ logitBias?: Record<number, number> | undefined;
56
+ logprobs?: number | boolean | undefined;
57
+ parallelToolCalls?: boolean | undefined;
58
+ reasoningEffort?: "low" | "medium" | "high" | undefined;
59
+ maxCompletionTokens?: number | undefined;
60
+ store?: boolean | undefined;
61
+ metadata?: Record<string, string> | undefined;
62
+ prediction?: Record<string, any> | undefined;
63
+ }, {
64
+ user?: string | undefined;
65
+ logitBias?: Record<number, number> | undefined;
66
+ logprobs?: number | boolean | undefined;
67
+ parallelToolCalls?: boolean | undefined;
68
+ reasoningEffort?: "low" | "medium" | "high" | undefined;
69
+ maxCompletionTokens?: number | undefined;
70
+ store?: boolean | undefined;
71
+ metadata?: Record<string, string> | undefined;
72
+ prediction?: Record<string, any> | undefined;
73
+ }>;
74
+ type OpenAIProviderOptions = z.infer<typeof openaiProviderOptions>;
75
+ interface OpenAIChatSettings {
76
+ /**
77
+ Whether to use structured outputs. Defaults to false.
78
+
79
+ When enabled, tool calls and object generation will be strict and follow the provided schema.
59
80
  */
60
- user?: string;
81
+ structuredOutputs?: boolean;
61
82
  /**
62
83
  Automatically download images and pass the image as data to the model.
63
84
  OpenAI supports image URLs for public models, so this is only needed for
@@ -66,19 +87,6 @@ interface OpenAIChatSettings {
66
87
  Defaults to `false`.
67
88
  */
68
89
  downloadImages?: boolean;
69
- /**
70
- Simulates streaming by using a normal generate call and returning it as a stream.
71
- Enable this if the model that you are using does not support streaming.
72
-
73
- Defaults to `false`.
74
-
75
- @deprecated Use `simulateStreamingMiddleware` instead.
76
- */
77
- simulateStreaming?: boolean;
78
- /**
79
- Reasoning effort for reasoning models. Defaults to `medium`.
80
- */
81
- reasoningEffort?: 'low' | 'medium' | 'high';
82
90
  }
83
91
 
84
92
  type OpenAIChatConfig = {
@@ -206,8 +214,8 @@ interface OpenAIEmbeddingSettings {
206
214
  user?: string;
207
215
  }
208
216
 
209
- declare class OpenAIEmbeddingModel implements EmbeddingModelV1<string> {
210
- readonly specificationVersion = "v1";
217
+ declare class OpenAIEmbeddingModel implements EmbeddingModelV2<string> {
218
+ readonly specificationVersion = "v2";
211
219
  readonly modelId: OpenAIEmbeddingModelId;
212
220
  private readonly config;
213
221
  private readonly settings;
@@ -215,7 +223,7 @@ declare class OpenAIEmbeddingModel implements EmbeddingModelV1<string> {
215
223
  get maxEmbeddingsPerCall(): number;
216
224
  get supportsParallelCalls(): boolean;
217
225
  constructor(modelId: OpenAIEmbeddingModelId, settings: OpenAIEmbeddingSettings, config: OpenAIConfig);
218
- doEmbed({ values, headers, abortSignal, }: Parameters<EmbeddingModelV1<string>['doEmbed']>[0]): Promise<Awaited<ReturnType<EmbeddingModelV1<string>['doEmbed']>>>;
226
+ doEmbed({ values, headers, abortSignal, }: Parameters<EmbeddingModelV2<string>['doEmbed']>[0]): Promise<Awaited<ReturnType<EmbeddingModelV2<string>['doEmbed']>>>;
219
227
  }
220
228
 
221
229
  type OpenAIImageModelId = 'dall-e-3' | 'dall-e-2' | (string & {});
@@ -270,28 +278,28 @@ type OpenAITranscriptionModelOptions = {
270
278
  timestamp_granularities?: Array<'word' | 'segment'>;
271
279
  };
272
280
 
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">>>;
281
+ declare const openAIProviderOptionsSchema: z.ZodObject<{
282
+ include: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
283
+ language: z.ZodOptional<z.ZodNullable<z.ZodString>>;
284
+ prompt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
285
+ temperature: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
286
+ timestampGranularities: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodEnum<["word", "segment"]>, "many">>>>;
279
287
  }, "strip", z.ZodTypeAny, {
280
- temperature: number;
281
- timestampGranularities: ("word" | "segment")[];
282
- prompt?: string | undefined;
283
- include?: string[] | undefined;
284
- language?: string | undefined;
288
+ temperature: number | null;
289
+ timestampGranularities: ("word" | "segment")[] | null;
290
+ prompt?: string | null | undefined;
291
+ include?: string[] | null | undefined;
292
+ language?: string | null | undefined;
285
293
  }, {
286
- prompt?: string | undefined;
287
- temperature?: number | undefined;
288
- include?: string[] | undefined;
289
- language?: string | undefined;
290
- timestampGranularities?: ("word" | "segment")[] | undefined;
294
+ prompt?: string | null | undefined;
295
+ temperature?: number | null | undefined;
296
+ include?: string[] | null | undefined;
297
+ language?: string | null | undefined;
298
+ timestampGranularities?: ("word" | "segment")[] | null | undefined;
291
299
  }>;
292
300
  type OpenAITranscriptionCallOptions = Omit<TranscriptionModelV1CallOptions, 'providerOptions'> & {
293
301
  providerOptions?: {
294
- openai?: z.infer<typeof OpenAIProviderOptionsSchema>;
302
+ openai?: z.infer<typeof openAIProviderOptionsSchema>;
295
303
  };
296
304
  };
297
305
  interface OpenAITranscriptionModelConfig extends OpenAIConfig {
@@ -333,23 +341,23 @@ declare const openaiResponsesProviderOptionsSchema: z.ZodObject<{
333
341
  instructions: z.ZodOptional<z.ZodNullable<z.ZodString>>;
334
342
  }, "strip", z.ZodTypeAny, {
335
343
  user?: string | null | undefined;
344
+ parallelToolCalls?: boolean | null | undefined;
345
+ reasoningEffort?: string | null | undefined;
336
346
  store?: boolean | null | undefined;
337
347
  metadata?: any;
338
- reasoningEffort?: string | null | undefined;
339
- parallelToolCalls?: boolean | null | undefined;
340
348
  previousResponseId?: string | null | undefined;
341
349
  strictSchemas?: boolean | null | undefined;
342
350
  instructions?: string | null | undefined;
343
351
  }, {
344
352
  user?: string | null | undefined;
353
+ parallelToolCalls?: boolean | null | undefined;
354
+ reasoningEffort?: string | null | undefined;
345
355
  store?: boolean | null | undefined;
346
356
  metadata?: any;
347
- reasoningEffort?: string | null | undefined;
348
- parallelToolCalls?: boolean | null | undefined;
349
357
  previousResponseId?: string | null | undefined;
350
358
  strictSchemas?: boolean | null | undefined;
351
359
  instructions?: string | null | undefined;
352
360
  }>;
353
361
  type OpenAIResponsesProviderOptions = z.infer<typeof openaiResponsesProviderOptionsSchema>;
354
362
 
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 };
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 };
@@ -1,63 +1,84 @@
1
- import { LanguageModelV2, EmbeddingModelV1, ImageModelV1, TranscriptionModelV1CallOptions, TranscriptionModelV1 } from '@ai-sdk/provider';
1
+ import { LanguageModelV2, EmbeddingModelV2, ImageModelV1, TranscriptionModelV1CallOptions, TranscriptionModelV1 } 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-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
- interface OpenAIChatSettings {
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 & {});
6
+ declare const openaiProviderOptions: z.ZodObject<{
7
7
  /**
8
- Modify the likelihood of specified tokens appearing in the completion.
9
-
10
- Accepts a JSON object that maps tokens (specified by their token ID in
11
- the GPT tokenizer) to an associated bias value from -100 to 100. You
12
- can use this tokenizer tool to convert text to token IDs. Mathematically,
13
- the bias is added to the logits generated by the model prior to sampling.
14
- The exact effect will vary per model, but values between -1 and 1 should
15
- decrease or increase likelihood of selection; values like -100 or 100
16
- should result in a ban or exclusive selection of the relevant token.
17
-
18
- As an example, you can pass {"50256": -100} to prevent the <|endoftext|>
19
- token from being generated.
20
- */
21
- logitBias?: Record<number, number>;
8
+ * Modify the likelihood of specified tokens appearing in the completion.
9
+ *
10
+ * Accepts a JSON object that maps tokens (specified by their token ID in
11
+ * the GPT tokenizer) to an associated bias value from -100 to 100.
12
+ */
13
+ logitBias: z.ZodOptional<z.ZodRecord<z.ZodNumber, z.ZodNumber>>;
22
14
  /**
23
- Return the log probabilities of the tokens. Including logprobs will increase
24
- the response size and can slow down response times. However, it can
25
- be useful to better understand how the model is behaving.
26
-
27
- Setting to true will return the log probabilities of the tokens that
28
- were generated.
29
-
30
- Setting to a number will return the log probabilities of the top n
31
- tokens that were generated.
32
- */
33
- logprobs?: boolean | number;
15
+ * Return the log probabilities of the tokens.
16
+ *
17
+ * Setting to true will return the log probabilities of the tokens that
18
+ * were generated.
19
+ *
20
+ * Setting to a number will return the log probabilities of the top n
21
+ * tokens that were generated.
22
+ */
23
+ logprobs: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodNumber]>>;
34
24
  /**
35
- Whether to enable parallel function calling during tool use. Default to true.
25
+ * Whether to enable parallel function calling during tool use. Default to true.
36
26
  */
37
- parallelToolCalls?: boolean;
27
+ parallelToolCalls: z.ZodOptional<z.ZodBoolean>;
38
28
  /**
39
- Whether to use structured outputs. Defaults to false.
40
-
41
- When enabled, tool calls and object generation will be strict and follow the provided schema.
42
- */
43
- structuredOutputs?: boolean;
29
+ * A unique identifier representing your end-user, which can help OpenAI to
30
+ * monitor and detect abuse.
31
+ */
32
+ user: z.ZodOptional<z.ZodString>;
44
33
  /**
45
- Whether to use legacy function calling. Defaults to false.
46
-
47
- Required by some open source inference engines which do not support the `tools` API. May also
48
- provide a workaround for `parallelToolCalls` resulting in the provider buffering tool calls,
49
- which causes `streamObject` to be non-streaming.
50
-
51
- Prefer setting `parallelToolCalls: false` over this option.
52
-
53
- @deprecated this API is supported but deprecated by OpenAI.
34
+ * Reasoning effort for reasoning models. Defaults to `medium`.
54
35
  */
55
- useLegacyFunctionCalling?: boolean;
36
+ reasoningEffort: z.ZodOptional<z.ZodEnum<["low", "medium", "high"]>>;
56
37
  /**
57
- A unique identifier representing your end-user, which can help OpenAI to
58
- monitor and detect abuse. Learn more.
38
+ * Maximum number of completion tokens to generate. Useful for reasoning models.
39
+ */
40
+ maxCompletionTokens: z.ZodOptional<z.ZodNumber>;
41
+ /**
42
+ * Whether to enable persistence in responses API.
43
+ */
44
+ store: z.ZodOptional<z.ZodBoolean>;
45
+ /**
46
+ * Metadata to associate with the request.
47
+ */
48
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
49
+ /**
50
+ * Parameters for prediction mode.
51
+ */
52
+ prediction: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
53
+ }, "strip", z.ZodTypeAny, {
54
+ user?: string | undefined;
55
+ logitBias?: Record<number, number> | undefined;
56
+ logprobs?: number | boolean | undefined;
57
+ parallelToolCalls?: boolean | undefined;
58
+ reasoningEffort?: "low" | "medium" | "high" | undefined;
59
+ maxCompletionTokens?: number | undefined;
60
+ store?: boolean | undefined;
61
+ metadata?: Record<string, string> | undefined;
62
+ prediction?: Record<string, any> | undefined;
63
+ }, {
64
+ user?: string | undefined;
65
+ logitBias?: Record<number, number> | undefined;
66
+ logprobs?: number | boolean | undefined;
67
+ parallelToolCalls?: boolean | undefined;
68
+ reasoningEffort?: "low" | "medium" | "high" | undefined;
69
+ maxCompletionTokens?: number | undefined;
70
+ store?: boolean | undefined;
71
+ metadata?: Record<string, string> | undefined;
72
+ prediction?: Record<string, any> | undefined;
73
+ }>;
74
+ type OpenAIProviderOptions = z.infer<typeof openaiProviderOptions>;
75
+ interface OpenAIChatSettings {
76
+ /**
77
+ Whether to use structured outputs. Defaults to false.
78
+
79
+ When enabled, tool calls and object generation will be strict and follow the provided schema.
59
80
  */
60
- user?: string;
81
+ structuredOutputs?: boolean;
61
82
  /**
62
83
  Automatically download images and pass the image as data to the model.
63
84
  OpenAI supports image URLs for public models, so this is only needed for
@@ -66,19 +87,6 @@ interface OpenAIChatSettings {
66
87
  Defaults to `false`.
67
88
  */
68
89
  downloadImages?: boolean;
69
- /**
70
- Simulates streaming by using a normal generate call and returning it as a stream.
71
- Enable this if the model that you are using does not support streaming.
72
-
73
- Defaults to `false`.
74
-
75
- @deprecated Use `simulateStreamingMiddleware` instead.
76
- */
77
- simulateStreaming?: boolean;
78
- /**
79
- Reasoning effort for reasoning models. Defaults to `medium`.
80
- */
81
- reasoningEffort?: 'low' | 'medium' | 'high';
82
90
  }
83
91
 
84
92
  type OpenAIChatConfig = {
@@ -206,8 +214,8 @@ interface OpenAIEmbeddingSettings {
206
214
  user?: string;
207
215
  }
208
216
 
209
- declare class OpenAIEmbeddingModel implements EmbeddingModelV1<string> {
210
- readonly specificationVersion = "v1";
217
+ declare class OpenAIEmbeddingModel implements EmbeddingModelV2<string> {
218
+ readonly specificationVersion = "v2";
211
219
  readonly modelId: OpenAIEmbeddingModelId;
212
220
  private readonly config;
213
221
  private readonly settings;
@@ -215,7 +223,7 @@ declare class OpenAIEmbeddingModel implements EmbeddingModelV1<string> {
215
223
  get maxEmbeddingsPerCall(): number;
216
224
  get supportsParallelCalls(): boolean;
217
225
  constructor(modelId: OpenAIEmbeddingModelId, settings: OpenAIEmbeddingSettings, config: OpenAIConfig);
218
- doEmbed({ values, headers, abortSignal, }: Parameters<EmbeddingModelV1<string>['doEmbed']>[0]): Promise<Awaited<ReturnType<EmbeddingModelV1<string>['doEmbed']>>>;
226
+ doEmbed({ values, headers, abortSignal, }: Parameters<EmbeddingModelV2<string>['doEmbed']>[0]): Promise<Awaited<ReturnType<EmbeddingModelV2<string>['doEmbed']>>>;
219
227
  }
220
228
 
221
229
  type OpenAIImageModelId = 'dall-e-3' | 'dall-e-2' | (string & {});
@@ -270,28 +278,28 @@ type OpenAITranscriptionModelOptions = {
270
278
  timestamp_granularities?: Array<'word' | 'segment'>;
271
279
  };
272
280
 
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">>>;
281
+ declare const openAIProviderOptionsSchema: z.ZodObject<{
282
+ include: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
283
+ language: z.ZodOptional<z.ZodNullable<z.ZodString>>;
284
+ prompt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
285
+ temperature: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
286
+ timestampGranularities: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodEnum<["word", "segment"]>, "many">>>>;
279
287
  }, "strip", z.ZodTypeAny, {
280
- temperature: number;
281
- timestampGranularities: ("word" | "segment")[];
282
- prompt?: string | undefined;
283
- include?: string[] | undefined;
284
- language?: string | undefined;
288
+ temperature: number | null;
289
+ timestampGranularities: ("word" | "segment")[] | null;
290
+ prompt?: string | null | undefined;
291
+ include?: string[] | null | undefined;
292
+ language?: string | null | undefined;
285
293
  }, {
286
- prompt?: string | undefined;
287
- temperature?: number | undefined;
288
- include?: string[] | undefined;
289
- language?: string | undefined;
290
- timestampGranularities?: ("word" | "segment")[] | undefined;
294
+ prompt?: string | null | undefined;
295
+ temperature?: number | null | undefined;
296
+ include?: string[] | null | undefined;
297
+ language?: string | null | undefined;
298
+ timestampGranularities?: ("word" | "segment")[] | null | undefined;
291
299
  }>;
292
300
  type OpenAITranscriptionCallOptions = Omit<TranscriptionModelV1CallOptions, 'providerOptions'> & {
293
301
  providerOptions?: {
294
- openai?: z.infer<typeof OpenAIProviderOptionsSchema>;
302
+ openai?: z.infer<typeof openAIProviderOptionsSchema>;
295
303
  };
296
304
  };
297
305
  interface OpenAITranscriptionModelConfig extends OpenAIConfig {
@@ -333,23 +341,23 @@ declare const openaiResponsesProviderOptionsSchema: z.ZodObject<{
333
341
  instructions: z.ZodOptional<z.ZodNullable<z.ZodString>>;
334
342
  }, "strip", z.ZodTypeAny, {
335
343
  user?: string | null | undefined;
344
+ parallelToolCalls?: boolean | null | undefined;
345
+ reasoningEffort?: string | null | undefined;
336
346
  store?: boolean | null | undefined;
337
347
  metadata?: any;
338
- reasoningEffort?: string | null | undefined;
339
- parallelToolCalls?: boolean | null | undefined;
340
348
  previousResponseId?: string | null | undefined;
341
349
  strictSchemas?: boolean | null | undefined;
342
350
  instructions?: string | null | undefined;
343
351
  }, {
344
352
  user?: string | null | undefined;
353
+ parallelToolCalls?: boolean | null | undefined;
354
+ reasoningEffort?: string | null | undefined;
345
355
  store?: boolean | null | undefined;
346
356
  metadata?: any;
347
- reasoningEffort?: string | null | undefined;
348
- parallelToolCalls?: boolean | null | undefined;
349
357
  previousResponseId?: string | null | undefined;
350
358
  strictSchemas?: boolean | null | undefined;
351
359
  instructions?: string | null | undefined;
352
360
  }>;
353
361
  type OpenAIResponsesProviderOptions = z.infer<typeof openaiResponsesProviderOptionsSchema>;
354
362
 
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 };
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 };