@ai-sdk/openai 2.0.0-canary.10 → 2.0.0-canary.12

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 CHANGED
@@ -1,5 +1,28 @@
1
1
  # @ai-sdk/openai
2
2
 
3
+ ## 2.0.0-canary.12
4
+
5
+ ### Patch Changes
6
+
7
+ - db72adc: chore(providers/openai): update completion model to use providerOptions
8
+ - 66962ed: fix(packages): export node10 compatible types
9
+ - 9301f86: refactor (image-model): rename `ImageModelV1` to `ImageModelV2`
10
+ - 7df7a25: feat (providers/openai): support gpt-image-1 image generation
11
+ - Updated dependencies [66962ed]
12
+ - Updated dependencies [9301f86]
13
+ - Updated dependencies [a3f768e]
14
+ - @ai-sdk/provider-utils@3.0.0-canary.11
15
+ - @ai-sdk/provider@2.0.0-canary.10
16
+
17
+ ## 2.0.0-canary.11
18
+
19
+ ### Patch Changes
20
+
21
+ - 8493141: feat (providers/openai): add support for reasoning summaries
22
+ - Updated dependencies [e86be6f]
23
+ - @ai-sdk/provider@2.0.0-canary.9
24
+ - @ai-sdk/provider-utils@3.0.0-canary.10
25
+
3
26
  ## 2.0.0-canary.10
4
27
 
5
28
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { LanguageModelV2, ProviderV2, EmbeddingModelV2, ImageModelV1, TranscriptionModelV1, SpeechModelV1 } from '@ai-sdk/provider';
1
+ import { LanguageModelV2, ProviderV2, EmbeddingModelV2, ImageModelV2, TranscriptionModelV1, SpeechModelV1 } from '@ai-sdk/provider';
2
2
  import { FetchFunction } from '@ai-sdk/provider-utils';
3
3
  import { z } from 'zod';
4
4
 
@@ -13,48 +13,6 @@ interface OpenAIChatSettings {
13
13
  }
14
14
 
15
15
  type OpenAICompletionModelId = 'gpt-3.5-turbo-instruct' | (string & {});
16
- interface OpenAICompletionSettings {
17
- /**
18
- Echo back the prompt in addition to the completion.
19
- */
20
- echo?: boolean;
21
- /**
22
- Modify the likelihood of specified tokens appearing in the completion.
23
-
24
- Accepts a JSON object that maps tokens (specified by their token ID in
25
- the GPT tokenizer) to an associated bias value from -100 to 100. You
26
- can use this tokenizer tool to convert text to token IDs. Mathematically,
27
- the bias is added to the logits generated by the model prior to sampling.
28
- The exact effect will vary per model, but values between -1 and 1 should
29
- decrease or increase likelihood of selection; values like -100 or 100
30
- should result in a ban or exclusive selection of the relevant token.
31
-
32
- As an example, you can pass {"50256": -100} to prevent the <|endoftext|>
33
- token from being generated.
34
- */
35
- logitBias?: Record<number, number>;
36
- /**
37
- Return the log probabilities of the tokens. Including logprobs will increase
38
- the response size and can slow down response times. However, it can
39
- be useful to better understand how the model is behaving.
40
-
41
- Setting to true will return the log probabilities of the tokens that
42
- were generated.
43
-
44
- Setting to a number will return the log probabilities of the top n
45
- tokens that were generated.
46
- */
47
- logprobs?: boolean | number;
48
- /**
49
- The suffix that comes after a completion of inserted text.
50
- */
51
- suffix?: string;
52
- /**
53
- A unique identifier representing your end-user, which can help OpenAI to
54
- monitor and detect abuse. Learn more.
55
- */
56
- user?: string;
57
- }
58
16
 
59
17
  type OpenAICompletionConfig = {
60
18
  provider: string;
@@ -69,9 +27,9 @@ type OpenAICompletionConfig = {
69
27
  declare class OpenAICompletionLanguageModel implements LanguageModelV2 {
70
28
  readonly specificationVersion = "v2";
71
29
  readonly modelId: OpenAICompletionModelId;
72
- readonly settings: OpenAICompletionSettings;
73
30
  private readonly config;
74
- constructor(modelId: OpenAICompletionModelId, settings: OpenAICompletionSettings, config: OpenAICompletionConfig);
31
+ private get providerOptionsName();
32
+ constructor(modelId: OpenAICompletionModelId, config: OpenAICompletionConfig);
75
33
  get provider(): string;
76
34
  getSupportedUrls(): Promise<Record<string, RegExp[]>>;
77
35
  private getArgs;
@@ -127,12 +85,12 @@ type OpenAIResponsesModelId = 'o1' | 'o1-2024-12-17' | 'o1-mini' | 'o1-mini-2024
127
85
  type OpenAISpeechModelId = 'tts-1' | 'tts-1-hd' | 'gpt-4o-mini-tts' | (string & {});
128
86
 
129
87
  interface OpenAIProvider extends ProviderV2 {
130
- (modelId: 'gpt-3.5-turbo-instruct', settings?: OpenAICompletionSettings): OpenAICompletionLanguageModel;
88
+ (modelId: 'gpt-3.5-turbo-instruct'): OpenAICompletionLanguageModel;
131
89
  (modelId: OpenAIChatModelId, settings?: OpenAIChatSettings): LanguageModelV2;
132
90
  /**
133
91
  Creates an OpenAI model for text generation.
134
92
  */
135
- languageModel(modelId: 'gpt-3.5-turbo-instruct', settings?: OpenAICompletionSettings): OpenAICompletionLanguageModel;
93
+ languageModel(modelId: 'gpt-3.5-turbo-instruct'): OpenAICompletionLanguageModel;
136
94
  languageModel(modelId: OpenAIChatModelId, settings?: OpenAIChatSettings): LanguageModelV2;
137
95
  /**
138
96
  Creates an OpenAI chat model for text generation.
@@ -145,7 +103,7 @@ interface OpenAIProvider extends ProviderV2 {
145
103
  /**
146
104
  Creates an OpenAI completion model for text generation.
147
105
  */
148
- completion(modelId: OpenAICompletionModelId, settings?: OpenAICompletionSettings): LanguageModelV2;
106
+ completion(modelId: OpenAICompletionModelId): LanguageModelV2;
149
107
  /**
150
108
  Creates a model for text embeddings.
151
109
  */
@@ -163,11 +121,11 @@ interface OpenAIProvider extends ProviderV2 {
163
121
  /**
164
122
  Creates a model for image generation.
165
123
  */
166
- image(modelId: OpenAIImageModelId, settings?: OpenAIImageSettings): ImageModelV1;
124
+ image(modelId: OpenAIImageModelId, settings?: OpenAIImageSettings): ImageModelV2;
167
125
  /**
168
126
  Creates a model for image generation.
169
127
  */
170
- imageModel(modelId: OpenAIImageModelId, settings?: OpenAIImageSettings): ImageModelV1;
128
+ imageModel(modelId: OpenAIImageModelId, settings?: OpenAIImageSettings): ImageModelV2;
171
129
  /**
172
130
  Creates a model for transcription.
173
131
  */
@@ -236,6 +194,7 @@ declare const openaiResponsesProviderOptionsSchema: z.ZodObject<{
236
194
  reasoningEffort: z.ZodOptional<z.ZodNullable<z.ZodString>>;
237
195
  strictSchemas: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
238
196
  instructions: z.ZodOptional<z.ZodNullable<z.ZodString>>;
197
+ reasoningSummary: z.ZodOptional<z.ZodNullable<z.ZodString>>;
239
198
  }, "strip", z.ZodTypeAny, {
240
199
  user?: string | null | undefined;
241
200
  parallelToolCalls?: boolean | null | undefined;
@@ -245,6 +204,7 @@ declare const openaiResponsesProviderOptionsSchema: z.ZodObject<{
245
204
  previousResponseId?: string | null | undefined;
246
205
  strictSchemas?: boolean | null | undefined;
247
206
  instructions?: string | null | undefined;
207
+ reasoningSummary?: string | null | undefined;
248
208
  }, {
249
209
  user?: string | null | undefined;
250
210
  parallelToolCalls?: boolean | null | undefined;
@@ -254,6 +214,7 @@ declare const openaiResponsesProviderOptionsSchema: z.ZodObject<{
254
214
  previousResponseId?: string | null | undefined;
255
215
  strictSchemas?: boolean | null | undefined;
256
216
  instructions?: string | null | undefined;
217
+ reasoningSummary?: string | null | undefined;
257
218
  }>;
258
219
  type OpenAIResponsesProviderOptions = z.infer<typeof openaiResponsesProviderOptionsSchema>;
259
220
 
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { LanguageModelV2, ProviderV2, EmbeddingModelV2, ImageModelV1, TranscriptionModelV1, SpeechModelV1 } from '@ai-sdk/provider';
1
+ import { LanguageModelV2, ProviderV2, EmbeddingModelV2, ImageModelV2, TranscriptionModelV1, SpeechModelV1 } from '@ai-sdk/provider';
2
2
  import { FetchFunction } from '@ai-sdk/provider-utils';
3
3
  import { z } from 'zod';
4
4
 
@@ -13,48 +13,6 @@ interface OpenAIChatSettings {
13
13
  }
14
14
 
15
15
  type OpenAICompletionModelId = 'gpt-3.5-turbo-instruct' | (string & {});
16
- interface OpenAICompletionSettings {
17
- /**
18
- Echo back the prompt in addition to the completion.
19
- */
20
- echo?: boolean;
21
- /**
22
- Modify the likelihood of specified tokens appearing in the completion.
23
-
24
- Accepts a JSON object that maps tokens (specified by their token ID in
25
- the GPT tokenizer) to an associated bias value from -100 to 100. You
26
- can use this tokenizer tool to convert text to token IDs. Mathematically,
27
- the bias is added to the logits generated by the model prior to sampling.
28
- The exact effect will vary per model, but values between -1 and 1 should
29
- decrease or increase likelihood of selection; values like -100 or 100
30
- should result in a ban or exclusive selection of the relevant token.
31
-
32
- As an example, you can pass {"50256": -100} to prevent the <|endoftext|>
33
- token from being generated.
34
- */
35
- logitBias?: Record<number, number>;
36
- /**
37
- Return the log probabilities of the tokens. Including logprobs will increase
38
- the response size and can slow down response times. However, it can
39
- be useful to better understand how the model is behaving.
40
-
41
- Setting to true will return the log probabilities of the tokens that
42
- were generated.
43
-
44
- Setting to a number will return the log probabilities of the top n
45
- tokens that were generated.
46
- */
47
- logprobs?: boolean | number;
48
- /**
49
- The suffix that comes after a completion of inserted text.
50
- */
51
- suffix?: string;
52
- /**
53
- A unique identifier representing your end-user, which can help OpenAI to
54
- monitor and detect abuse. Learn more.
55
- */
56
- user?: string;
57
- }
58
16
 
59
17
  type OpenAICompletionConfig = {
60
18
  provider: string;
@@ -69,9 +27,9 @@ type OpenAICompletionConfig = {
69
27
  declare class OpenAICompletionLanguageModel implements LanguageModelV2 {
70
28
  readonly specificationVersion = "v2";
71
29
  readonly modelId: OpenAICompletionModelId;
72
- readonly settings: OpenAICompletionSettings;
73
30
  private readonly config;
74
- constructor(modelId: OpenAICompletionModelId, settings: OpenAICompletionSettings, config: OpenAICompletionConfig);
31
+ private get providerOptionsName();
32
+ constructor(modelId: OpenAICompletionModelId, config: OpenAICompletionConfig);
75
33
  get provider(): string;
76
34
  getSupportedUrls(): Promise<Record<string, RegExp[]>>;
77
35
  private getArgs;
@@ -127,12 +85,12 @@ type OpenAIResponsesModelId = 'o1' | 'o1-2024-12-17' | 'o1-mini' | 'o1-mini-2024
127
85
  type OpenAISpeechModelId = 'tts-1' | 'tts-1-hd' | 'gpt-4o-mini-tts' | (string & {});
128
86
 
129
87
  interface OpenAIProvider extends ProviderV2 {
130
- (modelId: 'gpt-3.5-turbo-instruct', settings?: OpenAICompletionSettings): OpenAICompletionLanguageModel;
88
+ (modelId: 'gpt-3.5-turbo-instruct'): OpenAICompletionLanguageModel;
131
89
  (modelId: OpenAIChatModelId, settings?: OpenAIChatSettings): LanguageModelV2;
132
90
  /**
133
91
  Creates an OpenAI model for text generation.
134
92
  */
135
- languageModel(modelId: 'gpt-3.5-turbo-instruct', settings?: OpenAICompletionSettings): OpenAICompletionLanguageModel;
93
+ languageModel(modelId: 'gpt-3.5-turbo-instruct'): OpenAICompletionLanguageModel;
136
94
  languageModel(modelId: OpenAIChatModelId, settings?: OpenAIChatSettings): LanguageModelV2;
137
95
  /**
138
96
  Creates an OpenAI chat model for text generation.
@@ -145,7 +103,7 @@ interface OpenAIProvider extends ProviderV2 {
145
103
  /**
146
104
  Creates an OpenAI completion model for text generation.
147
105
  */
148
- completion(modelId: OpenAICompletionModelId, settings?: OpenAICompletionSettings): LanguageModelV2;
106
+ completion(modelId: OpenAICompletionModelId): LanguageModelV2;
149
107
  /**
150
108
  Creates a model for text embeddings.
151
109
  */
@@ -163,11 +121,11 @@ interface OpenAIProvider extends ProviderV2 {
163
121
  /**
164
122
  Creates a model for image generation.
165
123
  */
166
- image(modelId: OpenAIImageModelId, settings?: OpenAIImageSettings): ImageModelV1;
124
+ image(modelId: OpenAIImageModelId, settings?: OpenAIImageSettings): ImageModelV2;
167
125
  /**
168
126
  Creates a model for image generation.
169
127
  */
170
- imageModel(modelId: OpenAIImageModelId, settings?: OpenAIImageSettings): ImageModelV1;
128
+ imageModel(modelId: OpenAIImageModelId, settings?: OpenAIImageSettings): ImageModelV2;
171
129
  /**
172
130
  Creates a model for transcription.
173
131
  */
@@ -236,6 +194,7 @@ declare const openaiResponsesProviderOptionsSchema: z.ZodObject<{
236
194
  reasoningEffort: z.ZodOptional<z.ZodNullable<z.ZodString>>;
237
195
  strictSchemas: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
238
196
  instructions: z.ZodOptional<z.ZodNullable<z.ZodString>>;
197
+ reasoningSummary: z.ZodOptional<z.ZodNullable<z.ZodString>>;
239
198
  }, "strip", z.ZodTypeAny, {
240
199
  user?: string | null | undefined;
241
200
  parallelToolCalls?: boolean | null | undefined;
@@ -245,6 +204,7 @@ declare const openaiResponsesProviderOptionsSchema: z.ZodObject<{
245
204
  previousResponseId?: string | null | undefined;
246
205
  strictSchemas?: boolean | null | undefined;
247
206
  instructions?: string | null | undefined;
207
+ reasoningSummary?: string | null | undefined;
248
208
  }, {
249
209
  user?: string | null | undefined;
250
210
  parallelToolCalls?: boolean | null | undefined;
@@ -254,6 +214,7 @@ declare const openaiResponsesProviderOptionsSchema: z.ZodObject<{
254
214
  previousResponseId?: string | null | undefined;
255
215
  strictSchemas?: boolean | null | undefined;
256
216
  instructions?: string | null | undefined;
217
+ reasoningSummary?: string | null | undefined;
257
218
  }>;
258
219
  type OpenAIResponsesProviderOptions = z.infer<typeof openaiResponsesProviderOptionsSchema>;
259
220