@ai-sdk/openai 4.0.0-beta.8 → 4.0.0-canary.45
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 +405 -22
- package/README.md +2 -0
- package/dist/index.d.ts +181 -35
- package/dist/index.js +2552 -1626
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts +180 -28
- package/dist/internal/index.js +2322 -1648
- package/dist/internal/index.js.map +1 -1
- package/docs/03-openai.mdx +301 -25
- package/package.json +13 -14
- package/src/chat/convert-openai-chat-usage.ts +1 -1
- package/src/chat/convert-to-openai-chat-messages.ts +96 -68
- package/src/chat/map-openai-finish-reason.ts +1 -1
- package/src/chat/openai-chat-api.ts +6 -2
- package/src/chat/{openai-chat-options.ts → openai-chat-language-model-options.ts} +9 -1
- package/src/chat/openai-chat-language-model.ts +46 -142
- package/src/chat/openai-chat-prepare-tools.ts +3 -3
- package/src/completion/convert-openai-completion-usage.ts +1 -1
- package/src/completion/convert-to-openai-completion-prompt.ts +1 -2
- package/src/completion/map-openai-finish-reason.ts +1 -1
- package/src/completion/openai-completion-api.ts +5 -2
- package/src/completion/{openai-completion-options.ts → openai-completion-language-model-options.ts} +5 -1
- package/src/completion/openai-completion-language-model.ts +27 -11
- package/src/embedding/{openai-embedding-options.ts → openai-embedding-model-options.ts} +5 -1
- package/src/embedding/openai-embedding-model.ts +22 -5
- 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-options.ts +123 -0
- package/src/image/openai-image-model.ts +62 -83
- package/src/index.ts +13 -6
- package/src/internal/index.ts +6 -6
- package/src/openai-config.ts +7 -7
- package/src/openai-language-model-capabilities.ts +2 -2
- package/src/openai-provider.ts +42 -9
- package/src/openai-tools.ts +12 -1
- package/src/responses/convert-openai-responses-usage.ts +1 -1
- package/src/responses/convert-to-openai-responses-input.ts +240 -73
- package/src/responses/map-openai-responses-finish-reason.ts +1 -1
- package/src/responses/openai-responses-api.ts +144 -3
- package/src/responses/{openai-responses-options.ts → openai-responses-language-model-options.ts} +25 -1
- package/src/responses/openai-responses-language-model.ts +269 -45
- package/src/responses/openai-responses-prepare-tools.ts +44 -11
- 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-options.ts → openai-speech-model-options.ts} +5 -1
- package/src/speech/openai-speech-model.ts +23 -7
- 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-options.ts → openai-transcription-model-options.ts} +5 -1
- package/src/transcription/openai-transcription-model.ts +23 -7
- package/dist/index.d.mts +0 -1107
- package/dist/index.mjs +0 -6509
- package/dist/index.mjs.map +0 -1
- package/dist/internal/index.d.mts +0 -1137
- package/dist/internal/index.mjs +0 -6322
- package/dist/internal/index.mjs.map +0 -1
- package/src/image/openai-image-options.ts +0 -31
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,388 @@
|
|
|
1
1
|
# @ai-sdk/openai
|
|
2
2
|
|
|
3
|
+
## 4.0.0-canary.45
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 0c4c275: trigger initial canary release
|
|
8
|
+
- Updated dependencies [0c4c275]
|
|
9
|
+
- @ai-sdk/provider-utils@5.0.0-canary.31
|
|
10
|
+
- @ai-sdk/provider@4.0.0-canary.15
|
|
11
|
+
|
|
12
|
+
## 4.0.0-beta.44
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- bada0f3: feat(openai): preserve `namespace` on function_call output items
|
|
17
|
+
|
|
18
|
+
## 4.0.0-beta.43
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- 9ea40e0: chore(provider/openai): add type for image model options for type-safe processing
|
|
23
|
+
|
|
24
|
+
## 4.0.0-beta.42
|
|
25
|
+
|
|
26
|
+
### Major Changes
|
|
27
|
+
|
|
28
|
+
- 04e9009: chore: make provider implementations code patterns more consistent, including renaming certain exported symbols
|
|
29
|
+
|
|
30
|
+
For all externally exported symbols that were renamed, the old names continue to work via deprecated aliases.
|
|
31
|
+
|
|
32
|
+
### Patch Changes
|
|
33
|
+
|
|
34
|
+
- Updated dependencies [08d2129]
|
|
35
|
+
- @ai-sdk/provider-utils@5.0.0-beta.30
|
|
36
|
+
|
|
37
|
+
## 4.0.0-beta.41
|
|
38
|
+
|
|
39
|
+
### Patch Changes
|
|
40
|
+
|
|
41
|
+
- 9bd6512: feat(provider): change file part data property to be tagged with a type and remove the image part type
|
|
42
|
+
- 258c093: chore: ensure consistent import handling and avoid import duplicates or cycles
|
|
43
|
+
- Updated dependencies [9bd6512]
|
|
44
|
+
- Updated dependencies [258c093]
|
|
45
|
+
- Updated dependencies [b6783da]
|
|
46
|
+
- @ai-sdk/provider-utils@5.0.0-beta.29
|
|
47
|
+
- @ai-sdk/provider@4.0.0-beta.14
|
|
48
|
+
|
|
49
|
+
## 4.0.0-beta.40
|
|
50
|
+
|
|
51
|
+
### Patch Changes
|
|
52
|
+
|
|
53
|
+
- 9f0e36c: trigger release for all packages after provenance setup
|
|
54
|
+
- Updated dependencies [9f0e36c]
|
|
55
|
+
- @ai-sdk/provider@4.0.0-beta.13
|
|
56
|
+
- @ai-sdk/provider-utils@5.0.0-beta.28
|
|
57
|
+
|
|
58
|
+
## 4.0.0-beta.39
|
|
59
|
+
|
|
60
|
+
### Patch Changes
|
|
61
|
+
|
|
62
|
+
- 58a2ad7: fix: more precise default message for tool execution denial
|
|
63
|
+
- f9acbc0: feat(provider/openai): add gpt-image-2 model support
|
|
64
|
+
- Updated dependencies [785fe16]
|
|
65
|
+
- Updated dependencies [67df0a0]
|
|
66
|
+
- Updated dependencies [befb78c]
|
|
67
|
+
- Updated dependencies [0458559]
|
|
68
|
+
- Updated dependencies [5852c0a]
|
|
69
|
+
- Updated dependencies [fc92055]
|
|
70
|
+
- @ai-sdk/provider-utils@5.0.0-beta.27
|
|
71
|
+
|
|
72
|
+
## 4.0.0-beta.38
|
|
73
|
+
|
|
74
|
+
### Patch Changes
|
|
75
|
+
|
|
76
|
+
- bfb756d: patch - send content: null instead of empty string for tool-only assistant messages
|
|
77
|
+
- Updated dependencies [2e98477]
|
|
78
|
+
- @ai-sdk/provider-utils@5.0.0-beta.26
|
|
79
|
+
|
|
80
|
+
## 4.0.0-beta.37
|
|
81
|
+
|
|
82
|
+
### Patch Changes
|
|
83
|
+
|
|
84
|
+
- Updated dependencies [eea8d98]
|
|
85
|
+
- @ai-sdk/provider-utils@5.0.0-beta.25
|
|
86
|
+
|
|
87
|
+
## 4.0.0-beta.36
|
|
88
|
+
|
|
89
|
+
### Patch Changes
|
|
90
|
+
|
|
91
|
+
- 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.
|
|
92
|
+
- Updated dependencies [f807e45]
|
|
93
|
+
- @ai-sdk/provider-utils@5.0.0-beta.24
|
|
94
|
+
|
|
95
|
+
## 4.0.0-beta.35
|
|
96
|
+
|
|
97
|
+
### Patch Changes
|
|
98
|
+
|
|
99
|
+
- Updated dependencies [350ea38]
|
|
100
|
+
- @ai-sdk/provider-utils@5.0.0-beta.23
|
|
101
|
+
|
|
102
|
+
## 4.0.0-beta.34
|
|
103
|
+
|
|
104
|
+
### Patch Changes
|
|
105
|
+
|
|
106
|
+
- Updated dependencies [083947b]
|
|
107
|
+
- @ai-sdk/provider-utils@5.0.0-beta.22
|
|
108
|
+
|
|
109
|
+
## 4.0.0-beta.33
|
|
110
|
+
|
|
111
|
+
### Patch Changes
|
|
112
|
+
|
|
113
|
+
- Updated dependencies [add1126]
|
|
114
|
+
- @ai-sdk/provider-utils@5.0.0-beta.21
|
|
115
|
+
|
|
116
|
+
## 4.0.0-beta.32
|
|
117
|
+
|
|
118
|
+
### Patch Changes
|
|
119
|
+
|
|
120
|
+
- 0c4ac8a: fix(openai): default undefined tool-call input to empty object before serializing tool arguments
|
|
121
|
+
|
|
122
|
+
## 4.0.0-beta.31
|
|
123
|
+
|
|
124
|
+
### Patch Changes
|
|
125
|
+
|
|
126
|
+
- b3976a2: Add workflow serialization support to all provider models.
|
|
127
|
+
|
|
128
|
+
**`@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.
|
|
129
|
+
|
|
130
|
+
**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.
|
|
131
|
+
|
|
132
|
+
All provider model classes now include `WORKFLOW_SERIALIZE` and `WORKFLOW_DESERIALIZE` static methods, enabling them to cross workflow step boundaries without serialization errors.
|
|
133
|
+
|
|
134
|
+
- ff5eba1: feat: roll `image-*` tool output types into their equivalent `file-*` types
|
|
135
|
+
- Updated dependencies [b3976a2]
|
|
136
|
+
- Updated dependencies [ff5eba1]
|
|
137
|
+
- @ai-sdk/provider-utils@5.0.0-beta.20
|
|
138
|
+
- @ai-sdk/provider@4.0.0-beta.12
|
|
139
|
+
|
|
140
|
+
## 4.0.0-beta.30
|
|
141
|
+
|
|
142
|
+
### Major Changes
|
|
143
|
+
|
|
144
|
+
- ef992f8: Remove CommonJS exports from all packages. All packages are now ESM-only (`"type": "module"`). Consumers using `require()` must switch to ESM `import` syntax.
|
|
145
|
+
|
|
146
|
+
### Patch Changes
|
|
147
|
+
|
|
148
|
+
- Updated dependencies [ef992f8]
|
|
149
|
+
- @ai-sdk/provider@4.0.0-beta.11
|
|
150
|
+
- @ai-sdk/provider-utils@5.0.0-beta.19
|
|
151
|
+
|
|
152
|
+
## 4.0.0-beta.29
|
|
153
|
+
|
|
154
|
+
### Patch Changes
|
|
155
|
+
|
|
156
|
+
- 90e2d8a: chore: fix unused vars not being flagged by our lint tooling
|
|
157
|
+
- Updated dependencies [90e2d8a]
|
|
158
|
+
- @ai-sdk/provider-utils@5.0.0-beta.18
|
|
159
|
+
|
|
160
|
+
## 4.0.0-beta.28
|
|
161
|
+
|
|
162
|
+
### Patch Changes
|
|
163
|
+
|
|
164
|
+
- Updated dependencies [3ae1786]
|
|
165
|
+
- @ai-sdk/provider-utils@5.0.0-beta.17
|
|
166
|
+
|
|
167
|
+
## 4.0.0-beta.27
|
|
168
|
+
|
|
169
|
+
### Patch Changes
|
|
170
|
+
|
|
171
|
+
- Updated dependencies [176466a]
|
|
172
|
+
- @ai-sdk/provider@4.0.0-beta.10
|
|
173
|
+
- @ai-sdk/provider-utils@5.0.0-beta.16
|
|
174
|
+
|
|
175
|
+
## 4.0.0-beta.26
|
|
176
|
+
|
|
177
|
+
### Patch Changes
|
|
178
|
+
|
|
179
|
+
- e311194: feat(ai): allow passing provider instance to `uploadFile` and `uploadSkill` as shorthand
|
|
180
|
+
- Updated dependencies [e311194]
|
|
181
|
+
- @ai-sdk/provider@4.0.0-beta.9
|
|
182
|
+
- @ai-sdk/provider-utils@5.0.0-beta.15
|
|
183
|
+
|
|
184
|
+
## 4.0.0-beta.25
|
|
185
|
+
|
|
186
|
+
### Patch Changes
|
|
187
|
+
|
|
188
|
+
- 34bd95d: feat(ai): add support for uploading provider skills using the provider references abstraction
|
|
189
|
+
- Updated dependencies [34bd95d]
|
|
190
|
+
- Updated dependencies [008271d]
|
|
191
|
+
- @ai-sdk/provider@4.0.0-beta.8
|
|
192
|
+
- @ai-sdk/provider-utils@5.0.0-beta.14
|
|
193
|
+
|
|
194
|
+
## 4.0.0-beta.24
|
|
195
|
+
|
|
196
|
+
### Patch Changes
|
|
197
|
+
|
|
198
|
+
- Updated dependencies [b0c2869]
|
|
199
|
+
- Updated dependencies [7e26e81]
|
|
200
|
+
- @ai-sdk/provider-utils@5.0.0-beta.13
|
|
201
|
+
|
|
202
|
+
## 4.0.0-beta.23
|
|
203
|
+
|
|
204
|
+
### Patch Changes
|
|
205
|
+
|
|
206
|
+
- Updated dependencies [46d1149]
|
|
207
|
+
- @ai-sdk/provider-utils@5.0.0-beta.12
|
|
208
|
+
|
|
209
|
+
## 4.0.0-beta.22
|
|
210
|
+
|
|
211
|
+
### Patch Changes
|
|
212
|
+
|
|
213
|
+
- 6fd51c0: fix(provider): preserve error type prefix in getErrorMessage
|
|
214
|
+
- Updated dependencies [6fd51c0]
|
|
215
|
+
- @ai-sdk/provider-utils@5.0.0-beta.11
|
|
216
|
+
- @ai-sdk/provider@4.0.0-beta.7
|
|
217
|
+
|
|
218
|
+
## 4.0.0-beta.21
|
|
219
|
+
|
|
220
|
+
### Patch Changes
|
|
221
|
+
|
|
222
|
+
- c29a26f: feat(provider): add support for provider references and uploading files as supported per provider
|
|
223
|
+
- Updated dependencies [c29a26f]
|
|
224
|
+
- @ai-sdk/provider-utils@5.0.0-beta.10
|
|
225
|
+
- @ai-sdk/provider@4.0.0-beta.6
|
|
226
|
+
|
|
227
|
+
## 4.0.0-beta.20
|
|
228
|
+
|
|
229
|
+
### Patch Changes
|
|
230
|
+
|
|
231
|
+
- 38fc777: Add AI Gateway hint to provider READMEs
|
|
232
|
+
|
|
233
|
+
## 4.0.0-beta.19
|
|
234
|
+
|
|
235
|
+
### Patch Changes
|
|
236
|
+
|
|
237
|
+
- Updated dependencies [2e17091]
|
|
238
|
+
- @ai-sdk/provider-utils@5.0.0-beta.9
|
|
239
|
+
|
|
240
|
+
## 4.0.0-beta.18
|
|
241
|
+
|
|
242
|
+
### Patch Changes
|
|
243
|
+
|
|
244
|
+
- Updated dependencies [986c6fd]
|
|
245
|
+
- Updated dependencies [493295c]
|
|
246
|
+
- @ai-sdk/provider-utils@5.0.0-beta.8
|
|
247
|
+
|
|
248
|
+
## 4.0.0-beta.17
|
|
249
|
+
|
|
250
|
+
### Patch Changes
|
|
251
|
+
|
|
252
|
+
- 817a1a6: fix(openai): support file-url parts in tool output content
|
|
253
|
+
|
|
254
|
+
## 4.0.0-beta.16
|
|
255
|
+
|
|
256
|
+
### Patch Changes
|
|
257
|
+
|
|
258
|
+
- 1f509d4: fix(ai): force template check on 'kind' param
|
|
259
|
+
- Updated dependencies [1f509d4]
|
|
260
|
+
- @ai-sdk/provider-utils@5.0.0-beta.7
|
|
261
|
+
- @ai-sdk/provider@4.0.0-beta.5
|
|
262
|
+
|
|
263
|
+
## 4.0.0-beta.15
|
|
264
|
+
|
|
265
|
+
### Patch Changes
|
|
266
|
+
|
|
267
|
+
- 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.
|
|
268
|
+
|
|
269
|
+
## 4.0.0-beta.14
|
|
270
|
+
|
|
271
|
+
### Patch Changes
|
|
272
|
+
|
|
273
|
+
- e6376c2: fix(openai): preserve raw finish reason for failed responses stream events
|
|
274
|
+
|
|
275
|
+
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`.
|
|
276
|
+
|
|
277
|
+
## 4.0.0-beta.13
|
|
278
|
+
|
|
279
|
+
### Patch Changes
|
|
280
|
+
|
|
281
|
+
- 3887c70: feat(provider): add new top-level reasoning parameter to spec and support it in `generateText` and `streamText`
|
|
282
|
+
- Updated dependencies [3887c70]
|
|
283
|
+
- @ai-sdk/provider-utils@5.0.0-beta.6
|
|
284
|
+
- @ai-sdk/provider@4.0.0-beta.4
|
|
285
|
+
|
|
286
|
+
## 4.0.0-beta.12
|
|
287
|
+
|
|
288
|
+
### Patch Changes
|
|
289
|
+
|
|
290
|
+
- d9a1e9a: feat(openai): add server side compaction for openai
|
|
291
|
+
|
|
292
|
+
## 4.0.0-beta.11
|
|
293
|
+
|
|
294
|
+
### Patch Changes
|
|
295
|
+
|
|
296
|
+
- Updated dependencies [776b617]
|
|
297
|
+
- @ai-sdk/provider-utils@5.0.0-beta.5
|
|
298
|
+
- @ai-sdk/provider@4.0.0-beta.3
|
|
299
|
+
|
|
300
|
+
## 4.0.0-beta.10
|
|
301
|
+
|
|
302
|
+
### Major Changes
|
|
303
|
+
|
|
304
|
+
- 61753c3: ### `@ai-sdk/openai`: remove redundant `name` argument from `openai.tools.customTool()`
|
|
305
|
+
|
|
306
|
+
`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).
|
|
307
|
+
|
|
308
|
+
migration: remove the `name` property from `customTool()` calls. the object key is now used as the tool name sent to the openai api.
|
|
309
|
+
|
|
310
|
+
before:
|
|
311
|
+
|
|
312
|
+
```ts
|
|
313
|
+
tools: {
|
|
314
|
+
write_sql: openai.tools.customTool({
|
|
315
|
+
name: 'write_sql',
|
|
316
|
+
description: '...',
|
|
317
|
+
}),
|
|
318
|
+
}
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
after:
|
|
322
|
+
|
|
323
|
+
```ts
|
|
324
|
+
tools: {
|
|
325
|
+
write_sql: openai.tools.customTool({
|
|
326
|
+
description: '...',
|
|
327
|
+
}),
|
|
328
|
+
}
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
### `@ai-sdk/provider-utils`: `createToolNameMapping()` no longer accepts the `resolveProviderToolName` parameter
|
|
332
|
+
|
|
333
|
+
before: tool name can be set dynamically
|
|
334
|
+
|
|
335
|
+
```ts
|
|
336
|
+
const toolNameMapping = createToolNameMapping({
|
|
337
|
+
tools,
|
|
338
|
+
providerToolNames: {
|
|
339
|
+
"openai.code_interpreter": "code_interpreter",
|
|
340
|
+
"openai.file_search": "file_search",
|
|
341
|
+
"openai.image_generation": "image_generation",
|
|
342
|
+
"openai.local_shell": "local_shell",
|
|
343
|
+
"openai.shell": "shell",
|
|
344
|
+
"openai.web_search": "web_search",
|
|
345
|
+
"openai.web_search_preview": "web_search_preview",
|
|
346
|
+
"openai.mcp": "mcp",
|
|
347
|
+
"openai.apply_patch": "apply_patch",
|
|
348
|
+
},
|
|
349
|
+
resolveProviderToolName: (tool) =>
|
|
350
|
+
tool.id === "openai.custom"
|
|
351
|
+
? (tool.args as { name?: string }).name
|
|
352
|
+
: undefined,
|
|
353
|
+
});
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
after: tool name is static based on `tools` keys
|
|
357
|
+
|
|
358
|
+
```
|
|
359
|
+
const toolNameMapping = createToolNameMapping({
|
|
360
|
+
tools,
|
|
361
|
+
providerToolNames: {
|
|
362
|
+
'openai.code_interpreter': 'code_interpreter',
|
|
363
|
+
'openai.file_search': 'file_search',
|
|
364
|
+
'openai.image_generation': 'image_generation',
|
|
365
|
+
'openai.local_shell': 'local_shell',
|
|
366
|
+
'openai.shell': 'shell',
|
|
367
|
+
'openai.web_search': 'web_search',
|
|
368
|
+
'openai.web_search_preview': 'web_search_preview',
|
|
369
|
+
'openai.mcp': 'mcp',
|
|
370
|
+
'openai.apply_patch': 'apply_patch',
|
|
371
|
+
}
|
|
372
|
+
});
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
### Patch Changes
|
|
376
|
+
|
|
377
|
+
- Updated dependencies [61753c3]
|
|
378
|
+
- @ai-sdk/provider-utils@5.0.0-beta.4
|
|
379
|
+
|
|
380
|
+
## 4.0.0-beta.9
|
|
381
|
+
|
|
382
|
+
### Patch Changes
|
|
383
|
+
|
|
384
|
+
- 156cdf0: feat(openai): add new tool search tool
|
|
385
|
+
|
|
3
386
|
## 4.0.0-beta.8
|
|
4
387
|
|
|
5
388
|
### Patch Changes
|
|
@@ -404,13 +787,13 @@
|
|
|
404
787
|
Before
|
|
405
788
|
|
|
406
789
|
```ts
|
|
407
|
-
model.textEmbeddingModel(
|
|
790
|
+
model.textEmbeddingModel("my-model-id");
|
|
408
791
|
```
|
|
409
792
|
|
|
410
793
|
After
|
|
411
794
|
|
|
412
795
|
```ts
|
|
413
|
-
model.embeddingModel(
|
|
796
|
+
model.embeddingModel("my-model-id");
|
|
414
797
|
```
|
|
415
798
|
|
|
416
799
|
- 60f4775: fix: remove code for unsuported o1-mini and o1-preview models
|
|
@@ -420,15 +803,15 @@
|
|
|
420
803
|
- 2e86082: feat(provider/openai): `OpenAIChatLanguageModelOptions` type
|
|
421
804
|
|
|
422
805
|
```ts
|
|
423
|
-
import { openai, type OpenAIChatLanguageModelOptions } from
|
|
424
|
-
import { generateText } from
|
|
806
|
+
import { openai, type OpenAIChatLanguageModelOptions } from "@ai-sdk/openai";
|
|
807
|
+
import { generateText } from "ai";
|
|
425
808
|
|
|
426
809
|
await generateText({
|
|
427
|
-
model: openai.chat(
|
|
428
|
-
prompt:
|
|
810
|
+
model: openai.chat("gpt-4o"),
|
|
811
|
+
prompt: "Invent a new holiday and describe its traditions.",
|
|
429
812
|
providerOptions: {
|
|
430
813
|
openai: {
|
|
431
|
-
user:
|
|
814
|
+
user: "user-123",
|
|
432
815
|
} satisfies OpenAIChatLanguageModelOptions,
|
|
433
816
|
},
|
|
434
817
|
});
|
|
@@ -829,13 +1212,13 @@
|
|
|
829
1212
|
Before
|
|
830
1213
|
|
|
831
1214
|
```ts
|
|
832
|
-
model.textEmbeddingModel(
|
|
1215
|
+
model.textEmbeddingModel("my-model-id");
|
|
833
1216
|
```
|
|
834
1217
|
|
|
835
1218
|
After
|
|
836
1219
|
|
|
837
1220
|
```ts
|
|
838
|
-
model.embeddingModel(
|
|
1221
|
+
model.embeddingModel("my-model-id");
|
|
839
1222
|
```
|
|
840
1223
|
|
|
841
1224
|
- Updated dependencies [8d9e8ad]
|
|
@@ -1305,15 +1688,15 @@
|
|
|
1305
1688
|
- 2e86082: feat(provider/openai): `OpenAIChatLanguageModelOptions` type
|
|
1306
1689
|
|
|
1307
1690
|
```ts
|
|
1308
|
-
import { openai, type OpenAIChatLanguageModelOptions } from
|
|
1309
|
-
import { generateText } from
|
|
1691
|
+
import { openai, type OpenAIChatLanguageModelOptions } from "@ai-sdk/openai";
|
|
1692
|
+
import { generateText } from "ai";
|
|
1310
1693
|
|
|
1311
1694
|
await generateText({
|
|
1312
|
-
model: openai.chat(
|
|
1313
|
-
prompt:
|
|
1695
|
+
model: openai.chat("gpt-4o"),
|
|
1696
|
+
prompt: "Invent a new holiday and describe its traditions.",
|
|
1314
1697
|
providerOptions: {
|
|
1315
1698
|
openai: {
|
|
1316
|
-
user:
|
|
1699
|
+
user: "user-123",
|
|
1317
1700
|
} satisfies OpenAIChatLanguageModelOptions,
|
|
1318
1701
|
},
|
|
1319
1702
|
});
|
|
@@ -1609,7 +1992,7 @@
|
|
|
1609
1992
|
|
|
1610
1993
|
```js
|
|
1611
1994
|
await generateImage({
|
|
1612
|
-
model: luma.image(
|
|
1995
|
+
model: luma.image("photon-flash-1", {
|
|
1613
1996
|
maxImagesPerCall: 5,
|
|
1614
1997
|
pollIntervalMillis: 500,
|
|
1615
1998
|
}),
|
|
@@ -1622,7 +2005,7 @@
|
|
|
1622
2005
|
|
|
1623
2006
|
```js
|
|
1624
2007
|
await generateImage({
|
|
1625
|
-
model: luma.image(
|
|
2008
|
+
model: luma.image("photon-flash-1"),
|
|
1626
2009
|
prompt,
|
|
1627
2010
|
n: 10,
|
|
1628
2011
|
maxImagesPerCall: 5,
|
|
@@ -1684,10 +2067,10 @@
|
|
|
1684
2067
|
The `experimental_generateImage` method from the `ai` package now returnes revised prompts for OpenAI's image models.
|
|
1685
2068
|
|
|
1686
2069
|
```js
|
|
1687
|
-
const prompt =
|
|
2070
|
+
const prompt = "Santa Claus driving a Cadillac";
|
|
1688
2071
|
|
|
1689
2072
|
const { providerMetadata } = await experimental_generateImage({
|
|
1690
|
-
model: openai.image(
|
|
2073
|
+
model: openai.image("dall-e-3"),
|
|
1691
2074
|
prompt,
|
|
1692
2075
|
});
|
|
1693
2076
|
|
|
@@ -1986,7 +2369,7 @@
|
|
|
1986
2369
|
|
|
1987
2370
|
```js
|
|
1988
2371
|
await generateImage({
|
|
1989
|
-
model: luma.image(
|
|
2372
|
+
model: luma.image("photon-flash-1", {
|
|
1990
2373
|
maxImagesPerCall: 5,
|
|
1991
2374
|
pollIntervalMillis: 500,
|
|
1992
2375
|
}),
|
|
@@ -1999,7 +2382,7 @@
|
|
|
1999
2382
|
|
|
2000
2383
|
```js
|
|
2001
2384
|
await generateImage({
|
|
2002
|
-
model: luma.image(
|
|
2385
|
+
model: luma.image("photon-flash-1"),
|
|
2003
2386
|
prompt,
|
|
2004
2387
|
n: 10,
|
|
2005
2388
|
maxImagesPerCall: 5,
|
|
@@ -2044,10 +2427,10 @@
|
|
|
2044
2427
|
The `experimental_generateImage` method from the `ai` package now returnes revised prompts for OpenAI's image models.
|
|
2045
2428
|
|
|
2046
2429
|
```js
|
|
2047
|
-
const prompt =
|
|
2430
|
+
const prompt = "Santa Claus driving a Cadillac";
|
|
2048
2431
|
|
|
2049
2432
|
const { providerMetadata } = await experimental_generateImage({
|
|
2050
|
-
model: openai.image(
|
|
2433
|
+
model: openai.image("dall-e-3"),
|
|
2051
2434
|
prompt,
|
|
2052
2435
|
});
|
|
2053
2436
|
|
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
|