@ai-sdk/azure 1.3.23 → 2.0.0-alpha.2
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 +240 -61
- package/dist/index.d.mts +12 -13
- package/dist/index.d.ts +12 -13
- package/dist/index.js +12 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -14
- package/dist/index.mjs.map +1 -1
- package/package.json +14 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,133 +1,312 @@
|
|
|
1
1
|
# @ai-sdk/azure
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 2.0.0-alpha.2
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
- Updated dependencies [
|
|
8
|
-
- @ai-sdk/provider
|
|
9
|
-
- @ai-sdk/openai@
|
|
7
|
+
- Updated dependencies [26535e0]
|
|
8
|
+
- @ai-sdk/provider@2.0.0-alpha.2
|
|
9
|
+
- @ai-sdk/openai@2.0.0-alpha.2
|
|
10
|
+
- @ai-sdk/provider-utils@3.0.0-alpha.2
|
|
10
11
|
|
|
11
|
-
##
|
|
12
|
+
## 2.0.0-alpha.1
|
|
12
13
|
|
|
13
14
|
### Patch Changes
|
|
14
15
|
|
|
15
|
-
- Updated dependencies [
|
|
16
|
-
- @ai-sdk/
|
|
16
|
+
- Updated dependencies [3f2f00c]
|
|
17
|
+
- @ai-sdk/provider@2.0.0-alpha.1
|
|
18
|
+
- @ai-sdk/openai@2.0.0-alpha.1
|
|
19
|
+
- @ai-sdk/provider-utils@3.0.0-alpha.1
|
|
17
20
|
|
|
18
|
-
##
|
|
21
|
+
## 2.0.0-canary.21
|
|
19
22
|
|
|
20
23
|
### Patch Changes
|
|
21
24
|
|
|
22
|
-
- Updated dependencies [
|
|
23
|
-
- @ai-sdk/
|
|
25
|
+
- Updated dependencies [faf8446]
|
|
26
|
+
- @ai-sdk/provider-utils@3.0.0-canary.19
|
|
27
|
+
- @ai-sdk/openai@2.0.0-canary.20
|
|
24
28
|
|
|
25
|
-
##
|
|
29
|
+
## 2.0.0-canary.20
|
|
26
30
|
|
|
27
31
|
### Patch Changes
|
|
28
32
|
|
|
29
|
-
- Updated dependencies [
|
|
30
|
-
- @ai-sdk/
|
|
33
|
+
- Updated dependencies [40acf9b]
|
|
34
|
+
- @ai-sdk/provider-utils@3.0.0-canary.18
|
|
35
|
+
- @ai-sdk/openai@2.0.0-canary.19
|
|
31
36
|
|
|
32
|
-
##
|
|
37
|
+
## 2.0.0-canary.19
|
|
38
|
+
|
|
39
|
+
### Major Changes
|
|
40
|
+
|
|
41
|
+
- 516be5b: ### Move Image Model Settings into generate options
|
|
42
|
+
|
|
43
|
+
Image Models no longer have settings. Instead, `maxImagesPerCall` can be passed directly to `generateImage()`. All other image settings can be passed to `providerOptions[provider]`.
|
|
44
|
+
|
|
45
|
+
Before
|
|
46
|
+
|
|
47
|
+
```js
|
|
48
|
+
await generateImage({
|
|
49
|
+
model: luma.image('photon-flash-1', {
|
|
50
|
+
maxImagesPerCall: 5,
|
|
51
|
+
pollIntervalMillis: 500,
|
|
52
|
+
}),
|
|
53
|
+
prompt,
|
|
54
|
+
n: 10,
|
|
55
|
+
});
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
After
|
|
59
|
+
|
|
60
|
+
```js
|
|
61
|
+
await generateImage({
|
|
62
|
+
model: luma.image('photon-flash-1'),
|
|
63
|
+
prompt,
|
|
64
|
+
n: 10,
|
|
65
|
+
maxImagesPerCall: 5,
|
|
66
|
+
providerOptions: {
|
|
67
|
+
luma: { pollIntervalMillis: 5 },
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Pull Request: https://github.com/vercel/ai/pull/6180
|
|
73
|
+
|
|
74
|
+
### Patch Changes
|
|
75
|
+
|
|
76
|
+
- Updated dependencies [516be5b]
|
|
77
|
+
- Updated dependencies [ea7a7c9]
|
|
78
|
+
- @ai-sdk/openai@2.0.0-canary.18
|
|
79
|
+
- @ai-sdk/provider-utils@3.0.0-canary.17
|
|
80
|
+
|
|
81
|
+
## 2.0.0-canary.18
|
|
82
|
+
|
|
83
|
+
### Patch Changes
|
|
84
|
+
|
|
85
|
+
- 52ce942: chore(providers/openai): remove & enable strict compatibility by default
|
|
86
|
+
- Updated dependencies [52ce942]
|
|
87
|
+
- Updated dependencies [87b828f]
|
|
88
|
+
- @ai-sdk/openai@2.0.0-canary.17
|
|
89
|
+
- @ai-sdk/provider-utils@3.0.0-canary.16
|
|
90
|
+
|
|
91
|
+
## 2.0.0-canary.17
|
|
92
|
+
|
|
93
|
+
### Patch Changes
|
|
94
|
+
|
|
95
|
+
- Updated dependencies [a571d6e]
|
|
96
|
+
- Updated dependencies [a8c8bd5]
|
|
97
|
+
- Updated dependencies [7979f7f]
|
|
98
|
+
- Updated dependencies [928fadf]
|
|
99
|
+
- Updated dependencies [41fa418]
|
|
100
|
+
- Updated dependencies [6f231db]
|
|
101
|
+
- @ai-sdk/provider-utils@3.0.0-canary.15
|
|
102
|
+
- @ai-sdk/provider@2.0.0-canary.14
|
|
103
|
+
- @ai-sdk/openai@2.0.0-canary.16
|
|
104
|
+
|
|
105
|
+
## 2.0.0-canary.16
|
|
106
|
+
|
|
107
|
+
### Patch Changes
|
|
108
|
+
|
|
109
|
+
- Updated dependencies [957b739]
|
|
110
|
+
- Updated dependencies [136819b]
|
|
111
|
+
- Updated dependencies [9bd5ab5]
|
|
112
|
+
- Updated dependencies [284353f]
|
|
113
|
+
- @ai-sdk/provider-utils@3.0.0-canary.14
|
|
114
|
+
- @ai-sdk/openai@2.0.0-canary.15
|
|
115
|
+
- @ai-sdk/provider@2.0.0-canary.13
|
|
116
|
+
|
|
117
|
+
## 2.0.0-canary.15
|
|
118
|
+
|
|
119
|
+
### Patch Changes
|
|
120
|
+
|
|
121
|
+
- Updated dependencies [7b3ae3f]
|
|
122
|
+
- Updated dependencies [0ff02bb]
|
|
123
|
+
- Updated dependencies [fa758ea]
|
|
124
|
+
- @ai-sdk/provider@2.0.0-canary.12
|
|
125
|
+
- @ai-sdk/provider-utils@3.0.0-canary.13
|
|
126
|
+
- @ai-sdk/openai@2.0.0-canary.14
|
|
127
|
+
|
|
128
|
+
## 2.0.0-canary.14
|
|
129
|
+
|
|
130
|
+
### Patch Changes
|
|
131
|
+
|
|
132
|
+
- 9bf7291: chore(providers/openai): enable structuredOutputs by default & switch to provider option
|
|
133
|
+
- 4617fab: chore(embedding-models): remove remaining settings
|
|
134
|
+
- Updated dependencies [177526b]
|
|
135
|
+
- Updated dependencies [c15dfbf]
|
|
136
|
+
- Updated dependencies [9bf7291]
|
|
137
|
+
- Updated dependencies [4617fab]
|
|
138
|
+
- Updated dependencies [e030615]
|
|
139
|
+
- @ai-sdk/openai@2.0.0-canary.13
|
|
140
|
+
- @ai-sdk/provider@2.0.0-canary.11
|
|
141
|
+
- @ai-sdk/provider-utils@3.0.0-canary.12
|
|
142
|
+
|
|
143
|
+
## 2.0.0-canary.13
|
|
144
|
+
|
|
145
|
+
### Patch Changes
|
|
146
|
+
|
|
147
|
+
- db72adc: chore(providers/openai): update completion model to use providerOptions
|
|
148
|
+
- 9301f86: refactor (image-model): rename `ImageModelV1` to `ImageModelV2`
|
|
149
|
+
- Updated dependencies [db72adc]
|
|
150
|
+
- Updated dependencies [66962ed]
|
|
151
|
+
- Updated dependencies [9301f86]
|
|
152
|
+
- Updated dependencies [a3f768e]
|
|
153
|
+
- Updated dependencies [7df7a25]
|
|
154
|
+
- @ai-sdk/openai@2.0.0-canary.12
|
|
155
|
+
- @ai-sdk/provider-utils@3.0.0-canary.11
|
|
156
|
+
- @ai-sdk/provider@2.0.0-canary.10
|
|
157
|
+
|
|
158
|
+
## 2.0.0-canary.12
|
|
33
159
|
|
|
34
160
|
### Patch Changes
|
|
35
161
|
|
|
36
|
-
- Updated dependencies [
|
|
37
|
-
|
|
162
|
+
- Updated dependencies [e86be6f]
|
|
163
|
+
- Updated dependencies [8493141]
|
|
164
|
+
- @ai-sdk/provider@2.0.0-canary.9
|
|
165
|
+
- @ai-sdk/openai@2.0.0-canary.11
|
|
166
|
+
- @ai-sdk/provider-utils@3.0.0-canary.10
|
|
38
167
|
|
|
39
|
-
##
|
|
168
|
+
## 2.0.0-canary.11
|
|
40
169
|
|
|
41
170
|
### Patch Changes
|
|
42
171
|
|
|
43
|
-
- Updated dependencies [
|
|
44
|
-
|
|
172
|
+
- Updated dependencies [95857aa]
|
|
173
|
+
- Updated dependencies [3bd3c0b]
|
|
174
|
+
- Updated dependencies [7ea4132]
|
|
175
|
+
- @ai-sdk/provider@2.0.0-canary.8
|
|
176
|
+
- @ai-sdk/openai@2.0.0-canary.10
|
|
177
|
+
- @ai-sdk/provider-utils@3.0.0-canary.9
|
|
45
178
|
|
|
46
|
-
##
|
|
179
|
+
## 2.0.0-canary.10
|
|
47
180
|
|
|
48
181
|
### Patch Changes
|
|
49
182
|
|
|
50
|
-
- Updated dependencies [
|
|
51
|
-
|
|
183
|
+
- Updated dependencies [d63bcbc]
|
|
184
|
+
- Updated dependencies [d2af019]
|
|
185
|
+
- Updated dependencies [870c5c0]
|
|
186
|
+
- Updated dependencies [06bac05]
|
|
187
|
+
- @ai-sdk/openai@2.0.0-canary.9
|
|
52
188
|
|
|
53
|
-
##
|
|
189
|
+
## 2.0.0-canary.9
|
|
54
190
|
|
|
55
191
|
### Patch Changes
|
|
56
192
|
|
|
57
|
-
-
|
|
58
|
-
|
|
193
|
+
- 3b13ccf: feat(providers/azure): add transcribe
|
|
194
|
+
- Updated dependencies [5d142ab]
|
|
195
|
+
- Updated dependencies [b6b43c7]
|
|
196
|
+
- Updated dependencies [8aa9e20]
|
|
197
|
+
- Updated dependencies [3795467]
|
|
198
|
+
- @ai-sdk/provider-utils@3.0.0-canary.8
|
|
199
|
+
- @ai-sdk/provider@2.0.0-canary.7
|
|
200
|
+
- @ai-sdk/openai@2.0.0-canary.8
|
|
59
201
|
|
|
60
|
-
##
|
|
202
|
+
## 2.0.0-canary.8
|
|
61
203
|
|
|
62
204
|
### Patch Changes
|
|
63
205
|
|
|
64
|
-
- Updated dependencies [
|
|
65
|
-
|
|
206
|
+
- Updated dependencies [26735b5]
|
|
207
|
+
- Updated dependencies [443d8ec]
|
|
208
|
+
- Updated dependencies [14c9410]
|
|
209
|
+
- Updated dependencies [d9c98f4]
|
|
210
|
+
- Updated dependencies [c4a2fec]
|
|
211
|
+
- Updated dependencies [0054544]
|
|
212
|
+
- Updated dependencies [9e9c809]
|
|
213
|
+
- Updated dependencies [32831c6]
|
|
214
|
+
- Updated dependencies [d0f9495]
|
|
215
|
+
- Updated dependencies [fd65bc6]
|
|
216
|
+
- Updated dependencies [393138b]
|
|
217
|
+
- Updated dependencies [7182d14]
|
|
218
|
+
- @ai-sdk/provider@2.0.0-canary.6
|
|
219
|
+
- @ai-sdk/openai@2.0.0-canary.7
|
|
220
|
+
- @ai-sdk/provider-utils@3.0.0-canary.7
|
|
66
221
|
|
|
67
|
-
##
|
|
222
|
+
## 2.0.0-canary.7
|
|
68
223
|
|
|
69
224
|
### Patch Changes
|
|
70
225
|
|
|
71
|
-
- Updated dependencies [
|
|
72
|
-
|
|
226
|
+
- Updated dependencies [948b755]
|
|
227
|
+
- Updated dependencies [3b1ea10]
|
|
228
|
+
- Updated dependencies [411e483]
|
|
229
|
+
- Updated dependencies [442be08]
|
|
230
|
+
- Updated dependencies [79457bd]
|
|
231
|
+
- Updated dependencies [ad80501]
|
|
232
|
+
- Updated dependencies [5147e6e]
|
|
233
|
+
- Updated dependencies [c2b92cc]
|
|
234
|
+
- Updated dependencies [1766ede]
|
|
235
|
+
- Updated dependencies [f10304b]
|
|
236
|
+
- @ai-sdk/openai@2.0.0-canary.6
|
|
237
|
+
- @ai-sdk/provider@2.0.0-canary.5
|
|
238
|
+
- @ai-sdk/provider-utils@3.0.0-canary.6
|
|
73
239
|
|
|
74
|
-
##
|
|
240
|
+
## 2.0.0-canary.6
|
|
75
241
|
|
|
76
242
|
### Patch Changes
|
|
77
243
|
|
|
78
|
-
- Updated dependencies [
|
|
79
|
-
- @ai-sdk/
|
|
244
|
+
- Updated dependencies [6f6bb89]
|
|
245
|
+
- @ai-sdk/provider@2.0.0-canary.4
|
|
246
|
+
- @ai-sdk/openai@2.0.0-canary.5
|
|
247
|
+
- @ai-sdk/provider-utils@3.0.0-canary.5
|
|
80
248
|
|
|
81
|
-
##
|
|
249
|
+
## 2.0.0-canary.5
|
|
82
250
|
|
|
83
251
|
### Patch Changes
|
|
84
252
|
|
|
85
|
-
-
|
|
86
|
-
-
|
|
87
|
-
- @ai-sdk/
|
|
88
|
-
- @ai-sdk/
|
|
89
|
-
- @ai-sdk/provider-utils@2.2.7
|
|
253
|
+
- Updated dependencies [d1a1aa1]
|
|
254
|
+
- @ai-sdk/provider@2.0.0-canary.3
|
|
255
|
+
- @ai-sdk/openai@2.0.0-canary.4
|
|
256
|
+
- @ai-sdk/provider-utils@3.0.0-canary.4
|
|
90
257
|
|
|
91
|
-
##
|
|
258
|
+
## 2.0.0-canary.4
|
|
92
259
|
|
|
93
260
|
### Patch Changes
|
|
94
261
|
|
|
95
|
-
- Updated dependencies [
|
|
96
|
-
- Updated dependencies [
|
|
97
|
-
|
|
262
|
+
- Updated dependencies [a166433]
|
|
263
|
+
- Updated dependencies [abf9a79]
|
|
264
|
+
- Updated dependencies [9f95b35]
|
|
265
|
+
- Updated dependencies [0a87932]
|
|
266
|
+
- Updated dependencies [6dc848c]
|
|
267
|
+
- Updated dependencies [0a87932]
|
|
268
|
+
- @ai-sdk/provider-utils@3.0.0-canary.3
|
|
269
|
+
- @ai-sdk/provider@2.0.0-canary.2
|
|
270
|
+
- @ai-sdk/openai@2.0.0-canary.3
|
|
98
271
|
|
|
99
|
-
##
|
|
272
|
+
## 2.0.0-canary.3
|
|
100
273
|
|
|
101
274
|
### Patch Changes
|
|
102
275
|
|
|
103
|
-
- Updated dependencies [
|
|
104
|
-
- Updated dependencies [
|
|
105
|
-
- @ai-sdk/provider@
|
|
106
|
-
- @ai-sdk/openai@
|
|
107
|
-
- @ai-sdk/provider-utils@
|
|
276
|
+
- Updated dependencies [c57e248]
|
|
277
|
+
- Updated dependencies [33f4a6a]
|
|
278
|
+
- @ai-sdk/provider@2.0.0-canary.1
|
|
279
|
+
- @ai-sdk/openai@2.0.0-canary.2
|
|
280
|
+
- @ai-sdk/provider-utils@3.0.0-canary.2
|
|
108
281
|
|
|
109
|
-
##
|
|
282
|
+
## 2.0.0-canary.2
|
|
110
283
|
|
|
111
284
|
### Patch Changes
|
|
112
285
|
|
|
113
|
-
-
|
|
114
|
-
- @ai-sdk/provider-utils@2.2.5
|
|
115
|
-
- @ai-sdk/provider@1.1.1
|
|
116
|
-
- @ai-sdk/openai@1.3.8
|
|
286
|
+
- c467b38: feat (provider/azure): add OpenAI responses API support
|
|
117
287
|
|
|
118
|
-
##
|
|
288
|
+
## 2.0.0-canary.1
|
|
119
289
|
|
|
120
290
|
### Patch Changes
|
|
121
291
|
|
|
122
|
-
-
|
|
292
|
+
- Updated dependencies [060370c]
|
|
293
|
+
- Updated dependencies [0c0c0b3]
|
|
294
|
+
- Updated dependencies [63d791d]
|
|
295
|
+
- @ai-sdk/provider-utils@3.0.0-canary.1
|
|
296
|
+
- @ai-sdk/openai@2.0.0-canary.1
|
|
297
|
+
|
|
298
|
+
## 2.0.0-canary.0
|
|
299
|
+
|
|
300
|
+
### Major Changes
|
|
123
301
|
|
|
124
|
-
|
|
302
|
+
- d5f588f: AI SDK 5
|
|
125
303
|
|
|
126
304
|
### Patch Changes
|
|
127
305
|
|
|
128
|
-
- Updated dependencies [
|
|
129
|
-
- @ai-sdk/provider-utils@
|
|
130
|
-
- @ai-sdk/openai@
|
|
306
|
+
- Updated dependencies [d5f588f]
|
|
307
|
+
- @ai-sdk/provider-utils@3.0.0-canary.0
|
|
308
|
+
- @ai-sdk/openai@2.0.0-canary.0
|
|
309
|
+
- @ai-sdk/provider@2.0.0-canary.0
|
|
131
310
|
|
|
132
311
|
## 1.3.6
|
|
133
312
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,46 +1,45 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ProviderV1, LanguageModelV1, EmbeddingModelV1, ImageModelV1, TranscriptionModelV1 } from '@ai-sdk/provider';
|
|
1
|
+
import { ProviderV2, LanguageModelV2, EmbeddingModelV2, ImageModelV2, TranscriptionModelV1 } from '@ai-sdk/provider';
|
|
3
2
|
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
4
3
|
|
|
5
|
-
interface AzureOpenAIProvider extends
|
|
6
|
-
(deploymentId: string
|
|
4
|
+
interface AzureOpenAIProvider extends ProviderV2 {
|
|
5
|
+
(deploymentId: string): LanguageModelV2;
|
|
7
6
|
/**
|
|
8
7
|
Creates an Azure OpenAI chat model for text generation.
|
|
9
8
|
*/
|
|
10
|
-
languageModel(deploymentId: string
|
|
9
|
+
languageModel(deploymentId: string): LanguageModelV2;
|
|
11
10
|
/**
|
|
12
11
|
Creates an Azure OpenAI chat model for text generation.
|
|
13
12
|
*/
|
|
14
|
-
chat(deploymentId: string
|
|
13
|
+
chat(deploymentId: string): LanguageModelV2;
|
|
15
14
|
/**
|
|
16
15
|
Creates an Azure OpenAI responses API model for text generation.
|
|
17
16
|
*/
|
|
18
|
-
responses(deploymentId: string):
|
|
17
|
+
responses(deploymentId: string): LanguageModelV2;
|
|
19
18
|
/**
|
|
20
19
|
Creates an Azure OpenAI completion model for text generation.
|
|
21
20
|
*/
|
|
22
|
-
completion(deploymentId: string
|
|
21
|
+
completion(deploymentId: string): LanguageModelV2;
|
|
23
22
|
/**
|
|
24
23
|
@deprecated Use `textEmbeddingModel` instead.
|
|
25
24
|
*/
|
|
26
|
-
embedding(deploymentId: string
|
|
25
|
+
embedding(deploymentId: string): EmbeddingModelV2<string>;
|
|
27
26
|
/**
|
|
28
27
|
* Creates an Azure OpenAI DALL-E model for image generation.
|
|
29
28
|
* @deprecated Use `imageModel` instead.
|
|
30
29
|
*/
|
|
31
|
-
image(deploymentId: string
|
|
30
|
+
image(deploymentId: string): ImageModelV2;
|
|
32
31
|
/**
|
|
33
32
|
* Creates an Azure OpenAI DALL-E model for image generation.
|
|
34
33
|
*/
|
|
35
|
-
imageModel(deploymentId: string
|
|
34
|
+
imageModel(deploymentId: string): ImageModelV2;
|
|
36
35
|
/**
|
|
37
36
|
@deprecated Use `textEmbeddingModel` instead.
|
|
38
37
|
*/
|
|
39
|
-
textEmbedding(deploymentId: string
|
|
38
|
+
textEmbedding(deploymentId: string): EmbeddingModelV2<string>;
|
|
40
39
|
/**
|
|
41
40
|
Creates an Azure OpenAI model for text embeddings.
|
|
42
41
|
*/
|
|
43
|
-
textEmbeddingModel(deploymentId: string
|
|
42
|
+
textEmbeddingModel(deploymentId: string): EmbeddingModelV2<string>;
|
|
44
43
|
/**
|
|
45
44
|
* Creates an Azure OpenAI model for audio transcription.
|
|
46
45
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -1,46 +1,45 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ProviderV1, LanguageModelV1, EmbeddingModelV1, ImageModelV1, TranscriptionModelV1 } from '@ai-sdk/provider';
|
|
1
|
+
import { ProviderV2, LanguageModelV2, EmbeddingModelV2, ImageModelV2, TranscriptionModelV1 } from '@ai-sdk/provider';
|
|
3
2
|
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
4
3
|
|
|
5
|
-
interface AzureOpenAIProvider extends
|
|
6
|
-
(deploymentId: string
|
|
4
|
+
interface AzureOpenAIProvider extends ProviderV2 {
|
|
5
|
+
(deploymentId: string): LanguageModelV2;
|
|
7
6
|
/**
|
|
8
7
|
Creates an Azure OpenAI chat model for text generation.
|
|
9
8
|
*/
|
|
10
|
-
languageModel(deploymentId: string
|
|
9
|
+
languageModel(deploymentId: string): LanguageModelV2;
|
|
11
10
|
/**
|
|
12
11
|
Creates an Azure OpenAI chat model for text generation.
|
|
13
12
|
*/
|
|
14
|
-
chat(deploymentId: string
|
|
13
|
+
chat(deploymentId: string): LanguageModelV2;
|
|
15
14
|
/**
|
|
16
15
|
Creates an Azure OpenAI responses API model for text generation.
|
|
17
16
|
*/
|
|
18
|
-
responses(deploymentId: string):
|
|
17
|
+
responses(deploymentId: string): LanguageModelV2;
|
|
19
18
|
/**
|
|
20
19
|
Creates an Azure OpenAI completion model for text generation.
|
|
21
20
|
*/
|
|
22
|
-
completion(deploymentId: string
|
|
21
|
+
completion(deploymentId: string): LanguageModelV2;
|
|
23
22
|
/**
|
|
24
23
|
@deprecated Use `textEmbeddingModel` instead.
|
|
25
24
|
*/
|
|
26
|
-
embedding(deploymentId: string
|
|
25
|
+
embedding(deploymentId: string): EmbeddingModelV2<string>;
|
|
27
26
|
/**
|
|
28
27
|
* Creates an Azure OpenAI DALL-E model for image generation.
|
|
29
28
|
* @deprecated Use `imageModel` instead.
|
|
30
29
|
*/
|
|
31
|
-
image(deploymentId: string
|
|
30
|
+
image(deploymentId: string): ImageModelV2;
|
|
32
31
|
/**
|
|
33
32
|
* Creates an Azure OpenAI DALL-E model for image generation.
|
|
34
33
|
*/
|
|
35
|
-
imageModel(deploymentId: string
|
|
34
|
+
imageModel(deploymentId: string): ImageModelV2;
|
|
36
35
|
/**
|
|
37
36
|
@deprecated Use `textEmbeddingModel` instead.
|
|
38
37
|
*/
|
|
39
|
-
textEmbedding(deploymentId: string
|
|
38
|
+
textEmbedding(deploymentId: string): EmbeddingModelV2<string>;
|
|
40
39
|
/**
|
|
41
40
|
Creates an Azure OpenAI model for text embeddings.
|
|
42
41
|
*/
|
|
43
|
-
textEmbeddingModel(deploymentId: string
|
|
42
|
+
textEmbeddingModel(deploymentId: string): EmbeddingModelV2<string>;
|
|
44
43
|
/**
|
|
45
44
|
* Creates an Azure OpenAI model for audio transcription.
|
|
46
45
|
*/
|
package/dist/index.js
CHANGED
|
@@ -51,51 +51,49 @@ function createAzure(options = {}) {
|
|
|
51
51
|
}
|
|
52
52
|
return options.baseURL ? `${options.baseURL}/${modelId}${path}?api-version=${apiVersion}` : `https://${getResourceName()}.openai.azure.com/openai/deployments/${modelId}${path}?api-version=${apiVersion}`;
|
|
53
53
|
};
|
|
54
|
-
const createChatModel = (deploymentName
|
|
55
|
-
provider: "azure
|
|
54
|
+
const createChatModel = (deploymentName) => new import_internal.OpenAIChatLanguageModel(deploymentName, {
|
|
55
|
+
provider: "azure.chat",
|
|
56
56
|
url,
|
|
57
57
|
headers: getHeaders,
|
|
58
|
-
compatibility: "strict",
|
|
59
58
|
fetch: options.fetch
|
|
60
59
|
});
|
|
61
|
-
const createCompletionModel = (modelId
|
|
62
|
-
provider: "azure
|
|
60
|
+
const createCompletionModel = (modelId) => new import_internal.OpenAICompletionLanguageModel(modelId, {
|
|
61
|
+
provider: "azure.completion",
|
|
63
62
|
url,
|
|
64
|
-
compatibility: "strict",
|
|
65
63
|
headers: getHeaders,
|
|
66
64
|
fetch: options.fetch
|
|
67
65
|
});
|
|
68
|
-
const createEmbeddingModel = (modelId
|
|
69
|
-
provider: "azure
|
|
66
|
+
const createEmbeddingModel = (modelId) => new import_internal.OpenAIEmbeddingModel(modelId, {
|
|
67
|
+
provider: "azure.embeddings",
|
|
70
68
|
headers: getHeaders,
|
|
71
69
|
url,
|
|
72
70
|
fetch: options.fetch
|
|
73
71
|
});
|
|
74
72
|
const createResponsesModel = (modelId) => new import_internal.OpenAIResponsesLanguageModel(modelId, {
|
|
75
|
-
provider: "azure
|
|
73
|
+
provider: "azure.responses",
|
|
76
74
|
url,
|
|
77
75
|
headers: getHeaders,
|
|
78
76
|
fetch: options.fetch
|
|
79
77
|
});
|
|
80
|
-
const createImageModel = (modelId
|
|
81
|
-
provider: "azure
|
|
78
|
+
const createImageModel = (modelId) => new import_internal.OpenAIImageModel(modelId, {
|
|
79
|
+
provider: "azure.image",
|
|
82
80
|
url,
|
|
83
81
|
headers: getHeaders,
|
|
84
82
|
fetch: options.fetch
|
|
85
83
|
});
|
|
86
84
|
const createTranscriptionModel = (modelId) => new import_internal.OpenAITranscriptionModel(modelId, {
|
|
87
|
-
provider: "azure
|
|
85
|
+
provider: "azure.transcription",
|
|
88
86
|
url,
|
|
89
87
|
headers: getHeaders,
|
|
90
88
|
fetch: options.fetch
|
|
91
89
|
});
|
|
92
|
-
const provider = function(deploymentId
|
|
90
|
+
const provider = function(deploymentId) {
|
|
93
91
|
if (new.target) {
|
|
94
92
|
throw new Error(
|
|
95
93
|
"The Azure OpenAI model function cannot be called with the new keyword."
|
|
96
94
|
);
|
|
97
95
|
}
|
|
98
|
-
return createChatModel(deploymentId
|
|
96
|
+
return createChatModel(deploymentId);
|
|
99
97
|
};
|
|
100
98
|
provider.languageModel = createChatModel;
|
|
101
99
|
provider.chat = createChatModel;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/azure-openai-provider.ts"],"sourcesContent":["export { azure, createAzure } from './azure-openai-provider';\nexport type {\n AzureOpenAIProvider,\n AzureOpenAIProviderSettings,\n} from './azure-openai-provider';\n","import {\n OpenAIChatLanguageModel,\n
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/azure-openai-provider.ts"],"sourcesContent":["export { azure, createAzure } from './azure-openai-provider';\nexport type {\n AzureOpenAIProvider,\n AzureOpenAIProviderSettings,\n} from './azure-openai-provider';\n","import {\n OpenAIChatLanguageModel,\n OpenAICompletionLanguageModel,\n OpenAIEmbeddingModel,\n OpenAIImageModel,\n OpenAIResponsesLanguageModel,\n OpenAITranscriptionModel,\n} from '@ai-sdk/openai/internal';\nimport {\n EmbeddingModelV2,\n LanguageModelV2,\n ProviderV2,\n ImageModelV2,\n TranscriptionModelV1,\n} from '@ai-sdk/provider';\nimport { FetchFunction, loadApiKey, loadSetting } from '@ai-sdk/provider-utils';\n\nexport interface AzureOpenAIProvider extends ProviderV2 {\n (deploymentId: string): LanguageModelV2;\n\n /**\nCreates an Azure OpenAI chat model for text generation.\n */\n languageModel(deploymentId: string): LanguageModelV2;\n\n /**\nCreates an Azure OpenAI chat model for text generation.\n */\n chat(deploymentId: string): LanguageModelV2;\n\n /**\nCreates an Azure OpenAI responses API model for text generation.\n */\n responses(deploymentId: string): LanguageModelV2;\n\n /**\nCreates an Azure OpenAI completion model for text generation.\n */\n completion(deploymentId: string): LanguageModelV2;\n\n /**\n@deprecated Use `textEmbeddingModel` instead.\n */\n embedding(deploymentId: string): EmbeddingModelV2<string>;\n\n /**\n * Creates an Azure OpenAI DALL-E model for image generation.\n * @deprecated Use `imageModel` instead.\n */\n image(deploymentId: string): ImageModelV2;\n\n /**\n * Creates an Azure OpenAI DALL-E model for image generation.\n */\n imageModel(deploymentId: string): ImageModelV2;\n\n /**\n@deprecated Use `textEmbeddingModel` instead.\n */\n textEmbedding(deploymentId: string): EmbeddingModelV2<string>;\n\n /**\nCreates an Azure OpenAI model for text embeddings.\n */\n textEmbeddingModel(deploymentId: string): EmbeddingModelV2<string>;\n\n /**\n * Creates an Azure OpenAI model for audio transcription.\n */\n transcription(deploymentId: string): TranscriptionModelV1;\n}\n\nexport interface AzureOpenAIProviderSettings {\n /**\nName of the Azure OpenAI resource. Either this or `baseURL` can be used.\n\nThe resource name is used in the assembled URL: `https://{resourceName}.openai.azure.com/openai/deployments/{modelId}{path}`.\n */\n resourceName?: string;\n\n /**\nUse a different URL prefix for API calls, e.g. to use proxy servers. Either this or `resourceName` can be used.\nWhen a baseURL is provided, the resourceName is ignored.\n\nWith a baseURL, the resolved URL is `{baseURL}/{modelId}{path}`.\n */\n baseURL?: string;\n\n /**\nAPI key for authenticating requests.\n */\n apiKey?: string;\n\n /**\nCustom headers to include in the requests.\n */\n headers?: Record<string, string>;\n\n /**\nCustom fetch implementation. You can use it as a middleware to intercept requests,\nor to provide a custom fetch implementation for e.g. testing.\n */\n fetch?: FetchFunction;\n\n /**\nCustom api version to use. Defaults to `2024-10-01-preview`.\n */\n apiVersion?: string;\n}\n\n/**\nCreate an Azure OpenAI provider instance.\n */\nexport function createAzure(\n options: AzureOpenAIProviderSettings = {},\n): AzureOpenAIProvider {\n const getHeaders = () => ({\n 'api-key': loadApiKey({\n apiKey: options.apiKey,\n environmentVariableName: 'AZURE_API_KEY',\n description: 'Azure OpenAI',\n }),\n ...options.headers,\n });\n\n const getResourceName = () =>\n loadSetting({\n settingValue: options.resourceName,\n settingName: 'resourceName',\n environmentVariableName: 'AZURE_RESOURCE_NAME',\n description: 'Azure OpenAI resource name',\n });\n\n const apiVersion = options.apiVersion ?? '2025-03-01-preview';\n const url = ({ path, modelId }: { path: string; modelId: string }) => {\n if (path === '/responses') {\n return options.baseURL\n ? `${options.baseURL}${path}?api-version=${apiVersion}`\n : `https://${getResourceName()}.openai.azure.com/openai/responses?api-version=${apiVersion}`;\n }\n\n // Default URL format for other endpoints\n return options.baseURL\n ? `${options.baseURL}/${modelId}${path}?api-version=${apiVersion}`\n : `https://${getResourceName()}.openai.azure.com/openai/deployments/${modelId}${path}?api-version=${apiVersion}`;\n };\n\n const createChatModel = (deploymentName: string) =>\n new OpenAIChatLanguageModel(deploymentName, {\n provider: 'azure.chat',\n url,\n headers: getHeaders,\n fetch: options.fetch,\n });\n\n const createCompletionModel = (modelId: string) =>\n new OpenAICompletionLanguageModel(modelId, {\n provider: 'azure.completion',\n url,\n headers: getHeaders,\n fetch: options.fetch,\n });\n\n const createEmbeddingModel = (modelId: string) =>\n new OpenAIEmbeddingModel(modelId, {\n provider: 'azure.embeddings',\n headers: getHeaders,\n url,\n fetch: options.fetch,\n });\n\n const createResponsesModel = (modelId: string) =>\n new OpenAIResponsesLanguageModel(modelId, {\n provider: 'azure.responses',\n url,\n headers: getHeaders,\n fetch: options.fetch,\n });\n\n const createImageModel = (modelId: string) =>\n new OpenAIImageModel(modelId, {\n provider: 'azure.image',\n url,\n headers: getHeaders,\n fetch: options.fetch,\n });\n\n const createTranscriptionModel = (modelId: string) =>\n new OpenAITranscriptionModel(modelId, {\n provider: 'azure.transcription',\n url,\n headers: getHeaders,\n fetch: options.fetch,\n });\n\n const provider = function (deploymentId: string) {\n if (new.target) {\n throw new Error(\n 'The Azure OpenAI model function cannot be called with the new keyword.',\n );\n }\n\n return createChatModel(deploymentId);\n };\n\n provider.languageModel = createChatModel;\n provider.chat = createChatModel;\n provider.completion = createCompletionModel;\n provider.embedding = createEmbeddingModel;\n provider.image = createImageModel;\n provider.imageModel = createImageModel;\n provider.textEmbedding = createEmbeddingModel;\n provider.textEmbeddingModel = createEmbeddingModel;\n provider.responses = createResponsesModel;\n provider.transcription = createTranscriptionModel;\n return provider;\n}\n\n/**\nDefault Azure OpenAI provider instance.\n */\nexport const azure = createAzure();\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,sBAOO;AAQP,4BAAuD;AAkGhD,SAAS,YACd,UAAuC,CAAC,GACnB;AAnHvB;AAoHE,QAAM,aAAa,OAAO;AAAA,IACxB,eAAW,kCAAW;AAAA,MACpB,QAAQ,QAAQ;AAAA,MAChB,yBAAyB;AAAA,MACzB,aAAa;AAAA,IACf,CAAC;AAAA,IACD,GAAG,QAAQ;AAAA,EACb;AAEA,QAAM,kBAAkB,UACtB,mCAAY;AAAA,IACV,cAAc,QAAQ;AAAA,IACtB,aAAa;AAAA,IACb,yBAAyB;AAAA,IACzB,aAAa;AAAA,EACf,CAAC;AAEH,QAAM,cAAa,aAAQ,eAAR,YAAsB;AACzC,QAAM,MAAM,CAAC,EAAE,MAAM,QAAQ,MAAyC;AACpE,QAAI,SAAS,cAAc;AACzB,aAAO,QAAQ,UACX,GAAG,QAAQ,OAAO,GAAG,IAAI,gBAAgB,UAAU,KACnD,WAAW,gBAAgB,CAAC,kDAAkD,UAAU;AAAA,IAC9F;AAGA,WAAO,QAAQ,UACX,GAAG,QAAQ,OAAO,IAAI,OAAO,GAAG,IAAI,gBAAgB,UAAU,KAC9D,WAAW,gBAAgB,CAAC,wCAAwC,OAAO,GAAG,IAAI,gBAAgB,UAAU;AAAA,EAClH;AAEA,QAAM,kBAAkB,CAAC,mBACvB,IAAI,wCAAwB,gBAAgB;AAAA,IAC1C,UAAU;AAAA,IACV;AAAA,IACA,SAAS;AAAA,IACT,OAAO,QAAQ;AAAA,EACjB,CAAC;AAEH,QAAM,wBAAwB,CAAC,YAC7B,IAAI,8CAA8B,SAAS;AAAA,IACzC,UAAU;AAAA,IACV;AAAA,IACA,SAAS;AAAA,IACT,OAAO,QAAQ;AAAA,EACjB,CAAC;AAEH,QAAM,uBAAuB,CAAC,YAC5B,IAAI,qCAAqB,SAAS;AAAA,IAChC,UAAU;AAAA,IACV,SAAS;AAAA,IACT;AAAA,IACA,OAAO,QAAQ;AAAA,EACjB,CAAC;AAEH,QAAM,uBAAuB,CAAC,YAC5B,IAAI,6CAA6B,SAAS;AAAA,IACxC,UAAU;AAAA,IACV;AAAA,IACA,SAAS;AAAA,IACT,OAAO,QAAQ;AAAA,EACjB,CAAC;AAEH,QAAM,mBAAmB,CAAC,YACxB,IAAI,iCAAiB,SAAS;AAAA,IAC5B,UAAU;AAAA,IACV;AAAA,IACA,SAAS;AAAA,IACT,OAAO,QAAQ;AAAA,EACjB,CAAC;AAEH,QAAM,2BAA2B,CAAC,YAChC,IAAI,yCAAyB,SAAS;AAAA,IACpC,UAAU;AAAA,IACV;AAAA,IACA,SAAS;AAAA,IACT,OAAO,QAAQ;AAAA,EACjB,CAAC;AAEH,QAAM,WAAW,SAAU,cAAsB;AAC/C,QAAI,YAAY;AACd,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAEA,WAAO,gBAAgB,YAAY;AAAA,EACrC;AAEA,WAAS,gBAAgB;AACzB,WAAS,OAAO;AAChB,WAAS,aAAa;AACtB,WAAS,YAAY;AACrB,WAAS,QAAQ;AACjB,WAAS,aAAa;AACtB,WAAS,gBAAgB;AACzB,WAAS,qBAAqB;AAC9B,WAAS,YAAY;AACrB,WAAS,gBAAgB;AACzB,SAAO;AACT;AAKO,IAAM,QAAQ,YAAY;","names":[]}
|
package/dist/index.mjs
CHANGED
|
@@ -31,51 +31,49 @@ function createAzure(options = {}) {
|
|
|
31
31
|
}
|
|
32
32
|
return options.baseURL ? `${options.baseURL}/${modelId}${path}?api-version=${apiVersion}` : `https://${getResourceName()}.openai.azure.com/openai/deployments/${modelId}${path}?api-version=${apiVersion}`;
|
|
33
33
|
};
|
|
34
|
-
const createChatModel = (deploymentName
|
|
35
|
-
provider: "azure
|
|
34
|
+
const createChatModel = (deploymentName) => new OpenAIChatLanguageModel(deploymentName, {
|
|
35
|
+
provider: "azure.chat",
|
|
36
36
|
url,
|
|
37
37
|
headers: getHeaders,
|
|
38
|
-
compatibility: "strict",
|
|
39
38
|
fetch: options.fetch
|
|
40
39
|
});
|
|
41
|
-
const createCompletionModel = (modelId
|
|
42
|
-
provider: "azure
|
|
40
|
+
const createCompletionModel = (modelId) => new OpenAICompletionLanguageModel(modelId, {
|
|
41
|
+
provider: "azure.completion",
|
|
43
42
|
url,
|
|
44
|
-
compatibility: "strict",
|
|
45
43
|
headers: getHeaders,
|
|
46
44
|
fetch: options.fetch
|
|
47
45
|
});
|
|
48
|
-
const createEmbeddingModel = (modelId
|
|
49
|
-
provider: "azure
|
|
46
|
+
const createEmbeddingModel = (modelId) => new OpenAIEmbeddingModel(modelId, {
|
|
47
|
+
provider: "azure.embeddings",
|
|
50
48
|
headers: getHeaders,
|
|
51
49
|
url,
|
|
52
50
|
fetch: options.fetch
|
|
53
51
|
});
|
|
54
52
|
const createResponsesModel = (modelId) => new OpenAIResponsesLanguageModel(modelId, {
|
|
55
|
-
provider: "azure
|
|
53
|
+
provider: "azure.responses",
|
|
56
54
|
url,
|
|
57
55
|
headers: getHeaders,
|
|
58
56
|
fetch: options.fetch
|
|
59
57
|
});
|
|
60
|
-
const createImageModel = (modelId
|
|
61
|
-
provider: "azure
|
|
58
|
+
const createImageModel = (modelId) => new OpenAIImageModel(modelId, {
|
|
59
|
+
provider: "azure.image",
|
|
62
60
|
url,
|
|
63
61
|
headers: getHeaders,
|
|
64
62
|
fetch: options.fetch
|
|
65
63
|
});
|
|
66
64
|
const createTranscriptionModel = (modelId) => new OpenAITranscriptionModel(modelId, {
|
|
67
|
-
provider: "azure
|
|
65
|
+
provider: "azure.transcription",
|
|
68
66
|
url,
|
|
69
67
|
headers: getHeaders,
|
|
70
68
|
fetch: options.fetch
|
|
71
69
|
});
|
|
72
|
-
const provider = function(deploymentId
|
|
70
|
+
const provider = function(deploymentId) {
|
|
73
71
|
if (new.target) {
|
|
74
72
|
throw new Error(
|
|
75
73
|
"The Azure OpenAI model function cannot be called with the new keyword."
|
|
76
74
|
);
|
|
77
75
|
}
|
|
78
|
-
return createChatModel(deploymentId
|
|
76
|
+
return createChatModel(deploymentId);
|
|
79
77
|
};
|
|
80
78
|
provider.languageModel = createChatModel;
|
|
81
79
|
provider.chat = createChatModel;
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/azure-openai-provider.ts"],"sourcesContent":["import {\n OpenAIChatLanguageModel,\n
|
|
1
|
+
{"version":3,"sources":["../src/azure-openai-provider.ts"],"sourcesContent":["import {\n OpenAIChatLanguageModel,\n OpenAICompletionLanguageModel,\n OpenAIEmbeddingModel,\n OpenAIImageModel,\n OpenAIResponsesLanguageModel,\n OpenAITranscriptionModel,\n} from '@ai-sdk/openai/internal';\nimport {\n EmbeddingModelV2,\n LanguageModelV2,\n ProviderV2,\n ImageModelV2,\n TranscriptionModelV1,\n} from '@ai-sdk/provider';\nimport { FetchFunction, loadApiKey, loadSetting } from '@ai-sdk/provider-utils';\n\nexport interface AzureOpenAIProvider extends ProviderV2 {\n (deploymentId: string): LanguageModelV2;\n\n /**\nCreates an Azure OpenAI chat model for text generation.\n */\n languageModel(deploymentId: string): LanguageModelV2;\n\n /**\nCreates an Azure OpenAI chat model for text generation.\n */\n chat(deploymentId: string): LanguageModelV2;\n\n /**\nCreates an Azure OpenAI responses API model for text generation.\n */\n responses(deploymentId: string): LanguageModelV2;\n\n /**\nCreates an Azure OpenAI completion model for text generation.\n */\n completion(deploymentId: string): LanguageModelV2;\n\n /**\n@deprecated Use `textEmbeddingModel` instead.\n */\n embedding(deploymentId: string): EmbeddingModelV2<string>;\n\n /**\n * Creates an Azure OpenAI DALL-E model for image generation.\n * @deprecated Use `imageModel` instead.\n */\n image(deploymentId: string): ImageModelV2;\n\n /**\n * Creates an Azure OpenAI DALL-E model for image generation.\n */\n imageModel(deploymentId: string): ImageModelV2;\n\n /**\n@deprecated Use `textEmbeddingModel` instead.\n */\n textEmbedding(deploymentId: string): EmbeddingModelV2<string>;\n\n /**\nCreates an Azure OpenAI model for text embeddings.\n */\n textEmbeddingModel(deploymentId: string): EmbeddingModelV2<string>;\n\n /**\n * Creates an Azure OpenAI model for audio transcription.\n */\n transcription(deploymentId: string): TranscriptionModelV1;\n}\n\nexport interface AzureOpenAIProviderSettings {\n /**\nName of the Azure OpenAI resource. Either this or `baseURL` can be used.\n\nThe resource name is used in the assembled URL: `https://{resourceName}.openai.azure.com/openai/deployments/{modelId}{path}`.\n */\n resourceName?: string;\n\n /**\nUse a different URL prefix for API calls, e.g. to use proxy servers. Either this or `resourceName` can be used.\nWhen a baseURL is provided, the resourceName is ignored.\n\nWith a baseURL, the resolved URL is `{baseURL}/{modelId}{path}`.\n */\n baseURL?: string;\n\n /**\nAPI key for authenticating requests.\n */\n apiKey?: string;\n\n /**\nCustom headers to include in the requests.\n */\n headers?: Record<string, string>;\n\n /**\nCustom fetch implementation. You can use it as a middleware to intercept requests,\nor to provide a custom fetch implementation for e.g. testing.\n */\n fetch?: FetchFunction;\n\n /**\nCustom api version to use. Defaults to `2024-10-01-preview`.\n */\n apiVersion?: string;\n}\n\n/**\nCreate an Azure OpenAI provider instance.\n */\nexport function createAzure(\n options: AzureOpenAIProviderSettings = {},\n): AzureOpenAIProvider {\n const getHeaders = () => ({\n 'api-key': loadApiKey({\n apiKey: options.apiKey,\n environmentVariableName: 'AZURE_API_KEY',\n description: 'Azure OpenAI',\n }),\n ...options.headers,\n });\n\n const getResourceName = () =>\n loadSetting({\n settingValue: options.resourceName,\n settingName: 'resourceName',\n environmentVariableName: 'AZURE_RESOURCE_NAME',\n description: 'Azure OpenAI resource name',\n });\n\n const apiVersion = options.apiVersion ?? '2025-03-01-preview';\n const url = ({ path, modelId }: { path: string; modelId: string }) => {\n if (path === '/responses') {\n return options.baseURL\n ? `${options.baseURL}${path}?api-version=${apiVersion}`\n : `https://${getResourceName()}.openai.azure.com/openai/responses?api-version=${apiVersion}`;\n }\n\n // Default URL format for other endpoints\n return options.baseURL\n ? `${options.baseURL}/${modelId}${path}?api-version=${apiVersion}`\n : `https://${getResourceName()}.openai.azure.com/openai/deployments/${modelId}${path}?api-version=${apiVersion}`;\n };\n\n const createChatModel = (deploymentName: string) =>\n new OpenAIChatLanguageModel(deploymentName, {\n provider: 'azure.chat',\n url,\n headers: getHeaders,\n fetch: options.fetch,\n });\n\n const createCompletionModel = (modelId: string) =>\n new OpenAICompletionLanguageModel(modelId, {\n provider: 'azure.completion',\n url,\n headers: getHeaders,\n fetch: options.fetch,\n });\n\n const createEmbeddingModel = (modelId: string) =>\n new OpenAIEmbeddingModel(modelId, {\n provider: 'azure.embeddings',\n headers: getHeaders,\n url,\n fetch: options.fetch,\n });\n\n const createResponsesModel = (modelId: string) =>\n new OpenAIResponsesLanguageModel(modelId, {\n provider: 'azure.responses',\n url,\n headers: getHeaders,\n fetch: options.fetch,\n });\n\n const createImageModel = (modelId: string) =>\n new OpenAIImageModel(modelId, {\n provider: 'azure.image',\n url,\n headers: getHeaders,\n fetch: options.fetch,\n });\n\n const createTranscriptionModel = (modelId: string) =>\n new OpenAITranscriptionModel(modelId, {\n provider: 'azure.transcription',\n url,\n headers: getHeaders,\n fetch: options.fetch,\n });\n\n const provider = function (deploymentId: string) {\n if (new.target) {\n throw new Error(\n 'The Azure OpenAI model function cannot be called with the new keyword.',\n );\n }\n\n return createChatModel(deploymentId);\n };\n\n provider.languageModel = createChatModel;\n provider.chat = createChatModel;\n provider.completion = createCompletionModel;\n provider.embedding = createEmbeddingModel;\n provider.image = createImageModel;\n provider.imageModel = createImageModel;\n provider.textEmbedding = createEmbeddingModel;\n provider.textEmbeddingModel = createEmbeddingModel;\n provider.responses = createResponsesModel;\n provider.transcription = createTranscriptionModel;\n return provider;\n}\n\n/**\nDefault Azure OpenAI provider instance.\n */\nexport const azure = createAzure();\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAQP,SAAwB,YAAY,mBAAmB;AAkGhD,SAAS,YACd,UAAuC,CAAC,GACnB;AAnHvB;AAoHE,QAAM,aAAa,OAAO;AAAA,IACxB,WAAW,WAAW;AAAA,MACpB,QAAQ,QAAQ;AAAA,MAChB,yBAAyB;AAAA,MACzB,aAAa;AAAA,IACf,CAAC;AAAA,IACD,GAAG,QAAQ;AAAA,EACb;AAEA,QAAM,kBAAkB,MACtB,YAAY;AAAA,IACV,cAAc,QAAQ;AAAA,IACtB,aAAa;AAAA,IACb,yBAAyB;AAAA,IACzB,aAAa;AAAA,EACf,CAAC;AAEH,QAAM,cAAa,aAAQ,eAAR,YAAsB;AACzC,QAAM,MAAM,CAAC,EAAE,MAAM,QAAQ,MAAyC;AACpE,QAAI,SAAS,cAAc;AACzB,aAAO,QAAQ,UACX,GAAG,QAAQ,OAAO,GAAG,IAAI,gBAAgB,UAAU,KACnD,WAAW,gBAAgB,CAAC,kDAAkD,UAAU;AAAA,IAC9F;AAGA,WAAO,QAAQ,UACX,GAAG,QAAQ,OAAO,IAAI,OAAO,GAAG,IAAI,gBAAgB,UAAU,KAC9D,WAAW,gBAAgB,CAAC,wCAAwC,OAAO,GAAG,IAAI,gBAAgB,UAAU;AAAA,EAClH;AAEA,QAAM,kBAAkB,CAAC,mBACvB,IAAI,wBAAwB,gBAAgB;AAAA,IAC1C,UAAU;AAAA,IACV;AAAA,IACA,SAAS;AAAA,IACT,OAAO,QAAQ;AAAA,EACjB,CAAC;AAEH,QAAM,wBAAwB,CAAC,YAC7B,IAAI,8BAA8B,SAAS;AAAA,IACzC,UAAU;AAAA,IACV;AAAA,IACA,SAAS;AAAA,IACT,OAAO,QAAQ;AAAA,EACjB,CAAC;AAEH,QAAM,uBAAuB,CAAC,YAC5B,IAAI,qBAAqB,SAAS;AAAA,IAChC,UAAU;AAAA,IACV,SAAS;AAAA,IACT;AAAA,IACA,OAAO,QAAQ;AAAA,EACjB,CAAC;AAEH,QAAM,uBAAuB,CAAC,YAC5B,IAAI,6BAA6B,SAAS;AAAA,IACxC,UAAU;AAAA,IACV;AAAA,IACA,SAAS;AAAA,IACT,OAAO,QAAQ;AAAA,EACjB,CAAC;AAEH,QAAM,mBAAmB,CAAC,YACxB,IAAI,iBAAiB,SAAS;AAAA,IAC5B,UAAU;AAAA,IACV;AAAA,IACA,SAAS;AAAA,IACT,OAAO,QAAQ;AAAA,EACjB,CAAC;AAEH,QAAM,2BAA2B,CAAC,YAChC,IAAI,yBAAyB,SAAS;AAAA,IACpC,UAAU;AAAA,IACV;AAAA,IACA,SAAS;AAAA,IACT,OAAO,QAAQ;AAAA,EACjB,CAAC;AAEH,QAAM,WAAW,SAAU,cAAsB;AAC/C,QAAI,YAAY;AACd,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAEA,WAAO,gBAAgB,YAAY;AAAA,EACrC;AAEA,WAAS,gBAAgB;AACzB,WAAS,OAAO;AAChB,WAAS,aAAa;AACtB,WAAS,YAAY;AACrB,WAAS,QAAQ;AACjB,WAAS,aAAa;AACtB,WAAS,gBAAgB;AACzB,WAAS,qBAAqB;AAC9B,WAAS,YAAY;AACrB,WAAS,gBAAgB;AACzB,SAAO;AACT;AAKO,IAAM,QAAQ,YAAY;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/azure",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-alpha.2",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -19,19 +19,19 @@
|
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@ai-sdk/openai": "
|
|
23
|
-
"@ai-sdk/provider": "
|
|
24
|
-
"@ai-sdk/provider-utils": "
|
|
22
|
+
"@ai-sdk/openai": "2.0.0-alpha.2",
|
|
23
|
+
"@ai-sdk/provider": "2.0.0-alpha.2",
|
|
24
|
+
"@ai-sdk/provider-utils": "3.0.0-alpha.2"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/node": "20.17.24",
|
|
28
28
|
"tsup": "^8",
|
|
29
|
-
"typescript": "5.
|
|
30
|
-
"zod": "3.
|
|
29
|
+
"typescript": "5.8.3",
|
|
30
|
+
"zod": "3.24.4",
|
|
31
31
|
"@vercel/ai-tsconfig": "0.0.0"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"zod": "^3.
|
|
34
|
+
"zod": "^3.24.0"
|
|
35
35
|
},
|
|
36
36
|
"engines": {
|
|
37
37
|
"node": ">=18"
|
|
@@ -51,15 +51,16 @@
|
|
|
51
51
|
"ai"
|
|
52
52
|
],
|
|
53
53
|
"scripts": {
|
|
54
|
-
"build": "tsup",
|
|
55
|
-
"build:watch": "tsup --watch",
|
|
56
|
-
"clean": "rm -rf dist",
|
|
54
|
+
"build": "pnpm clean && tsup --tsconfig tsconfig.build.json",
|
|
55
|
+
"build:watch": "pnpm clean && tsup --watch",
|
|
56
|
+
"clean": "rm -rf dist *.tsbuildinfo",
|
|
57
57
|
"lint": "eslint \"./**/*.ts*\"",
|
|
58
|
-
"type-check": "tsc --
|
|
58
|
+
"type-check": "tsc --build",
|
|
59
59
|
"prettier-check": "prettier --check \"./**/*.ts*\"",
|
|
60
60
|
"test": "pnpm test:node && pnpm test:edge",
|
|
61
|
+
"test:update": "pnpm test:node -u",
|
|
62
|
+
"test:watch": "vitest --config vitest.node.config.js",
|
|
61
63
|
"test:edge": "vitest --config vitest.edge.config.js --run",
|
|
62
|
-
"test:node": "vitest --config vitest.node.config.js --run"
|
|
63
|
-
"test:node:watch": "vitest --config vitest.node.config.js"
|
|
64
|
+
"test:node": "vitest --config vitest.node.config.js --run"
|
|
64
65
|
}
|
|
65
66
|
}
|