@ai-sdk/openai 4.0.0-beta.4 → 4.0.0-beta.41
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 +399 -22
- package/README.md +2 -0
- package/dist/index.d.ts +166 -49
- package/dist/index.js +2454 -1627
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts +176 -53
- package/dist/internal/index.js +2220 -1648
- package/dist/internal/index.js.map +1 -1
- package/docs/03-openai.mdx +292 -22
- package/package.json +13 -14
- package/src/chat/convert-openai-chat-usage.ts +2 -2
- package/src/chat/convert-to-openai-chat-messages.ts +99 -71
- package/src/chat/map-openai-finish-reason.ts +2 -2
- package/src/chat/openai-chat-api.ts +6 -2
- package/src/chat/openai-chat-language-model.ts +68 -164
- package/src/chat/openai-chat-options.ts +10 -1
- package/src/chat/openai-chat-prepare-tools.ts +7 -7
- package/src/completion/convert-openai-completion-usage.ts +2 -2
- package/src/completion/convert-to-openai-completion-prompt.ts +2 -3
- package/src/completion/map-openai-finish-reason.ts +2 -2
- package/src/completion/openai-completion-api.ts +5 -2
- package/src/completion/openai-completion-language-model.ts +46 -30
- package/src/completion/openai-completion-options.ts +5 -1
- package/src/embedding/openai-embedding-model.ts +25 -8
- package/src/embedding/openai-embedding-options.ts +5 -1
- package/src/files/openai-files-api.ts +17 -0
- package/src/files/openai-files-options.ts +22 -0
- package/src/files/openai-files.ts +100 -0
- package/src/image/openai-image-model.ts +31 -15
- package/src/image/openai-image-options.ts +3 -0
- package/src/index.ts +2 -0
- package/src/openai-config.ts +7 -7
- package/src/openai-language-model-capabilities.ts +3 -2
- package/src/openai-provider.ts +63 -30
- package/src/openai-tools.ts +12 -1
- package/src/responses/convert-openai-responses-usage.ts +2 -2
- package/src/responses/convert-to-openai-responses-input.ts +244 -77
- package/src/responses/map-openai-responses-finish-reason.ts +2 -2
- package/src/responses/openai-responses-api.ts +141 -3
- package/src/responses/openai-responses-language-model.ts +274 -61
- package/src/responses/openai-responses-options.ts +29 -3
- package/src/responses/openai-responses-prepare-tools.ts +48 -15
- package/src/responses/openai-responses-provider-metadata.ts +12 -2
- package/src/skills/openai-skills-api.ts +31 -0
- package/src/skills/openai-skills.ts +83 -0
- package/src/speech/openai-speech-model.ts +28 -12
- package/src/speech/openai-speech-options.ts +5 -1
- package/src/tool/apply-patch.ts +33 -32
- package/src/tool/code-interpreter.ts +40 -41
- package/src/tool/custom.ts +2 -8
- package/src/tool/file-search.ts +3 -3
- package/src/tool/image-generation.ts +2 -2
- package/src/tool/local-shell.ts +2 -2
- package/src/tool/mcp.ts +3 -3
- package/src/tool/shell.ts +9 -4
- package/src/tool/tool-search.ts +98 -0
- package/src/tool/web-search-preview.ts +2 -2
- package/src/tool/web-search.ts +2 -2
- package/src/transcription/openai-transcription-model.ts +30 -14
- package/src/transcription/openai-transcription-options.ts +5 -1
- package/dist/index.d.mts +0 -1107
- package/dist/index.mjs +0 -6508
- package/dist/index.mjs.map +0 -1
- package/dist/internal/index.d.mts +0 -1137
- package/dist/internal/index.mjs +0 -6321
- package/dist/internal/index.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,382 @@
|
|
|
1
1
|
# @ai-sdk/openai
|
|
2
2
|
|
|
3
|
+
## 4.0.0-beta.41
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 9bd6512: feat(provider): change file part data property to be tagged with a type and remove the image part type
|
|
8
|
+
- 258c093: chore: ensure consistent import handling and avoid import duplicates or cycles
|
|
9
|
+
- Updated dependencies [9bd6512]
|
|
10
|
+
- Updated dependencies [258c093]
|
|
11
|
+
- Updated dependencies [b6783da]
|
|
12
|
+
- @ai-sdk/provider-utils@5.0.0-beta.29
|
|
13
|
+
- @ai-sdk/provider@4.0.0-beta.14
|
|
14
|
+
|
|
15
|
+
## 4.0.0-beta.40
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- 9f0e36c: trigger release for all packages after provenance setup
|
|
20
|
+
- Updated dependencies [9f0e36c]
|
|
21
|
+
- @ai-sdk/provider@4.0.0-beta.13
|
|
22
|
+
- @ai-sdk/provider-utils@5.0.0-beta.28
|
|
23
|
+
|
|
24
|
+
## 4.0.0-beta.39
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- 58a2ad7: fix: more precise default message for tool execution denial
|
|
29
|
+
- f9acbc0: feat(provider/openai): add gpt-image-2 model support
|
|
30
|
+
- Updated dependencies [785fe16]
|
|
31
|
+
- Updated dependencies [67df0a0]
|
|
32
|
+
- Updated dependencies [befb78c]
|
|
33
|
+
- Updated dependencies [0458559]
|
|
34
|
+
- Updated dependencies [5852c0a]
|
|
35
|
+
- Updated dependencies [fc92055]
|
|
36
|
+
- @ai-sdk/provider-utils@5.0.0-beta.27
|
|
37
|
+
|
|
38
|
+
## 4.0.0-beta.38
|
|
39
|
+
|
|
40
|
+
### Patch Changes
|
|
41
|
+
|
|
42
|
+
- bfb756d: patch - send content: null instead of empty string for tool-only assistant messages
|
|
43
|
+
- Updated dependencies [2e98477]
|
|
44
|
+
- @ai-sdk/provider-utils@5.0.0-beta.26
|
|
45
|
+
|
|
46
|
+
## 4.0.0-beta.37
|
|
47
|
+
|
|
48
|
+
### Patch Changes
|
|
49
|
+
|
|
50
|
+
- Updated dependencies [eea8d98]
|
|
51
|
+
- @ai-sdk/provider-utils@5.0.0-beta.25
|
|
52
|
+
|
|
53
|
+
## 4.0.0-beta.36
|
|
54
|
+
|
|
55
|
+
### Patch Changes
|
|
56
|
+
|
|
57
|
+
- f807e45: Extract shared `StreamingToolCallTracker` class into `@ai-sdk/provider-utils` to deduplicate streaming tool call handling across OpenAI-compatible providers. Also adds missing `generateId()` fallback for `toolCallId` in Alibaba's `doGenerate` path and ensures all providers finalize unfinished tool calls during stream flush.
|
|
58
|
+
- Updated dependencies [f807e45]
|
|
59
|
+
- @ai-sdk/provider-utils@5.0.0-beta.24
|
|
60
|
+
|
|
61
|
+
## 4.0.0-beta.35
|
|
62
|
+
|
|
63
|
+
### Patch Changes
|
|
64
|
+
|
|
65
|
+
- Updated dependencies [350ea38]
|
|
66
|
+
- @ai-sdk/provider-utils@5.0.0-beta.23
|
|
67
|
+
|
|
68
|
+
## 4.0.0-beta.34
|
|
69
|
+
|
|
70
|
+
### Patch Changes
|
|
71
|
+
|
|
72
|
+
- Updated dependencies [083947b]
|
|
73
|
+
- @ai-sdk/provider-utils@5.0.0-beta.22
|
|
74
|
+
|
|
75
|
+
## 4.0.0-beta.33
|
|
76
|
+
|
|
77
|
+
### Patch Changes
|
|
78
|
+
|
|
79
|
+
- Updated dependencies [add1126]
|
|
80
|
+
- @ai-sdk/provider-utils@5.0.0-beta.21
|
|
81
|
+
|
|
82
|
+
## 4.0.0-beta.32
|
|
83
|
+
|
|
84
|
+
### Patch Changes
|
|
85
|
+
|
|
86
|
+
- 0c4ac8a: fix(openai): default undefined tool-call input to empty object before serializing tool arguments
|
|
87
|
+
|
|
88
|
+
## 4.0.0-beta.31
|
|
89
|
+
|
|
90
|
+
### Patch Changes
|
|
91
|
+
|
|
92
|
+
- b3976a2: Add workflow serialization support to all provider models.
|
|
93
|
+
|
|
94
|
+
**`@ai-sdk/provider-utils`:** New `serializeModel()` helper that extracts only serializable properties from a model instance, filtering out functions and objects containing functions. Third-party provider authors can use this to add workflow support to their own models.
|
|
95
|
+
|
|
96
|
+
**All providers:** `headers` is now optional in provider config types. This is non-breaking — existing code that passes `headers` continues to work. Custom provider implementations that construct model configs manually can now omit `headers`, which is useful when models are deserialized from a workflow step boundary where auth is provided separately.
|
|
97
|
+
|
|
98
|
+
All provider model classes now include `WORKFLOW_SERIALIZE` and `WORKFLOW_DESERIALIZE` static methods, enabling them to cross workflow step boundaries without serialization errors.
|
|
99
|
+
|
|
100
|
+
- ff5eba1: feat: roll `image-*` tool output types into their equivalent `file-*` types
|
|
101
|
+
- Updated dependencies [b3976a2]
|
|
102
|
+
- Updated dependencies [ff5eba1]
|
|
103
|
+
- @ai-sdk/provider-utils@5.0.0-beta.20
|
|
104
|
+
- @ai-sdk/provider@4.0.0-beta.12
|
|
105
|
+
|
|
106
|
+
## 4.0.0-beta.30
|
|
107
|
+
|
|
108
|
+
### Major Changes
|
|
109
|
+
|
|
110
|
+
- ef992f8: Remove CommonJS exports from all packages. All packages are now ESM-only (`"type": "module"`). Consumers using `require()` must switch to ESM `import` syntax.
|
|
111
|
+
|
|
112
|
+
### Patch Changes
|
|
113
|
+
|
|
114
|
+
- Updated dependencies [ef992f8]
|
|
115
|
+
- @ai-sdk/provider@4.0.0-beta.11
|
|
116
|
+
- @ai-sdk/provider-utils@5.0.0-beta.19
|
|
117
|
+
|
|
118
|
+
## 4.0.0-beta.29
|
|
119
|
+
|
|
120
|
+
### Patch Changes
|
|
121
|
+
|
|
122
|
+
- 90e2d8a: chore: fix unused vars not being flagged by our lint tooling
|
|
123
|
+
- Updated dependencies [90e2d8a]
|
|
124
|
+
- @ai-sdk/provider-utils@5.0.0-beta.18
|
|
125
|
+
|
|
126
|
+
## 4.0.0-beta.28
|
|
127
|
+
|
|
128
|
+
### Patch Changes
|
|
129
|
+
|
|
130
|
+
- Updated dependencies [3ae1786]
|
|
131
|
+
- @ai-sdk/provider-utils@5.0.0-beta.17
|
|
132
|
+
|
|
133
|
+
## 4.0.0-beta.27
|
|
134
|
+
|
|
135
|
+
### Patch Changes
|
|
136
|
+
|
|
137
|
+
- Updated dependencies [176466a]
|
|
138
|
+
- @ai-sdk/provider@4.0.0-beta.10
|
|
139
|
+
- @ai-sdk/provider-utils@5.0.0-beta.16
|
|
140
|
+
|
|
141
|
+
## 4.0.0-beta.26
|
|
142
|
+
|
|
143
|
+
### Patch Changes
|
|
144
|
+
|
|
145
|
+
- e311194: feat(ai): allow passing provider instance to `uploadFile` and `uploadSkill` as shorthand
|
|
146
|
+
- Updated dependencies [e311194]
|
|
147
|
+
- @ai-sdk/provider@4.0.0-beta.9
|
|
148
|
+
- @ai-sdk/provider-utils@5.0.0-beta.15
|
|
149
|
+
|
|
150
|
+
## 4.0.0-beta.25
|
|
151
|
+
|
|
152
|
+
### Patch Changes
|
|
153
|
+
|
|
154
|
+
- 34bd95d: feat(ai): add support for uploading provider skills using the provider references abstraction
|
|
155
|
+
- Updated dependencies [34bd95d]
|
|
156
|
+
- Updated dependencies [008271d]
|
|
157
|
+
- @ai-sdk/provider@4.0.0-beta.8
|
|
158
|
+
- @ai-sdk/provider-utils@5.0.0-beta.14
|
|
159
|
+
|
|
160
|
+
## 4.0.0-beta.24
|
|
161
|
+
|
|
162
|
+
### Patch Changes
|
|
163
|
+
|
|
164
|
+
- Updated dependencies [b0c2869]
|
|
165
|
+
- Updated dependencies [7e26e81]
|
|
166
|
+
- @ai-sdk/provider-utils@5.0.0-beta.13
|
|
167
|
+
|
|
168
|
+
## 4.0.0-beta.23
|
|
169
|
+
|
|
170
|
+
### Patch Changes
|
|
171
|
+
|
|
172
|
+
- Updated dependencies [46d1149]
|
|
173
|
+
- @ai-sdk/provider-utils@5.0.0-beta.12
|
|
174
|
+
|
|
175
|
+
## 4.0.0-beta.22
|
|
176
|
+
|
|
177
|
+
### Patch Changes
|
|
178
|
+
|
|
179
|
+
- 6fd51c0: fix(provider): preserve error type prefix in getErrorMessage
|
|
180
|
+
- Updated dependencies [6fd51c0]
|
|
181
|
+
- @ai-sdk/provider-utils@5.0.0-beta.11
|
|
182
|
+
- @ai-sdk/provider@4.0.0-beta.7
|
|
183
|
+
|
|
184
|
+
## 4.0.0-beta.21
|
|
185
|
+
|
|
186
|
+
### Patch Changes
|
|
187
|
+
|
|
188
|
+
- c29a26f: feat(provider): add support for provider references and uploading files as supported per provider
|
|
189
|
+
- Updated dependencies [c29a26f]
|
|
190
|
+
- @ai-sdk/provider-utils@5.0.0-beta.10
|
|
191
|
+
- @ai-sdk/provider@4.0.0-beta.6
|
|
192
|
+
|
|
193
|
+
## 4.0.0-beta.20
|
|
194
|
+
|
|
195
|
+
### Patch Changes
|
|
196
|
+
|
|
197
|
+
- 38fc777: Add AI Gateway hint to provider READMEs
|
|
198
|
+
|
|
199
|
+
## 4.0.0-beta.19
|
|
200
|
+
|
|
201
|
+
### Patch Changes
|
|
202
|
+
|
|
203
|
+
- Updated dependencies [2e17091]
|
|
204
|
+
- @ai-sdk/provider-utils@5.0.0-beta.9
|
|
205
|
+
|
|
206
|
+
## 4.0.0-beta.18
|
|
207
|
+
|
|
208
|
+
### Patch Changes
|
|
209
|
+
|
|
210
|
+
- Updated dependencies [986c6fd]
|
|
211
|
+
- Updated dependencies [493295c]
|
|
212
|
+
- @ai-sdk/provider-utils@5.0.0-beta.8
|
|
213
|
+
|
|
214
|
+
## 4.0.0-beta.17
|
|
215
|
+
|
|
216
|
+
### Patch Changes
|
|
217
|
+
|
|
218
|
+
- 817a1a6: fix(openai): support file-url parts in tool output content
|
|
219
|
+
|
|
220
|
+
## 4.0.0-beta.16
|
|
221
|
+
|
|
222
|
+
### Patch Changes
|
|
223
|
+
|
|
224
|
+
- 1f509d4: fix(ai): force template check on 'kind' param
|
|
225
|
+
- Updated dependencies [1f509d4]
|
|
226
|
+
- @ai-sdk/provider-utils@5.0.0-beta.7
|
|
227
|
+
- @ai-sdk/provider@4.0.0-beta.5
|
|
228
|
+
|
|
229
|
+
## 4.0.0-beta.15
|
|
230
|
+
|
|
231
|
+
### Patch Changes
|
|
232
|
+
|
|
233
|
+
- 365da1a: Add `gpt-5.4-mini`, `gpt-5.4-mini-2026-03-17`, `gpt-5.4-nano`, and `gpt-5.4-nano-2026-03-17` models.
|
|
234
|
+
|
|
235
|
+
## 4.0.0-beta.14
|
|
236
|
+
|
|
237
|
+
### Patch Changes
|
|
238
|
+
|
|
239
|
+
- e6376c2: fix(openai): preserve raw finish reason for failed responses stream events
|
|
240
|
+
|
|
241
|
+
Handle `response.failed` chunks in Responses API streaming so `finishReason.raw` is preserved from `incomplete_details.reason` (e.g. `max_output_tokens`), and map failed-without-reason cases to unified `error` instead of `other`.
|
|
242
|
+
|
|
243
|
+
## 4.0.0-beta.13
|
|
244
|
+
|
|
245
|
+
### Patch Changes
|
|
246
|
+
|
|
247
|
+
- 3887c70: feat(provider): add new top-level reasoning parameter to spec and support it in `generateText` and `streamText`
|
|
248
|
+
- Updated dependencies [3887c70]
|
|
249
|
+
- @ai-sdk/provider-utils@5.0.0-beta.6
|
|
250
|
+
- @ai-sdk/provider@4.0.0-beta.4
|
|
251
|
+
|
|
252
|
+
## 4.0.0-beta.12
|
|
253
|
+
|
|
254
|
+
### Patch Changes
|
|
255
|
+
|
|
256
|
+
- d9a1e9a: feat(openai): add server side compaction for openai
|
|
257
|
+
|
|
258
|
+
## 4.0.0-beta.11
|
|
259
|
+
|
|
260
|
+
### Patch Changes
|
|
261
|
+
|
|
262
|
+
- Updated dependencies [776b617]
|
|
263
|
+
- @ai-sdk/provider-utils@5.0.0-beta.5
|
|
264
|
+
- @ai-sdk/provider@4.0.0-beta.3
|
|
265
|
+
|
|
266
|
+
## 4.0.0-beta.10
|
|
267
|
+
|
|
268
|
+
### Major Changes
|
|
269
|
+
|
|
270
|
+
- 61753c3: ### `@ai-sdk/openai`: remove redundant `name` argument from `openai.tools.customTool()`
|
|
271
|
+
|
|
272
|
+
`openai.tools.customTool()` no longer accepts a `name` field. the tool name is now derived from the sdk tool key (the object key in the `tools` object).
|
|
273
|
+
|
|
274
|
+
migration: remove the `name` property from `customTool()` calls. the object key is now used as the tool name sent to the openai api.
|
|
275
|
+
|
|
276
|
+
before:
|
|
277
|
+
|
|
278
|
+
```ts
|
|
279
|
+
tools: {
|
|
280
|
+
write_sql: openai.tools.customTool({
|
|
281
|
+
name: 'write_sql',
|
|
282
|
+
description: '...',
|
|
283
|
+
}),
|
|
284
|
+
}
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
after:
|
|
288
|
+
|
|
289
|
+
```ts
|
|
290
|
+
tools: {
|
|
291
|
+
write_sql: openai.tools.customTool({
|
|
292
|
+
description: '...',
|
|
293
|
+
}),
|
|
294
|
+
}
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
### `@ai-sdk/provider-utils`: `createToolNameMapping()` no longer accepts the `resolveProviderToolName` parameter
|
|
298
|
+
|
|
299
|
+
before: tool name can be set dynamically
|
|
300
|
+
|
|
301
|
+
```ts
|
|
302
|
+
const toolNameMapping = createToolNameMapping({
|
|
303
|
+
tools,
|
|
304
|
+
providerToolNames: {
|
|
305
|
+
"openai.code_interpreter": "code_interpreter",
|
|
306
|
+
"openai.file_search": "file_search",
|
|
307
|
+
"openai.image_generation": "image_generation",
|
|
308
|
+
"openai.local_shell": "local_shell",
|
|
309
|
+
"openai.shell": "shell",
|
|
310
|
+
"openai.web_search": "web_search",
|
|
311
|
+
"openai.web_search_preview": "web_search_preview",
|
|
312
|
+
"openai.mcp": "mcp",
|
|
313
|
+
"openai.apply_patch": "apply_patch",
|
|
314
|
+
},
|
|
315
|
+
resolveProviderToolName: (tool) =>
|
|
316
|
+
tool.id === "openai.custom"
|
|
317
|
+
? (tool.args as { name?: string }).name
|
|
318
|
+
: undefined,
|
|
319
|
+
});
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
after: tool name is static based on `tools` keys
|
|
323
|
+
|
|
324
|
+
```
|
|
325
|
+
const toolNameMapping = createToolNameMapping({
|
|
326
|
+
tools,
|
|
327
|
+
providerToolNames: {
|
|
328
|
+
'openai.code_interpreter': 'code_interpreter',
|
|
329
|
+
'openai.file_search': 'file_search',
|
|
330
|
+
'openai.image_generation': 'image_generation',
|
|
331
|
+
'openai.local_shell': 'local_shell',
|
|
332
|
+
'openai.shell': 'shell',
|
|
333
|
+
'openai.web_search': 'web_search',
|
|
334
|
+
'openai.web_search_preview': 'web_search_preview',
|
|
335
|
+
'openai.mcp': 'mcp',
|
|
336
|
+
'openai.apply_patch': 'apply_patch',
|
|
337
|
+
}
|
|
338
|
+
});
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
### Patch Changes
|
|
342
|
+
|
|
343
|
+
- Updated dependencies [61753c3]
|
|
344
|
+
- @ai-sdk/provider-utils@5.0.0-beta.4
|
|
345
|
+
|
|
346
|
+
## 4.0.0-beta.9
|
|
347
|
+
|
|
348
|
+
### Patch Changes
|
|
349
|
+
|
|
350
|
+
- 156cdf0: feat(openai): add new tool search tool
|
|
351
|
+
|
|
352
|
+
## 4.0.0-beta.8
|
|
353
|
+
|
|
354
|
+
### Patch Changes
|
|
355
|
+
|
|
356
|
+
- Updated dependencies [f7d4f01]
|
|
357
|
+
- @ai-sdk/provider-utils@5.0.0-beta.3
|
|
358
|
+
- @ai-sdk/provider@4.0.0-beta.2
|
|
359
|
+
|
|
360
|
+
## 4.0.0-beta.7
|
|
361
|
+
|
|
362
|
+
### Patch Changes
|
|
363
|
+
|
|
364
|
+
- Updated dependencies [5c2a5a2]
|
|
365
|
+
- @ai-sdk/provider@4.0.0-beta.1
|
|
366
|
+
- @ai-sdk/provider-utils@5.0.0-beta.2
|
|
367
|
+
|
|
368
|
+
## 4.0.0-beta.6
|
|
369
|
+
|
|
370
|
+
### Patch Changes
|
|
371
|
+
|
|
372
|
+
- 83f9d04: feat(openai): upgrade v3 specs to v4
|
|
373
|
+
|
|
374
|
+
## 4.0.0-beta.5
|
|
375
|
+
|
|
376
|
+
### Patch Changes
|
|
377
|
+
|
|
378
|
+
- ac18f89: feat(provider/openai): add `gpt-5.3-chat-latest`
|
|
379
|
+
|
|
3
380
|
## 4.0.0-beta.4
|
|
4
381
|
|
|
5
382
|
### Patch Changes
|
|
@@ -376,13 +753,13 @@
|
|
|
376
753
|
Before
|
|
377
754
|
|
|
378
755
|
```ts
|
|
379
|
-
model.textEmbeddingModel(
|
|
756
|
+
model.textEmbeddingModel("my-model-id");
|
|
380
757
|
```
|
|
381
758
|
|
|
382
759
|
After
|
|
383
760
|
|
|
384
761
|
```ts
|
|
385
|
-
model.embeddingModel(
|
|
762
|
+
model.embeddingModel("my-model-id");
|
|
386
763
|
```
|
|
387
764
|
|
|
388
765
|
- 60f4775: fix: remove code for unsuported o1-mini and o1-preview models
|
|
@@ -392,15 +769,15 @@
|
|
|
392
769
|
- 2e86082: feat(provider/openai): `OpenAIChatLanguageModelOptions` type
|
|
393
770
|
|
|
394
771
|
```ts
|
|
395
|
-
import { openai, type OpenAIChatLanguageModelOptions } from
|
|
396
|
-
import { generateText } from
|
|
772
|
+
import { openai, type OpenAIChatLanguageModelOptions } from "@ai-sdk/openai";
|
|
773
|
+
import { generateText } from "ai";
|
|
397
774
|
|
|
398
775
|
await generateText({
|
|
399
|
-
model: openai.chat(
|
|
400
|
-
prompt:
|
|
776
|
+
model: openai.chat("gpt-4o"),
|
|
777
|
+
prompt: "Invent a new holiday and describe its traditions.",
|
|
401
778
|
providerOptions: {
|
|
402
779
|
openai: {
|
|
403
|
-
user:
|
|
780
|
+
user: "user-123",
|
|
404
781
|
} satisfies OpenAIChatLanguageModelOptions,
|
|
405
782
|
},
|
|
406
783
|
});
|
|
@@ -801,13 +1178,13 @@
|
|
|
801
1178
|
Before
|
|
802
1179
|
|
|
803
1180
|
```ts
|
|
804
|
-
model.textEmbeddingModel(
|
|
1181
|
+
model.textEmbeddingModel("my-model-id");
|
|
805
1182
|
```
|
|
806
1183
|
|
|
807
1184
|
After
|
|
808
1185
|
|
|
809
1186
|
```ts
|
|
810
|
-
model.embeddingModel(
|
|
1187
|
+
model.embeddingModel("my-model-id");
|
|
811
1188
|
```
|
|
812
1189
|
|
|
813
1190
|
- Updated dependencies [8d9e8ad]
|
|
@@ -1277,15 +1654,15 @@
|
|
|
1277
1654
|
- 2e86082: feat(provider/openai): `OpenAIChatLanguageModelOptions` type
|
|
1278
1655
|
|
|
1279
1656
|
```ts
|
|
1280
|
-
import { openai, type OpenAIChatLanguageModelOptions } from
|
|
1281
|
-
import { generateText } from
|
|
1657
|
+
import { openai, type OpenAIChatLanguageModelOptions } from "@ai-sdk/openai";
|
|
1658
|
+
import { generateText } from "ai";
|
|
1282
1659
|
|
|
1283
1660
|
await generateText({
|
|
1284
|
-
model: openai.chat(
|
|
1285
|
-
prompt:
|
|
1661
|
+
model: openai.chat("gpt-4o"),
|
|
1662
|
+
prompt: "Invent a new holiday and describe its traditions.",
|
|
1286
1663
|
providerOptions: {
|
|
1287
1664
|
openai: {
|
|
1288
|
-
user:
|
|
1665
|
+
user: "user-123",
|
|
1289
1666
|
} satisfies OpenAIChatLanguageModelOptions,
|
|
1290
1667
|
},
|
|
1291
1668
|
});
|
|
@@ -1581,7 +1958,7 @@
|
|
|
1581
1958
|
|
|
1582
1959
|
```js
|
|
1583
1960
|
await generateImage({
|
|
1584
|
-
model: luma.image(
|
|
1961
|
+
model: luma.image("photon-flash-1", {
|
|
1585
1962
|
maxImagesPerCall: 5,
|
|
1586
1963
|
pollIntervalMillis: 500,
|
|
1587
1964
|
}),
|
|
@@ -1594,7 +1971,7 @@
|
|
|
1594
1971
|
|
|
1595
1972
|
```js
|
|
1596
1973
|
await generateImage({
|
|
1597
|
-
model: luma.image(
|
|
1974
|
+
model: luma.image("photon-flash-1"),
|
|
1598
1975
|
prompt,
|
|
1599
1976
|
n: 10,
|
|
1600
1977
|
maxImagesPerCall: 5,
|
|
@@ -1656,10 +2033,10 @@
|
|
|
1656
2033
|
The `experimental_generateImage` method from the `ai` package now returnes revised prompts for OpenAI's image models.
|
|
1657
2034
|
|
|
1658
2035
|
```js
|
|
1659
|
-
const prompt =
|
|
2036
|
+
const prompt = "Santa Claus driving a Cadillac";
|
|
1660
2037
|
|
|
1661
2038
|
const { providerMetadata } = await experimental_generateImage({
|
|
1662
|
-
model: openai.image(
|
|
2039
|
+
model: openai.image("dall-e-3"),
|
|
1663
2040
|
prompt,
|
|
1664
2041
|
});
|
|
1665
2042
|
|
|
@@ -1958,7 +2335,7 @@
|
|
|
1958
2335
|
|
|
1959
2336
|
```js
|
|
1960
2337
|
await generateImage({
|
|
1961
|
-
model: luma.image(
|
|
2338
|
+
model: luma.image("photon-flash-1", {
|
|
1962
2339
|
maxImagesPerCall: 5,
|
|
1963
2340
|
pollIntervalMillis: 500,
|
|
1964
2341
|
}),
|
|
@@ -1971,7 +2348,7 @@
|
|
|
1971
2348
|
|
|
1972
2349
|
```js
|
|
1973
2350
|
await generateImage({
|
|
1974
|
-
model: luma.image(
|
|
2351
|
+
model: luma.image("photon-flash-1"),
|
|
1975
2352
|
prompt,
|
|
1976
2353
|
n: 10,
|
|
1977
2354
|
maxImagesPerCall: 5,
|
|
@@ -2016,10 +2393,10 @@
|
|
|
2016
2393
|
The `experimental_generateImage` method from the `ai` package now returnes revised prompts for OpenAI's image models.
|
|
2017
2394
|
|
|
2018
2395
|
```js
|
|
2019
|
-
const prompt =
|
|
2396
|
+
const prompt = "Santa Claus driving a Cadillac";
|
|
2020
2397
|
|
|
2021
2398
|
const { providerMetadata } = await experimental_generateImage({
|
|
2022
|
-
model: openai.image(
|
|
2399
|
+
model: openai.image("dall-e-3"),
|
|
2023
2400
|
prompt,
|
|
2024
2401
|
});
|
|
2025
2402
|
|
package/README.md
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
The **[OpenAI provider](https://ai-sdk.dev/providers/ai-sdk-providers/openai)** for the [AI SDK](https://ai-sdk.dev/docs)
|
|
4
4
|
contains language model support for the OpenAI chat and completion APIs and embedding model support for the OpenAI embeddings API.
|
|
5
5
|
|
|
6
|
+
> **Deploying to Vercel?** With Vercel's AI Gateway you can access OpenAI (and hundreds of models from other providers) — no additional packages, API keys, or extra cost. [Get started with AI Gateway](https://vercel.com/ai-gateway).
|
|
7
|
+
|
|
6
8
|
## Setup
|
|
7
9
|
|
|
8
10
|
The OpenAI provider is available in the `@ai-sdk/openai` module. You can install it with
|