@ai-sdk/baseten 1.0.0-beta.8 → 1.0.0

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,586 @@
1
1
  # @ai-sdk/baseten
2
2
 
3
+ ## 1.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - dee8b05: ai SDK 6 beta
8
+ - 6cc9cd0: Added Baseten as a Provider for AI SDK
9
+
10
+ ### Patch Changes
11
+
12
+ - 0c3b58b: fix(provider): add specificationVersion to ProviderV3
13
+ - ab9af9c: add moonshotai/Kimi-K2-Thinking model ID for Baseten provider
14
+ - 8d9e8ad: chore(provider): remove generics from EmbeddingModelV3
15
+
16
+ Before
17
+
18
+ ```ts
19
+ model.textEmbeddingModel('my-model-id');
20
+ ```
21
+
22
+ After
23
+
24
+ ```ts
25
+ model.embeddingModel('my-model-id');
26
+ ```
27
+
28
+ - 95f65c2: chore: use import \* from zod/v4
29
+ - 0c4822d: feat: `EmbeddingModelV3`
30
+ - ed329cb: feat: `Provider-V3`
31
+ - 1cad0ab: feat: add provider version to user-agent header
32
+ - 916bc46: bumped performance client to 0.0.10
33
+ - 8dac895: feat: `LanguageModelV3`
34
+ - 366f50b: chore(provider): add deprecated textEmbeddingModel and textEmbedding aliases
35
+ - 4616b86: chore: update zod peer depenedency version
36
+ - Updated dependencies [0c3b58b]
37
+ - Updated dependencies [0adc679]
38
+ - Updated dependencies [50b70d6]
39
+ - Updated dependencies [d1bdadb]
40
+ - Updated dependencies [dee8b05]
41
+ - Updated dependencies [046aa3b]
42
+ - Updated dependencies [8d9e8ad]
43
+ - Updated dependencies [78928cb]
44
+ - Updated dependencies [dce03c4]
45
+ - Updated dependencies [2625a04]
46
+ - Updated dependencies [37c58a0]
47
+ - Updated dependencies [3b1d015]
48
+ - Updated dependencies [2b0caef]
49
+ - Updated dependencies [95f65c2]
50
+ - Updated dependencies [016b111]
51
+ - Updated dependencies [58920e0]
52
+ - Updated dependencies [954c356]
53
+ - Updated dependencies [544d4e8]
54
+ - Updated dependencies [b689220]
55
+ - Updated dependencies [0c4822d]
56
+ - Updated dependencies [521c537]
57
+ - Updated dependencies [4c44a5b]
58
+ - Updated dependencies [e8109d3]
59
+ - Updated dependencies [03849b0]
60
+ - Updated dependencies [ed329cb]
61
+ - Updated dependencies [e06565c]
62
+ - Updated dependencies [32d8dbb]
63
+ - Updated dependencies [53f3368]
64
+ - Updated dependencies [d116b4b]
65
+ - Updated dependencies [3bd2689]
66
+ - Updated dependencies [293a6b7]
67
+ - Updated dependencies [703459a]
68
+ - Updated dependencies [bb36798]
69
+ - Updated dependencies [83e5744]
70
+ - Updated dependencies [7e32fea]
71
+ - Updated dependencies [3ed5519]
72
+ - Updated dependencies [8dac895]
73
+ - Updated dependencies [a755db5]
74
+ - Updated dependencies [cbb1d35]
75
+ - Updated dependencies [475189e]
76
+ - Updated dependencies [457318b]
77
+ - Updated dependencies [b681d7d]
78
+ - Updated dependencies [db913bd]
79
+ - Updated dependencies [9061dc0]
80
+ - Updated dependencies [32223c8]
81
+ - Updated dependencies [c1efac4]
82
+ - Updated dependencies [366f50b]
83
+ - Updated dependencies [4616b86]
84
+ - Updated dependencies [81d4308]
85
+ - Updated dependencies [9549c9e]
86
+ - Updated dependencies [af3780b]
87
+ - Updated dependencies [4f16c37]
88
+ - Updated dependencies [81e29ab]
89
+ - Updated dependencies [522f6b8]
90
+ - Updated dependencies [6306603]
91
+ - Updated dependencies [fca786b]
92
+ - Updated dependencies [763d04a]
93
+ - Updated dependencies [10d819b]
94
+ - Updated dependencies [3794514]
95
+ - Updated dependencies [cbf52cd]
96
+ - Updated dependencies [e9e157f]
97
+ - Updated dependencies [10c1322]
98
+ - Updated dependencies [960ec8f]
99
+ - Updated dependencies [1bd7d32]
100
+ - Updated dependencies [f0b2157]
101
+ - Updated dependencies [95f65c2]
102
+ - @ai-sdk/openai-compatible@2.0.0
103
+ - @ai-sdk/provider@3.0.0
104
+ - @ai-sdk/provider-utils@4.0.0
105
+
106
+ ## 1.0.0-beta.62
107
+
108
+ ### Patch Changes
109
+
110
+ - Updated dependencies [475189e]
111
+ - @ai-sdk/provider@3.0.0-beta.32
112
+ - @ai-sdk/openai-compatible@2.0.0-beta.60
113
+ - @ai-sdk/provider-utils@4.0.0-beta.59
114
+
115
+ ## 1.0.0-beta.61
116
+
117
+ ### Patch Changes
118
+
119
+ - Updated dependencies [2625a04]
120
+ - @ai-sdk/openai-compatible@2.0.0-beta.59
121
+ - @ai-sdk/provider@3.0.0-beta.31
122
+ - @ai-sdk/provider-utils@4.0.0-beta.58
123
+
124
+ ## 1.0.0-beta.60
125
+
126
+ ### Patch Changes
127
+
128
+ - Updated dependencies [cbf52cd]
129
+ - @ai-sdk/openai-compatible@2.0.0-beta.58
130
+ - @ai-sdk/provider@3.0.0-beta.30
131
+ - @ai-sdk/provider-utils@4.0.0-beta.57
132
+
133
+ ## 1.0.0-beta.59
134
+
135
+ ### Patch Changes
136
+
137
+ - Updated dependencies [9549c9e]
138
+ - @ai-sdk/provider@3.0.0-beta.29
139
+ - @ai-sdk/openai-compatible@2.0.0-beta.57
140
+ - @ai-sdk/provider-utils@4.0.0-beta.56
141
+
142
+ ## 1.0.0-beta.58
143
+
144
+ ### Patch Changes
145
+
146
+ - Updated dependencies [50b70d6]
147
+ - @ai-sdk/provider-utils@4.0.0-beta.55
148
+ - @ai-sdk/openai-compatible@2.0.0-beta.56
149
+
150
+ ## 1.0.0-beta.57
151
+
152
+ ### Patch Changes
153
+
154
+ - Updated dependencies [9061dc0]
155
+ - @ai-sdk/openai-compatible@2.0.0-beta.55
156
+ - @ai-sdk/provider-utils@4.0.0-beta.54
157
+ - @ai-sdk/provider@3.0.0-beta.28
158
+
159
+ ## 1.0.0-beta.56
160
+
161
+ ### Patch Changes
162
+
163
+ - 366f50b: chore(provider): add deprecated textEmbeddingModel and textEmbedding aliases
164
+ - Updated dependencies [366f50b]
165
+ - @ai-sdk/openai-compatible@2.0.0-beta.54
166
+ - @ai-sdk/provider@3.0.0-beta.27
167
+ - @ai-sdk/provider-utils@4.0.0-beta.53
168
+
169
+ ## 1.0.0-beta.55
170
+
171
+ ### Patch Changes
172
+
173
+ - Updated dependencies [763d04a]
174
+ - @ai-sdk/provider-utils@4.0.0-beta.52
175
+ - @ai-sdk/openai-compatible@2.0.0-beta.53
176
+
177
+ ## 1.0.0-beta.54
178
+
179
+ ### Patch Changes
180
+
181
+ - Updated dependencies [c1efac4]
182
+ - @ai-sdk/provider-utils@4.0.0-beta.51
183
+ - @ai-sdk/openai-compatible@2.0.0-beta.52
184
+
185
+ ## 1.0.0-beta.53
186
+
187
+ ### Patch Changes
188
+
189
+ - Updated dependencies [32223c8]
190
+ - @ai-sdk/provider-utils@4.0.0-beta.50
191
+ - @ai-sdk/openai-compatible@2.0.0-beta.51
192
+
193
+ ## 1.0.0-beta.52
194
+
195
+ ### Patch Changes
196
+
197
+ - Updated dependencies [83e5744]
198
+ - @ai-sdk/provider-utils@4.0.0-beta.49
199
+ - @ai-sdk/openai-compatible@2.0.0-beta.50
200
+
201
+ ## 1.0.0-beta.51
202
+
203
+ ### Patch Changes
204
+
205
+ - Updated dependencies [960ec8f]
206
+ - @ai-sdk/provider-utils@4.0.0-beta.48
207
+ - @ai-sdk/openai-compatible@2.0.0-beta.49
208
+
209
+ ## 1.0.0-beta.50
210
+
211
+ ### Patch Changes
212
+
213
+ - Updated dependencies [e9e157f]
214
+ - @ai-sdk/provider-utils@4.0.0-beta.47
215
+ - @ai-sdk/openai-compatible@2.0.0-beta.48
216
+
217
+ ## 1.0.0-beta.49
218
+
219
+ ### Patch Changes
220
+
221
+ - Updated dependencies [81e29ab]
222
+ - @ai-sdk/provider-utils@4.0.0-beta.46
223
+ - @ai-sdk/openai-compatible@2.0.0-beta.47
224
+
225
+ ## 1.0.0-beta.48
226
+
227
+ ### Patch Changes
228
+
229
+ - Updated dependencies [3bd2689]
230
+ - @ai-sdk/openai-compatible@2.0.0-beta.46
231
+ - @ai-sdk/provider@3.0.0-beta.26
232
+ - @ai-sdk/provider-utils@4.0.0-beta.45
233
+
234
+ ## 1.0.0-beta.47
235
+
236
+ ### Patch Changes
237
+
238
+ - Updated dependencies [53f3368]
239
+ - @ai-sdk/provider@3.0.0-beta.25
240
+ - @ai-sdk/openai-compatible@2.0.0-beta.45
241
+ - @ai-sdk/provider-utils@4.0.0-beta.44
242
+
243
+ ## 1.0.0-beta.46
244
+
245
+ ### Patch Changes
246
+
247
+ - Updated dependencies [dce03c4]
248
+ - @ai-sdk/provider-utils@4.0.0-beta.43
249
+ - @ai-sdk/provider@3.0.0-beta.24
250
+ - @ai-sdk/openai-compatible@2.0.0-beta.44
251
+
252
+ ## 1.0.0-beta.45
253
+
254
+ ### Patch Changes
255
+
256
+ - Updated dependencies [3ed5519]
257
+ - @ai-sdk/provider-utils@4.0.0-beta.42
258
+ - @ai-sdk/openai-compatible@2.0.0-beta.43
259
+
260
+ ## 1.0.0-beta.44
261
+
262
+ ### Patch Changes
263
+
264
+ - Updated dependencies [1bd7d32]
265
+ - @ai-sdk/openai-compatible@2.0.0-beta.42
266
+ - @ai-sdk/provider-utils@4.0.0-beta.41
267
+ - @ai-sdk/provider@3.0.0-beta.23
268
+
269
+ ## 1.0.0-beta.43
270
+
271
+ ### Patch Changes
272
+
273
+ - Updated dependencies [544d4e8]
274
+ - @ai-sdk/openai-compatible@2.0.0-beta.41
275
+ - @ai-sdk/provider-utils@4.0.0-beta.40
276
+ - @ai-sdk/provider@3.0.0-beta.22
277
+
278
+ ## 1.0.0-beta.42
279
+
280
+ ### Patch Changes
281
+
282
+ - Updated dependencies [954c356]
283
+ - @ai-sdk/provider-utils@4.0.0-beta.39
284
+ - @ai-sdk/provider@3.0.0-beta.21
285
+ - @ai-sdk/openai-compatible@2.0.0-beta.40
286
+
287
+ ## 1.0.0-beta.41
288
+
289
+ ### Patch Changes
290
+
291
+ - Updated dependencies [03849b0]
292
+ - @ai-sdk/provider-utils@4.0.0-beta.38
293
+ - @ai-sdk/openai-compatible@2.0.0-beta.39
294
+
295
+ ## 1.0.0-beta.40
296
+
297
+ ### Patch Changes
298
+
299
+ - Updated dependencies [457318b]
300
+ - @ai-sdk/openai-compatible@2.0.0-beta.38
301
+ - @ai-sdk/provider@3.0.0-beta.20
302
+ - @ai-sdk/provider-utils@4.0.0-beta.37
303
+
304
+ ## 1.0.0-beta.39
305
+
306
+ ### Patch Changes
307
+
308
+ - 8d9e8ad: chore(provider): remove generics from EmbeddingModelV3
309
+
310
+ Before
311
+
312
+ ```ts
313
+ model.textEmbeddingModel('my-model-id');
314
+ ```
315
+
316
+ After
317
+
318
+ ```ts
319
+ model.embeddingModel('my-model-id');
320
+ ```
321
+
322
+ - Updated dependencies [8d9e8ad]
323
+ - @ai-sdk/openai-compatible@2.0.0-beta.37
324
+ - @ai-sdk/provider@3.0.0-beta.19
325
+ - @ai-sdk/provider-utils@4.0.0-beta.36
326
+
327
+ ## 1.0.0-beta.38
328
+
329
+ ### Patch Changes
330
+
331
+ - Updated dependencies [10d819b]
332
+ - @ai-sdk/provider@3.0.0-beta.18
333
+ - @ai-sdk/openai-compatible@2.0.0-beta.36
334
+ - @ai-sdk/provider-utils@4.0.0-beta.35
335
+
336
+ ## 1.0.0-beta.37
337
+
338
+ ### Patch Changes
339
+
340
+ - Updated dependencies [db913bd]
341
+ - @ai-sdk/provider@3.0.0-beta.17
342
+ - @ai-sdk/openai-compatible@2.0.0-beta.35
343
+ - @ai-sdk/provider-utils@4.0.0-beta.34
344
+
345
+ ## 1.0.0-beta.36
346
+
347
+ ### Patch Changes
348
+
349
+ - ab9af9c: add moonshotai/Kimi-K2-Thinking model ID for Baseten provider
350
+
351
+ ## 1.0.0-beta.35
352
+
353
+ ### Patch Changes
354
+
355
+ - Updated dependencies [b681d7d]
356
+ - @ai-sdk/provider@3.0.0-beta.16
357
+ - @ai-sdk/openai-compatible@2.0.0-beta.34
358
+ - @ai-sdk/provider-utils@4.0.0-beta.33
359
+
360
+ ## 1.0.0-beta.34
361
+
362
+ ### Patch Changes
363
+
364
+ - Updated dependencies [32d8dbb]
365
+ - @ai-sdk/provider-utils@4.0.0-beta.32
366
+ - @ai-sdk/openai-compatible@2.0.0-beta.33
367
+
368
+ ## 1.0.0-beta.33
369
+
370
+ ### Patch Changes
371
+
372
+ - Updated dependencies [bb36798]
373
+ - @ai-sdk/provider@3.0.0-beta.15
374
+ - @ai-sdk/openai-compatible@2.0.0-beta.32
375
+ - @ai-sdk/provider-utils@4.0.0-beta.31
376
+
377
+ ## 1.0.0-beta.32
378
+
379
+ ### Patch Changes
380
+
381
+ - Updated dependencies [4f16c37]
382
+ - @ai-sdk/provider-utils@4.0.0-beta.30
383
+ - @ai-sdk/openai-compatible@2.0.0-beta.31
384
+
385
+ ## 1.0.0-beta.31
386
+
387
+ ### Patch Changes
388
+
389
+ - Updated dependencies [af3780b]
390
+ - @ai-sdk/provider@3.0.0-beta.14
391
+ - @ai-sdk/openai-compatible@2.0.0-beta.30
392
+ - @ai-sdk/provider-utils@4.0.0-beta.29
393
+
394
+ ## 1.0.0-beta.30
395
+
396
+ ### Patch Changes
397
+
398
+ - Updated dependencies [016b111]
399
+ - @ai-sdk/provider-utils@4.0.0-beta.28
400
+ - @ai-sdk/openai-compatible@2.0.0-beta.29
401
+
402
+ ## 1.0.0-beta.29
403
+
404
+ ### Patch Changes
405
+
406
+ - Updated dependencies [37c58a0]
407
+ - @ai-sdk/provider@3.0.0-beta.13
408
+ - @ai-sdk/openai-compatible@2.0.0-beta.28
409
+ - @ai-sdk/provider-utils@4.0.0-beta.27
410
+
411
+ ## 1.0.0-beta.28
412
+
413
+ ### Patch Changes
414
+
415
+ - Updated dependencies [d1bdadb]
416
+ - @ai-sdk/provider@3.0.0-beta.12
417
+ - @ai-sdk/openai-compatible@2.0.0-beta.27
418
+ - @ai-sdk/provider-utils@4.0.0-beta.26
419
+
420
+ ## 1.0.0-beta.27
421
+
422
+ ### Patch Changes
423
+
424
+ - Updated dependencies [4c44a5b]
425
+ - @ai-sdk/provider@3.0.0-beta.11
426
+ - @ai-sdk/openai-compatible@2.0.0-beta.26
427
+ - @ai-sdk/provider-utils@4.0.0-beta.25
428
+
429
+ ## 1.0.0-beta.26
430
+
431
+ ### Patch Changes
432
+
433
+ - 0c3b58b: fix(provider): add specificationVersion to ProviderV3
434
+ - Updated dependencies [0c3b58b]
435
+ - @ai-sdk/openai-compatible@2.0.0-beta.25
436
+ - @ai-sdk/provider@3.0.0-beta.10
437
+ - @ai-sdk/provider-utils@4.0.0-beta.24
438
+
439
+ ## 1.0.0-beta.25
440
+
441
+ ### Patch Changes
442
+
443
+ - Updated dependencies [a755db5]
444
+ - @ai-sdk/provider@3.0.0-beta.9
445
+ - @ai-sdk/openai-compatible@2.0.0-beta.24
446
+ - @ai-sdk/provider-utils@4.0.0-beta.23
447
+
448
+ ## 1.0.0-beta.24
449
+
450
+ ### Patch Changes
451
+
452
+ - Updated dependencies [58920e0]
453
+ - @ai-sdk/provider-utils@4.0.0-beta.22
454
+ - @ai-sdk/openai-compatible@2.0.0-beta.23
455
+
456
+ ## 1.0.0-beta.23
457
+
458
+ ### Patch Changes
459
+
460
+ - Updated dependencies [293a6b7]
461
+ - @ai-sdk/provider-utils@4.0.0-beta.21
462
+ - @ai-sdk/openai-compatible@2.0.0-beta.22
463
+
464
+ ## 1.0.0-beta.22
465
+
466
+ ### Patch Changes
467
+
468
+ - Updated dependencies [fca786b]
469
+ - @ai-sdk/provider-utils@4.0.0-beta.20
470
+ - @ai-sdk/openai-compatible@2.0.0-beta.21
471
+
472
+ ## 1.0.0-beta.21
473
+
474
+ ### Patch Changes
475
+
476
+ - Updated dependencies [3794514]
477
+ - @ai-sdk/provider-utils@4.0.0-beta.19
478
+ - @ai-sdk/provider@3.0.0-beta.8
479
+ - @ai-sdk/openai-compatible@2.0.0-beta.20
480
+
481
+ ## 1.0.0-beta.20
482
+
483
+ ### Patch Changes
484
+
485
+ - Updated dependencies [81d4308]
486
+ - @ai-sdk/provider@3.0.0-beta.7
487
+ - @ai-sdk/openai-compatible@2.0.0-beta.19
488
+ - @ai-sdk/provider-utils@4.0.0-beta.18
489
+
490
+ ## 1.0.0-beta.19
491
+
492
+ ### Patch Changes
493
+
494
+ - Updated dependencies [703459a]
495
+ - @ai-sdk/provider-utils@4.0.0-beta.17
496
+ - @ai-sdk/openai-compatible@2.0.0-beta.18
497
+
498
+ ## 1.0.0-beta.18
499
+
500
+ ### Patch Changes
501
+
502
+ - Updated dependencies [b689220]
503
+ - @ai-sdk/openai-compatible@2.0.0-beta.17
504
+
505
+ ## 1.0.0-beta.17
506
+
507
+ ### Patch Changes
508
+
509
+ - Updated dependencies [6306603]
510
+ - @ai-sdk/provider-utils@4.0.0-beta.16
511
+ - @ai-sdk/openai-compatible@2.0.0-beta.16
512
+
513
+ ## 1.0.0-beta.16
514
+
515
+ ### Patch Changes
516
+
517
+ - Updated dependencies [f0b2157]
518
+ - @ai-sdk/provider-utils@4.0.0-beta.15
519
+ - @ai-sdk/openai-compatible@2.0.0-beta.15
520
+
521
+ ## 1.0.0-beta.15
522
+
523
+ ### Patch Changes
524
+
525
+ - Updated dependencies [3b1d015]
526
+ - @ai-sdk/provider-utils@4.0.0-beta.14
527
+ - @ai-sdk/openai-compatible@2.0.0-beta.14
528
+
529
+ ## 1.0.0-beta.14
530
+
531
+ ### Patch Changes
532
+
533
+ - Updated dependencies [d116b4b]
534
+ - @ai-sdk/provider-utils@4.0.0-beta.13
535
+ - @ai-sdk/openai-compatible@2.0.0-beta.13
536
+
537
+ ## 1.0.0-beta.13
538
+
539
+ ### Patch Changes
540
+
541
+ - Updated dependencies [7e32fea]
542
+ - @ai-sdk/provider-utils@4.0.0-beta.12
543
+ - @ai-sdk/openai-compatible@2.0.0-beta.12
544
+
545
+ ## 1.0.0-beta.12
546
+
547
+ ### Patch Changes
548
+
549
+ - 95f65c2: chore: use import \* from zod/v4
550
+ - Updated dependencies [95f65c2]
551
+ - Updated dependencies [95f65c2]
552
+ - @ai-sdk/openai-compatible@2.0.0-beta.11
553
+ - @ai-sdk/provider-utils@4.0.0-beta.11
554
+
555
+ ## 1.0.0-beta.11
556
+
557
+ ### Major Changes
558
+
559
+ - dee8b05: ai SDK 6 beta
560
+
561
+ ### Patch Changes
562
+
563
+ - Updated dependencies [dee8b05]
564
+ - @ai-sdk/openai-compatible@2.0.0-beta.10
565
+ - @ai-sdk/provider@3.0.0-beta.6
566
+ - @ai-sdk/provider-utils@4.0.0-beta.10
567
+
568
+ ## 1.0.0-beta.10
569
+
570
+ ### Patch Changes
571
+
572
+ - Updated dependencies [521c537]
573
+ - @ai-sdk/provider-utils@3.1.0-beta.9
574
+ - @ai-sdk/openai-compatible@1.1.0-beta.9
575
+
576
+ ## 1.0.0-beta.9
577
+
578
+ ### Patch Changes
579
+
580
+ - Updated dependencies [e06565c]
581
+ - @ai-sdk/provider-utils@3.1.0-beta.8
582
+ - @ai-sdk/openai-compatible@1.1.0-beta.8
583
+
3
584
  ## 1.0.0-beta.8
4
585
 
5
586
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -2,7 +2,7 @@ import { ProviderV3, LanguageModelV3, EmbeddingModelV3 } from '@ai-sdk/provider'
2
2
  import { FetchFunction } from '@ai-sdk/provider-utils';
3
3
  import { z } from 'zod/v4';
4
4
 
5
- type BasetenChatModelId = 'deepseek-ai/DeepSeek-R1-0528' | 'deepseek-ai/DeepSeek-V3-0324' | 'meta-llama/Llama-4-Maverick-17B-128E-Instruct' | 'meta-llama/Llama-4-Scout-17B-16E-Instruct' | 'moonshotai/Kimi-K2-Instruct' | 'Qwen/Qwen3-235B-A22B-Instruct-2507' | 'Qwen/Qwen3-Coder-480B-A35B-Instruct' | 'openai/gpt-oss-120b' | (string & {});
5
+ type BasetenChatModelId = 'deepseek-ai/DeepSeek-R1-0528' | 'deepseek-ai/DeepSeek-V3-0324' | 'deepseek-ai/DeepSeek-V3.1' | 'moonshotai/Kimi-K2-Instruct-0905' | 'moonshotai/Kimi-K2-Thinking' | 'Qwen/Qwen3-235B-A22B-Instruct-2507' | 'Qwen/Qwen3-Coder-480B-A35B-Instruct' | 'openai/gpt-oss-120b' | 'zai-org/GLM-4.6' | (string & {});
6
6
 
7
7
  type BasetenEmbeddingModelId = string & {};
8
8
 
@@ -49,9 +49,13 @@ interface BasetenProvider extends ProviderV3 {
49
49
  */
50
50
  languageModel(modelId?: BasetenChatModelId): LanguageModelV3;
51
51
  /**
52
- Creates a text embedding model for text generation.
52
+ Creates a embedding model for text generation.
53
53
  */
54
- textEmbeddingModel(modelId?: BasetenEmbeddingModelId): EmbeddingModelV3<string>;
54
+ embeddingModel(modelId?: BasetenEmbeddingModelId): EmbeddingModelV3;
55
+ /**
56
+ * @deprecated Use `embeddingModel` instead.
57
+ */
58
+ textEmbeddingModel(modelId?: BasetenEmbeddingModelId): EmbeddingModelV3;
55
59
  }
56
60
  declare function createBaseten(options?: BasetenProviderSettings): BasetenProvider;
57
61
  declare const baseten: BasetenProvider;
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import { ProviderV3, LanguageModelV3, EmbeddingModelV3 } from '@ai-sdk/provider'
2
2
  import { FetchFunction } from '@ai-sdk/provider-utils';
3
3
  import { z } from 'zod/v4';
4
4
 
5
- type BasetenChatModelId = 'deepseek-ai/DeepSeek-R1-0528' | 'deepseek-ai/DeepSeek-V3-0324' | 'meta-llama/Llama-4-Maverick-17B-128E-Instruct' | 'meta-llama/Llama-4-Scout-17B-16E-Instruct' | 'moonshotai/Kimi-K2-Instruct' | 'Qwen/Qwen3-235B-A22B-Instruct-2507' | 'Qwen/Qwen3-Coder-480B-A35B-Instruct' | 'openai/gpt-oss-120b' | (string & {});
5
+ type BasetenChatModelId = 'deepseek-ai/DeepSeek-R1-0528' | 'deepseek-ai/DeepSeek-V3-0324' | 'deepseek-ai/DeepSeek-V3.1' | 'moonshotai/Kimi-K2-Instruct-0905' | 'moonshotai/Kimi-K2-Thinking' | 'Qwen/Qwen3-235B-A22B-Instruct-2507' | 'Qwen/Qwen3-Coder-480B-A35B-Instruct' | 'openai/gpt-oss-120b' | 'zai-org/GLM-4.6' | (string & {});
6
6
 
7
7
  type BasetenEmbeddingModelId = string & {};
8
8
 
@@ -49,9 +49,13 @@ interface BasetenProvider extends ProviderV3 {
49
49
  */
50
50
  languageModel(modelId?: BasetenChatModelId): LanguageModelV3;
51
51
  /**
52
- Creates a text embedding model for text generation.
52
+ Creates a embedding model for text generation.
53
53
  */
54
- textEmbeddingModel(modelId?: BasetenEmbeddingModelId): EmbeddingModelV3<string>;
54
+ embeddingModel(modelId?: BasetenEmbeddingModelId): EmbeddingModelV3;
55
+ /**
56
+ * @deprecated Use `embeddingModel` instead.
57
+ */
58
+ textEmbeddingModel(modelId?: BasetenEmbeddingModelId): EmbeddingModelV3;
55
59
  }
56
60
  declare function createBaseten(options?: BasetenProviderSettings): BasetenProvider;
57
61
  declare const baseten: BasetenProvider;
package/dist/index.js CHANGED
@@ -34,7 +34,7 @@ var import_v4 = require("zod/v4");
34
34
  var import_performance_client = require("@basetenlabs/performance-client");
35
35
 
36
36
  // src/version.ts
37
- var VERSION = true ? "1.0.0-beta.8" : "0.0.0-test";
37
+ var VERSION = true ? "1.0.0" : "0.0.0-test";
38
38
 
39
39
  // src/baseten-provider.ts
40
40
  var basetenErrorSchema = import_v4.z.object({
@@ -90,7 +90,7 @@ function createBaseten(options = {}) {
90
90
  errorStructure: basetenErrorStructure
91
91
  });
92
92
  };
93
- const createTextEmbeddingModel = (modelId) => {
93
+ const createEmbeddingModel = (modelId) => {
94
94
  const customURL = options.modelURL;
95
95
  if (!customURL) {
96
96
  throw new Error(
@@ -128,7 +128,8 @@ function createBaseten(options = {}) {
128
128
  return {
129
129
  embeddings,
130
130
  usage: response.usage ? { tokens: response.usage.total_tokens } : void 0,
131
- response: { headers: {}, body: response }
131
+ response: { headers: {}, body: response },
132
+ warnings: []
132
133
  };
133
134
  };
134
135
  return model;
@@ -139,12 +140,14 @@ function createBaseten(options = {}) {
139
140
  }
140
141
  };
141
142
  const provider = (modelId) => createChatModel(modelId);
143
+ provider.specificationVersion = "v3";
142
144
  provider.chatModel = createChatModel;
143
145
  provider.languageModel = createChatModel;
144
146
  provider.imageModel = (modelId) => {
145
147
  throw new import_provider.NoSuchModelError({ modelId, modelType: "imageModel" });
146
148
  };
147
- provider.textEmbeddingModel = createTextEmbeddingModel;
149
+ provider.embeddingModel = createEmbeddingModel;
150
+ provider.textEmbeddingModel = createEmbeddingModel;
148
151
  return provider;
149
152
  }
150
153
  var baseten = createBaseten();
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/baseten-provider.ts","../src/version.ts"],"sourcesContent":["export type { BasetenChatModelId } from './baseten-chat-options';\nexport { baseten, createBaseten } from './baseten-provider';\nexport type {\n BasetenProvider,\n BasetenProviderSettings,\n BasetenErrorData,\n} from './baseten-provider';\nexport { VERSION } from './version';\n","import {\n OpenAICompatibleChatLanguageModel,\n OpenAICompatibleEmbeddingModel,\n ProviderErrorStructure,\n} from '@ai-sdk/openai-compatible';\nimport {\n EmbeddingModelV3,\n LanguageModelV3,\n NoSuchModelError,\n ProviderV3,\n} from '@ai-sdk/provider';\nimport {\n FetchFunction,\n loadApiKey,\n withoutTrailingSlash,\n withUserAgentSuffix,\n} from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\nimport { BasetenChatModelId } from './baseten-chat-options';\nimport { BasetenEmbeddingModelId } from './baseten-embedding-options';\nimport { PerformanceClient } from '@basetenlabs/performance-client';\nimport { VERSION } from './version';\n\nexport type BasetenErrorData = z.infer<typeof basetenErrorSchema>;\n\nconst basetenErrorSchema = z.object({\n error: z.string(),\n});\n\nconst basetenErrorStructure: ProviderErrorStructure<BasetenErrorData> = {\n errorSchema: basetenErrorSchema,\n errorToMessage: data => data.error,\n};\n\nexport interface BasetenProviderSettings {\n /**\n * Baseten API key. Default value is taken from the `BASETEN_API_KEY`\n * environment variable.\n */\n apiKey?: string;\n\n /**\n * Base URL for the Model APIs. Default: 'https://inference.baseten.co/v1'\n */\n baseURL?: string;\n\n /**\n * Model URL for custom models (chat or embeddings).\n * If not supplied, the default Model APIs will be used.\n */\n modelURL?: string;\n /**\n * Custom headers to include in the requests.\n */\n headers?: Record<string, string>;\n\n /**\n * Custom fetch implementation. You can use it as a middleware to intercept requests,\n * or to provide a custom fetch implementation for e.g. testing.\n */\n fetch?: FetchFunction;\n}\n\nexport interface BasetenProvider extends ProviderV3 {\n /**\nCreates a chat model for text generation. \n*/\n (modelId?: BasetenChatModelId): LanguageModelV3;\n\n /**\nCreates a chat model for text generation. \n*/\n chatModel(modelId?: BasetenChatModelId): LanguageModelV3;\n\n /**\nCreates a language model for text generation. Alias for chatModel.\n*/\n languageModel(modelId?: BasetenChatModelId): LanguageModelV3;\n\n /**\nCreates a text embedding model for text generation.\n*/\n textEmbeddingModel(\n modelId?: BasetenEmbeddingModelId,\n ): EmbeddingModelV3<string>;\n}\n\n// by default, we use the Model APIs\nconst defaultBaseURL = 'https://inference.baseten.co/v1';\n\nexport function createBaseten(\n options: BasetenProviderSettings = {},\n): BasetenProvider {\n const baseURL = withoutTrailingSlash(options.baseURL ?? defaultBaseURL);\n const getHeaders = () =>\n withUserAgentSuffix(\n {\n Authorization: `Bearer ${loadApiKey({\n apiKey: options.apiKey,\n environmentVariableName: 'BASETEN_API_KEY',\n description: 'Baseten API key',\n })}`,\n ...options.headers,\n },\n `ai-sdk/baseten/${VERSION}`,\n );\n\n interface CommonModelConfig {\n provider: string;\n url: ({ path }: { path: string }) => string;\n headers: () => Record<string, string>;\n fetch?: FetchFunction;\n }\n\n const getCommonModelConfig = (\n modelType: string,\n customURL?: string,\n ): CommonModelConfig => ({\n provider: `baseten.${modelType}`,\n url: ({ path }) => {\n // For embeddings with /sync URLs (but not /sync/v1), we need to add /v1\n if (\n modelType === 'embedding' &&\n customURL?.includes('/sync') &&\n !customURL?.includes('/sync/v1')\n ) {\n return `${customURL}/v1${path}`;\n }\n return `${customURL || baseURL}${path}`;\n },\n headers: getHeaders,\n fetch: options.fetch,\n });\n\n const createChatModel = (modelId?: BasetenChatModelId) => {\n // Use modelURL if provided, otherwise use default Model APIs\n const customURL = options.modelURL;\n\n if (customURL) {\n // Check if this is a /sync/v1 endpoint (OpenAI-compatible) or /predict endpoint (custom)\n const isOpenAICompatible = customURL.includes('/sync/v1');\n\n if (isOpenAICompatible) {\n // For /sync/v1 endpoints, use standard OpenAI-compatible format\n return new OpenAICompatibleChatLanguageModel(modelId ?? 'placeholder', {\n ...getCommonModelConfig('chat', customURL),\n errorStructure: basetenErrorStructure,\n });\n } else if (customURL.includes('/predict')) {\n throw new Error(\n 'Not supported. You must use a /sync/v1 endpoint for chat models.',\n );\n }\n }\n\n // Use default OpenAI-compatible format for Model APIs\n return new OpenAICompatibleChatLanguageModel(modelId ?? 'chat', {\n ...getCommonModelConfig('chat'),\n errorStructure: basetenErrorStructure,\n });\n };\n\n const createTextEmbeddingModel = (modelId?: BasetenEmbeddingModelId) => {\n // Use modelURL if provided\n const customURL = options.modelURL;\n if (!customURL) {\n throw new Error(\n 'No model URL provided for embeddings. Please set modelURL option for embeddings.',\n );\n }\n\n // Check if this is a /sync or /sync/v1 endpoint (OpenAI-compatible)\n // We support both /sync and /sync/v1, stripping /v1 before passing to Performance Client, as Performance Client adds /v1 itself\n const isOpenAICompatible = customURL.includes('/sync');\n\n if (isOpenAICompatible) {\n // Create the model using OpenAICompatibleEmbeddingModel and override doEmbed\n const model = new OpenAICompatibleEmbeddingModel(\n modelId ?? 'embeddings',\n {\n ...getCommonModelConfig('embedding', customURL),\n errorStructure: basetenErrorStructure,\n },\n );\n\n // Strip /v1 from URL if present before passing to Performance Client to avoid double /v1\n const performanceClientURL = customURL.replace('/sync/v1', '/sync');\n\n // Initialize the B10 Performance Client once for reuse\n const performanceClient = new PerformanceClient(\n performanceClientURL,\n loadApiKey({\n apiKey: options.apiKey,\n environmentVariableName: 'BASETEN_API_KEY',\n description: 'Baseten API key',\n }),\n );\n\n // Override the doEmbed method to use the pre-created Performance Client\n model.doEmbed = async params => {\n if (!params.values || !Array.isArray(params.values)) {\n throw new Error('params.values must be an array of strings');\n }\n\n // Performance Client handles batching internally, so we don't need to limit in 128 here\n const response = await performanceClient.embed(\n params.values,\n modelId ?? 'embeddings', // model_id is for Model APIs, we don't use it here for dedicated\n );\n // Transform the response to match the expected format\n const embeddings = response.data.map((item: any) => item.embedding);\n\n return {\n embeddings: embeddings,\n usage: response.usage\n ? { tokens: response.usage.total_tokens }\n : undefined,\n response: { headers: {}, body: response },\n };\n };\n\n return model;\n } else {\n throw new Error(\n 'Not supported. You must use a /sync or /sync/v1 endpoint for embeddings.',\n );\n }\n };\n\n const provider = (modelId?: BasetenChatModelId) => createChatModel(modelId);\n provider.chatModel = createChatModel;\n provider.languageModel = createChatModel;\n provider.imageModel = (modelId: string) => {\n throw new NoSuchModelError({ modelId, modelType: 'imageModel' });\n };\n provider.textEmbeddingModel = createTextEmbeddingModel;\n return provider;\n}\n\nexport const baseten = createBaseten();\n","// Version string of this package injected at build time.\ndeclare const __PACKAGE_VERSION__: string | undefined;\nexport const VERSION: string =\n typeof __PACKAGE_VERSION__ !== 'undefined'\n ? __PACKAGE_VERSION__\n : '0.0.0-test';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,+BAIO;AACP,sBAKO;AACP,4BAKO;AACP,gBAAkB;AAGlB,gCAAkC;;;AClB3B,IAAM,UACX,OACI,iBACA;;;ADoBN,IAAM,qBAAqB,YAAE,OAAO;AAAA,EAClC,OAAO,YAAE,OAAO;AAClB,CAAC;AAED,IAAM,wBAAkE;AAAA,EACtE,aAAa;AAAA,EACb,gBAAgB,UAAQ,KAAK;AAC/B;AAwDA,IAAM,iBAAiB;AAEhB,SAAS,cACd,UAAmC,CAAC,GACnB;AA5FnB;AA6FE,QAAM,cAAU,6CAAqB,aAAQ,YAAR,YAAmB,cAAc;AACtE,QAAM,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YAAM,QAAQ,IAAI;AAAA,QAChB,4BAAW;AAAA,QACX;AAAA,UACE,GAAG,qBAAqB,aAAa,SAAS;AAAA,UAC9C,gBAAgB;AAAA,QAClB;AAAA,MACF;AAGA,YAAM,uBAAuB,UAAU,QAAQ,YAAY,OAAO;AAGlE,YAAM,oBAAoB,IAAI;AAAA,QAC5B;AAAA,YACA,kCAAW;AAAA,UACT,QAAQ,QAAQ;AAAA,UAChB,yBAAyB;AAAA,UACzB,aAAa;AAAA,QACf,CAAC;AAAA,MACH;AAGA,YAAM,UAAU,OAAM,WAAU;AAC9B,YAAI,CAAC,OAAO,UAAU,CAAC,MAAM,QAAQ,OAAO,MAAM,GAAG;AACnD,gBAAM,IAAI,MAAM,2CAA2C;AAAA,QAC7D;AAGA,cAAM,WAAW,MAAM,kBAAkB;AAAA,UACvC,OAAO;AAAA,UACP,4BAAW;AAAA;AAAA,QACb;AAEA,cAAM,aAAa,SAAS,KAAK,IAAI,CAAC,SAAc,KAAK,SAAS;AAElE,eAAO;AAAA,UACL;AAAA,UACA,OAAO,SAAS,QACZ,EAAE,QAAQ,SAAS,MAAM,aAAa,IACtC;AAAA,UACJ,UAAU,EAAE,SAAS,CAAC,GAAG,MAAM,SAAS;AAAA,QAC1C;AAAA,MACF;AAEA,aAAO;AAAA,IACT,OAAO;AACL,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,QAAM,WAAW,CAAC,YAAiC,gBAAgB,OAAO;AAC1E,WAAS,YAAY;AACrB,WAAS,gBAAgB;AACzB,WAAS,aAAa,CAAC,YAAoB;AACzC,UAAM,IAAI,iCAAiB,EAAE,SAAS,WAAW,aAAa,CAAC;AAAA,EACjE;AACA,WAAS,qBAAqB;AAC9B,SAAO;AACT;AAEO,IAAM,UAAU,cAAc;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts","../src/baseten-provider.ts","../src/version.ts"],"sourcesContent":["export type { BasetenChatModelId } from './baseten-chat-options';\nexport { baseten, createBaseten } from './baseten-provider';\nexport type {\n BasetenProvider,\n BasetenProviderSettings,\n BasetenErrorData,\n} from './baseten-provider';\nexport { VERSION } from './version';\n","import {\n OpenAICompatibleChatLanguageModel,\n OpenAICompatibleEmbeddingModel,\n ProviderErrorStructure,\n} from '@ai-sdk/openai-compatible';\nimport {\n EmbeddingModelV3,\n LanguageModelV3,\n NoSuchModelError,\n ProviderV3,\n} from '@ai-sdk/provider';\nimport {\n FetchFunction,\n loadApiKey,\n withoutTrailingSlash,\n withUserAgentSuffix,\n} from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\nimport { BasetenChatModelId } from './baseten-chat-options';\nimport { BasetenEmbeddingModelId } from './baseten-embedding-options';\nimport { PerformanceClient } from '@basetenlabs/performance-client';\nimport { VERSION } from './version';\n\nexport type BasetenErrorData = z.infer<typeof basetenErrorSchema>;\n\nconst basetenErrorSchema = z.object({\n error: z.string(),\n});\n\nconst basetenErrorStructure: ProviderErrorStructure<BasetenErrorData> = {\n errorSchema: basetenErrorSchema,\n errorToMessage: data => data.error,\n};\n\nexport interface BasetenProviderSettings {\n /**\n * Baseten API key. Default value is taken from the `BASETEN_API_KEY`\n * environment variable.\n */\n apiKey?: string;\n\n /**\n * Base URL for the Model APIs. Default: 'https://inference.baseten.co/v1'\n */\n baseURL?: string;\n\n /**\n * Model URL for custom models (chat or embeddings).\n * If not supplied, the default Model APIs will be used.\n */\n modelURL?: string;\n /**\n * Custom headers to include in the requests.\n */\n headers?: Record<string, string>;\n\n /**\n * Custom fetch implementation. You can use it as a middleware to intercept requests,\n * or to provide a custom fetch implementation for e.g. testing.\n */\n fetch?: FetchFunction;\n}\n\nexport interface BasetenProvider extends ProviderV3 {\n /**\nCreates a chat model for text generation.\n*/\n (modelId?: BasetenChatModelId): LanguageModelV3;\n\n /**\nCreates a chat model for text generation.\n*/\n chatModel(modelId?: BasetenChatModelId): LanguageModelV3;\n\n /**\nCreates a language model for text generation. Alias for chatModel.\n*/\n languageModel(modelId?: BasetenChatModelId): LanguageModelV3;\n\n /**\nCreates a embedding model for text generation.\n*/\n embeddingModel(modelId?: BasetenEmbeddingModelId): EmbeddingModelV3;\n\n /**\n * @deprecated Use `embeddingModel` instead.\n */\n textEmbeddingModel(modelId?: BasetenEmbeddingModelId): EmbeddingModelV3;\n}\n\n// by default, we use the Model APIs\nconst defaultBaseURL = 'https://inference.baseten.co/v1';\n\nexport function createBaseten(\n options: BasetenProviderSettings = {},\n): BasetenProvider {\n const baseURL = withoutTrailingSlash(options.baseURL ?? defaultBaseURL);\n const getHeaders = () =>\n withUserAgentSuffix(\n {\n Authorization: `Bearer ${loadApiKey({\n apiKey: options.apiKey,\n environmentVariableName: 'BASETEN_API_KEY',\n description: 'Baseten API key',\n })}`,\n ...options.headers,\n },\n `ai-sdk/baseten/${VERSION}`,\n );\n\n interface CommonModelConfig {\n provider: string;\n url: ({ path }: { path: string }) => string;\n headers: () => Record<string, string>;\n fetch?: FetchFunction;\n }\n\n const getCommonModelConfig = (\n modelType: string,\n customURL?: string,\n ): CommonModelConfig => ({\n provider: `baseten.${modelType}`,\n url: ({ path }) => {\n // For embeddings with /sync URLs (but not /sync/v1), we need to add /v1\n if (\n modelType === 'embedding' &&\n customURL?.includes('/sync') &&\n !customURL?.includes('/sync/v1')\n ) {\n return `${customURL}/v1${path}`;\n }\n return `${customURL || baseURL}${path}`;\n },\n headers: getHeaders,\n fetch: options.fetch,\n });\n\n const createChatModel = (modelId?: BasetenChatModelId) => {\n // Use modelURL if provided, otherwise use default Model APIs\n const customURL = options.modelURL;\n\n if (customURL) {\n // Check if this is a /sync/v1 endpoint (OpenAI-compatible) or /predict endpoint (custom)\n const isOpenAICompatible = customURL.includes('/sync/v1');\n\n if (isOpenAICompatible) {\n // For /sync/v1 endpoints, use standard OpenAI-compatible format\n return new OpenAICompatibleChatLanguageModel(modelId ?? 'placeholder', {\n ...getCommonModelConfig('chat', customURL),\n errorStructure: basetenErrorStructure,\n });\n } else if (customURL.includes('/predict')) {\n throw new Error(\n 'Not supported. You must use a /sync/v1 endpoint for chat models.',\n );\n }\n }\n\n // Use default OpenAI-compatible format for Model APIs\n return new OpenAICompatibleChatLanguageModel(modelId ?? 'chat', {\n ...getCommonModelConfig('chat'),\n errorStructure: basetenErrorStructure,\n });\n };\n\n const createEmbeddingModel = (modelId?: BasetenEmbeddingModelId) => {\n // Use modelURL if provided\n const customURL = options.modelURL;\n if (!customURL) {\n throw new Error(\n 'No model URL provided for embeddings. Please set modelURL option for embeddings.',\n );\n }\n\n // Check if this is a /sync or /sync/v1 endpoint (OpenAI-compatible)\n // We support both /sync and /sync/v1, stripping /v1 before passing to Performance Client, as Performance Client adds /v1 itself\n const isOpenAICompatible = customURL.includes('/sync');\n\n if (isOpenAICompatible) {\n // Create the model using OpenAICompatibleEmbeddingModel and override doEmbed\n const model = new OpenAICompatibleEmbeddingModel(\n modelId ?? 'embeddings',\n {\n ...getCommonModelConfig('embedding', customURL),\n errorStructure: basetenErrorStructure,\n },\n );\n\n // Strip /v1 from URL if present before passing to Performance Client to avoid double /v1\n const performanceClientURL = customURL.replace('/sync/v1', '/sync');\n\n // Initialize the B10 Performance Client once for reuse\n const performanceClient = new PerformanceClient(\n performanceClientURL,\n loadApiKey({\n apiKey: options.apiKey,\n environmentVariableName: 'BASETEN_API_KEY',\n description: 'Baseten API key',\n }),\n );\n\n // Override the doEmbed method to use the pre-created Performance Client\n model.doEmbed = async params => {\n if (!params.values || !Array.isArray(params.values)) {\n throw new Error('params.values must be an array of strings');\n }\n\n // Performance Client handles batching internally, so we don't need to limit in 128 here\n const response = await performanceClient.embed(\n params.values,\n modelId ?? 'embeddings', // model_id is for Model APIs, we don't use it here for dedicated\n );\n // Transform the response to match the expected format\n const embeddings = response.data.map((item: any) => item.embedding);\n\n return {\n embeddings,\n usage: response.usage\n ? { tokens: response.usage.total_tokens }\n : undefined,\n response: { headers: {}, body: response },\n warnings: [],\n };\n };\n\n return model;\n } else {\n throw new Error(\n 'Not supported. You must use a /sync or /sync/v1 endpoint for embeddings.',\n );\n }\n };\n\n const provider = (modelId?: BasetenChatModelId) => createChatModel(modelId);\n\n provider.specificationVersion = 'v3' as const;\n provider.chatModel = createChatModel;\n provider.languageModel = createChatModel;\n provider.imageModel = (modelId: string) => {\n throw new NoSuchModelError({ modelId, modelType: 'imageModel' });\n };\n provider.embeddingModel = createEmbeddingModel;\n provider.textEmbeddingModel = createEmbeddingModel;\n return provider;\n}\n\nexport const baseten = createBaseten();\n","// Version string of this package injected at build time.\ndeclare const __PACKAGE_VERSION__: string | undefined;\nexport const VERSION: string =\n typeof __PACKAGE_VERSION__ !== 'undefined'\n ? __PACKAGE_VERSION__\n : '0.0.0-test';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,+BAIO;AACP,sBAKO;AACP,4BAKO;AACP,gBAAkB;AAGlB,gCAAkC;;;AClB3B,IAAM,UACX,OACI,UACA;;;ADoBN,IAAM,qBAAqB,YAAE,OAAO;AAAA,EAClC,OAAO,YAAE,OAAO;AAClB,CAAC;AAED,IAAM,wBAAkE;AAAA,EACtE,aAAa;AAAA,EACb,gBAAgB,UAAQ,KAAK;AAC/B;AA2DA,IAAM,iBAAiB;AAEhB,SAAS,cACd,UAAmC,CAAC,GACnB;AA/FnB;AAgGE,QAAM,cAAU,6CAAqB,aAAQ,YAAR,YAAmB,cAAc;AACtE,QAAM,aAAa,UACjB;AAAA,IACE;AAAA,MACE,eAAe,cAAU,kCAAW;AAAA,QAClC,QAAQ,QAAQ;AAAA,QAChB,yBAAyB;AAAA,QACzB,aAAa;AAAA,MACf,CAAC,CAAC;AAAA,MACF,GAAG,QAAQ;AAAA,IACb;AAAA,IACA,kBAAkB,OAAO;AAAA,EAC3B;AASF,QAAM,uBAAuB,CAC3B,WACA,eACuB;AAAA,IACvB,UAAU,WAAW,SAAS;AAAA,IAC9B,KAAK,CAAC,EAAE,KAAK,MAAM;AAEjB,UACE,cAAc,g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OAAM,WAAU;AAC9B,YAAI,CAAC,OAAO,UAAU,CAAC,MAAM,QAAQ,OAAO,MAAM,GAAG;AACnD,gBAAM,IAAI,MAAM,2CAA2C;AAAA,QAC7D;AAGA,cAAM,WAAW,MAAM,kBAAkB;AAAA,UACvC,OAAO;AAAA,UACP,4BAAW;AAAA;AAAA,QACb;AAEA,cAAM,aAAa,SAAS,KAAK,IAAI,CAAC,SAAc,KAAK,SAAS;AAElE,eAAO;AAAA,UACL;AAAA,UACA,OAAO,SAAS,QACZ,EAAE,QAAQ,SAAS,MAAM,aAAa,IACtC;AAAA,UACJ,UAAU,EAAE,SAAS,CAAC,GAAG,MAAM,SAAS;AAAA,UACxC,UAAU,CAAC;AAAA,QACb;AAAA,MACF;AAEA,aAAO;AAAA,IACT,OAAO;AACL,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,QAAM,WAAW,CAAC,YAAiC,gBAAgB,OAAO;AAE1E,WAAS,uBAAuB;AAChC,WAAS,YAAY;AACrB,WAAS,gBAAgB;AACzB,WAAS,aAAa,CAAC,YAAoB;AACzC,UAAM,IAAI,iCAAiB,EAAE,SAAS,WAAW,aAAa,CAAC;AAAA,EACjE;AACA,WAAS,iBAAiB;AAC1B,WAAS,qBAAqB;AAC9B,SAAO;AACT;AAEO,IAAM,UAAU,cAAc;","names":[]}
package/dist/index.mjs CHANGED
@@ -15,7 +15,7 @@ import { z } from "zod/v4";
15
15
  import { PerformanceClient } from "@basetenlabs/performance-client";
16
16
 
17
17
  // src/version.ts
18
- var VERSION = true ? "1.0.0-beta.8" : "0.0.0-test";
18
+ var VERSION = true ? "1.0.0" : "0.0.0-test";
19
19
 
20
20
  // src/baseten-provider.ts
21
21
  var basetenErrorSchema = z.object({
@@ -71,7 +71,7 @@ function createBaseten(options = {}) {
71
71
  errorStructure: basetenErrorStructure
72
72
  });
73
73
  };
74
- const createTextEmbeddingModel = (modelId) => {
74
+ const createEmbeddingModel = (modelId) => {
75
75
  const customURL = options.modelURL;
76
76
  if (!customURL) {
77
77
  throw new Error(
@@ -109,7 +109,8 @@ function createBaseten(options = {}) {
109
109
  return {
110
110
  embeddings,
111
111
  usage: response.usage ? { tokens: response.usage.total_tokens } : void 0,
112
- response: { headers: {}, body: response }
112
+ response: { headers: {}, body: response },
113
+ warnings: []
113
114
  };
114
115
  };
115
116
  return model;
@@ -120,12 +121,14 @@ function createBaseten(options = {}) {
120
121
  }
121
122
  };
122
123
  const provider = (modelId) => createChatModel(modelId);
124
+ provider.specificationVersion = "v3";
123
125
  provider.chatModel = createChatModel;
124
126
  provider.languageModel = createChatModel;
125
127
  provider.imageModel = (modelId) => {
126
128
  throw new NoSuchModelError({ modelId, modelType: "imageModel" });
127
129
  };
128
- provider.textEmbeddingModel = createTextEmbeddingModel;
130
+ provider.embeddingModel = createEmbeddingModel;
131
+ provider.textEmbeddingModel = createEmbeddingModel;
129
132
  return provider;
130
133
  }
131
134
  var baseten = createBaseten();
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/baseten-provider.ts","../src/version.ts"],"sourcesContent":["import {\n OpenAICompatibleChatLanguageModel,\n OpenAICompatibleEmbeddingModel,\n ProviderErrorStructure,\n} from '@ai-sdk/openai-compatible';\nimport {\n EmbeddingModelV3,\n LanguageModelV3,\n NoSuchModelError,\n ProviderV3,\n} from '@ai-sdk/provider';\nimport {\n FetchFunction,\n loadApiKey,\n withoutTrailingSlash,\n withUserAgentSuffix,\n} from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\nimport { BasetenChatModelId } from './baseten-chat-options';\nimport { BasetenEmbeddingModelId } from './baseten-embedding-options';\nimport { PerformanceClient } from '@basetenlabs/performance-client';\nimport { VERSION } from './version';\n\nexport type BasetenErrorData = z.infer<typeof basetenErrorSchema>;\n\nconst basetenErrorSchema = z.object({\n error: z.string(),\n});\n\nconst basetenErrorStructure: ProviderErrorStructure<BasetenErrorData> = {\n errorSchema: basetenErrorSchema,\n errorToMessage: data => data.error,\n};\n\nexport interface BasetenProviderSettings {\n /**\n * Baseten API key. Default value is taken from the `BASETEN_API_KEY`\n * environment variable.\n */\n apiKey?: string;\n\n /**\n * Base URL for the Model APIs. Default: 'https://inference.baseten.co/v1'\n */\n baseURL?: string;\n\n /**\n * Model URL for custom models (chat or embeddings).\n * If not supplied, the default Model APIs will be used.\n */\n modelURL?: string;\n /**\n * Custom headers to include in the requests.\n */\n headers?: Record<string, string>;\n\n /**\n * Custom fetch implementation. You can use it as a middleware to intercept requests,\n * or to provide a custom fetch implementation for e.g. testing.\n */\n fetch?: FetchFunction;\n}\n\nexport interface BasetenProvider extends ProviderV3 {\n /**\nCreates a chat model for text generation. \n*/\n (modelId?: BasetenChatModelId): LanguageModelV3;\n\n /**\nCreates a chat model for text generation. \n*/\n chatModel(modelId?: BasetenChatModelId): LanguageModelV3;\n\n /**\nCreates a language model for text generation. Alias for chatModel.\n*/\n languageModel(modelId?: BasetenChatModelId): LanguageModelV3;\n\n /**\nCreates a text embedding model for text generation.\n*/\n textEmbeddingModel(\n modelId?: BasetenEmbeddingModelId,\n ): EmbeddingModelV3<string>;\n}\n\n// by default, we use the Model APIs\nconst defaultBaseURL = 'https://inference.baseten.co/v1';\n\nexport function createBaseten(\n options: BasetenProviderSettings = {},\n): BasetenProvider {\n const baseURL = withoutTrailingSlash(options.baseURL ?? defaultBaseURL);\n const getHeaders = () =>\n withUserAgentSuffix(\n {\n Authorization: `Bearer ${loadApiKey({\n apiKey: options.apiKey,\n environmentVariableName: 'BASETEN_API_KEY',\n description: 'Baseten API key',\n })}`,\n ...options.headers,\n },\n `ai-sdk/baseten/${VERSION}`,\n );\n\n interface CommonModelConfig {\n provider: string;\n url: ({ path }: { path: string }) => string;\n headers: () => Record<string, string>;\n fetch?: FetchFunction;\n }\n\n const getCommonModelConfig = (\n modelType: string,\n customURL?: string,\n ): CommonModelConfig => ({\n provider: `baseten.${modelType}`,\n url: ({ path }) => {\n // For embeddings with /sync URLs (but not /sync/v1), we need to add /v1\n if (\n modelType === 'embedding' &&\n customURL?.includes('/sync') &&\n !customURL?.includes('/sync/v1')\n ) {\n return `${customURL}/v1${path}`;\n }\n return `${customURL || baseURL}${path}`;\n },\n headers: getHeaders,\n fetch: options.fetch,\n });\n\n const createChatModel = (modelId?: BasetenChatModelId) => {\n // Use modelURL if provided, otherwise use default Model APIs\n const customURL = options.modelURL;\n\n if (customURL) {\n // Check if this is a /sync/v1 endpoint (OpenAI-compatible) or /predict endpoint (custom)\n const isOpenAICompatible = customURL.includes('/sync/v1');\n\n if (isOpenAICompatible) {\n // For /sync/v1 endpoints, use standard OpenAI-compatible format\n return new OpenAICompatibleChatLanguageModel(modelId ?? 'placeholder', {\n ...getCommonModelConfig('chat', customURL),\n errorStructure: basetenErrorStructure,\n });\n } else if (customURL.includes('/predict')) {\n throw new Error(\n 'Not supported. You must use a /sync/v1 endpoint for chat models.',\n );\n }\n }\n\n // Use default OpenAI-compatible format for Model APIs\n return new OpenAICompatibleChatLanguageModel(modelId ?? 'chat', {\n ...getCommonModelConfig('chat'),\n errorStructure: basetenErrorStructure,\n });\n };\n\n const createTextEmbeddingModel = (modelId?: BasetenEmbeddingModelId) => {\n // Use modelURL if provided\n const customURL = options.modelURL;\n if (!customURL) {\n throw new Error(\n 'No model URL provided for embeddings. Please set modelURL option for embeddings.',\n );\n }\n\n // Check if this is a /sync or /sync/v1 endpoint (OpenAI-compatible)\n // We support both /sync and /sync/v1, stripping /v1 before passing to Performance Client, as Performance Client adds /v1 itself\n const isOpenAICompatible = customURL.includes('/sync');\n\n if (isOpenAICompatible) {\n // Create the model using OpenAICompatibleEmbeddingModel and override doEmbed\n const model = new OpenAICompatibleEmbeddingModel(\n modelId ?? 'embeddings',\n {\n ...getCommonModelConfig('embedding', customURL),\n errorStructure: basetenErrorStructure,\n },\n );\n\n // Strip /v1 from URL if present before passing to Performance Client to avoid double /v1\n const performanceClientURL = customURL.replace('/sync/v1', '/sync');\n\n // Initialize the B10 Performance Client once for reuse\n const performanceClient = new PerformanceClient(\n performanceClientURL,\n loadApiKey({\n apiKey: options.apiKey,\n environmentVariableName: 'BASETEN_API_KEY',\n description: 'Baseten API key',\n }),\n );\n\n // Override the doEmbed method to use the pre-created Performance Client\n model.doEmbed = async params => {\n if (!params.values || !Array.isArray(params.values)) {\n throw new Error('params.values must be an array of strings');\n }\n\n // Performance Client handles batching internally, so we don't need to limit in 128 here\n const response = await performanceClient.embed(\n params.values,\n modelId ?? 'embeddings', // model_id is for Model APIs, we don't use it here for dedicated\n );\n // Transform the response to match the expected format\n const embeddings = response.data.map((item: any) => item.embedding);\n\n return {\n embeddings: embeddings,\n usage: response.usage\n ? { tokens: response.usage.total_tokens }\n : undefined,\n response: { headers: {}, body: response },\n };\n };\n\n return model;\n } else {\n throw new Error(\n 'Not supported. You must use a /sync or /sync/v1 endpoint for embeddings.',\n );\n }\n };\n\n const provider = (modelId?: BasetenChatModelId) => createChatModel(modelId);\n provider.chatModel = createChatModel;\n provider.languageModel = createChatModel;\n provider.imageModel = (modelId: string) => {\n throw new NoSuchModelError({ modelId, modelType: 'imageModel' });\n };\n provider.textEmbeddingModel = createTextEmbeddingModel;\n return provider;\n}\n\nexport const baseten = createBaseten();\n","// Version string of this package injected at build time.\ndeclare const __PACKAGE_VERSION__: string | undefined;\nexport const VERSION: string =\n typeof __PACKAGE_VERSION__ !== 'undefined'\n ? __PACKAGE_VERSION__\n : '0.0.0-test';\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AACP;AAAA,EAGE;AAAA,OAEK;AACP;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,SAAS;AAGlB,SAAS,yBAAyB;;;AClB3B,IAAM,UACX,OACI,iBACA;;;ADoBN,IAAM,qBAAqB,EAAE,OAAO;AAAA,EAClC,OAAO,EAAE,OAAO;AAClB,CAAC;AAED,IAAM,wBAAkE;AAAA,EACtE,aAAa;AAAA,EACb,gBAAgB,UAAQ,KAAK;AAC/B;AAwDA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M,UAAU,cAAc;","names":[]}
1
+ {"version":3,"sources":["../src/baseten-provider.ts","../src/version.ts"],"sourcesContent":["import {\n OpenAICompatibleChatLanguageModel,\n OpenAICompatibleEmbeddingModel,\n ProviderErrorStructure,\n} from '@ai-sdk/openai-compatible';\nimport {\n EmbeddingModelV3,\n LanguageModelV3,\n NoSuchModelError,\n ProviderV3,\n} from '@ai-sdk/provider';\nimport {\n FetchFunction,\n loadApiKey,\n withoutTrailingSlash,\n withUserAgentSuffix,\n} from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\nimport { BasetenChatModelId } from './baseten-chat-options';\nimport { BasetenEmbeddingModelId } from './baseten-embedding-options';\nimport { PerformanceClient } from '@basetenlabs/performance-client';\nimport { VERSION } from './version';\n\nexport type BasetenErrorData = z.infer<typeof basetenErrorSchema>;\n\nconst basetenErrorSchema = z.object({\n error: z.string(),\n});\n\nconst basetenErrorStructure: ProviderErrorStructure<BasetenErrorData> = {\n errorSchema: basetenErrorSchema,\n errorToMessage: data => data.error,\n};\n\nexport interface BasetenProviderSettings {\n /**\n * Baseten API key. Default value is taken from the `BASETEN_API_KEY`\n * environment variable.\n */\n apiKey?: string;\n\n /**\n * Base URL for the Model APIs. Default: 'https://inference.baseten.co/v1'\n */\n baseURL?: string;\n\n /**\n * Model URL for custom models (chat or embeddings).\n * If not supplied, the default Model APIs will be used.\n */\n modelURL?: string;\n /**\n * Custom headers to include in the requests.\n */\n headers?: Record<string, string>;\n\n /**\n * Custom fetch implementation. You can use it as a middleware to intercept requests,\n * or to provide a custom fetch implementation for e.g. testing.\n */\n fetch?: FetchFunction;\n}\n\nexport interface BasetenProvider extends ProviderV3 {\n /**\nCreates a chat model for text generation.\n*/\n (modelId?: BasetenChatModelId): LanguageModelV3;\n\n /**\nCreates a chat model for text generation.\n*/\n chatModel(modelId?: BasetenChatModelId): LanguageModelV3;\n\n /**\nCreates a language model for text generation. Alias for chatModel.\n*/\n languageModel(modelId?: BasetenChatModelId): LanguageModelV3;\n\n /**\nCreates a embedding model for text generation.\n*/\n embeddingModel(modelId?: BasetenEmbeddingModelId): EmbeddingModelV3;\n\n /**\n * @deprecated Use `embeddingModel` instead.\n */\n textEmbeddingModel(modelId?: BasetenEmbeddingModelId): EmbeddingModelV3;\n}\n\n// by default, we use the Model APIs\nconst defaultBaseURL = 'https://inference.baseten.co/v1';\n\nexport function createBaseten(\n options: BasetenProviderSettings = {},\n): BasetenProvider {\n const baseURL = withoutTrailingSlash(options.baseURL ?? defaultBaseURL);\n const getHeaders = () =>\n withUserAgentSuffix(\n {\n Authorization: `Bearer ${loadApiKey({\n apiKey: options.apiKey,\n environmentVariableName: 'BASETEN_API_KEY',\n description: 'Baseten API key',\n })}`,\n ...options.headers,\n },\n `ai-sdk/baseten/${VERSION}`,\n );\n\n interface CommonModelConfig {\n provider: string;\n url: ({ path }: { path: string }) => string;\n headers: () => Record<string, string>;\n fetch?: FetchFunction;\n }\n\n const getCommonModelConfig = (\n modelType: string,\n customURL?: string,\n ): CommonModelConfig => ({\n provider: `baseten.${modelType}`,\n url: ({ path }) => {\n // For embeddings with /sync URLs (but not /sync/v1), we need to add /v1\n if (\n modelType === 'embedding' &&\n customURL?.includes('/sync') &&\n !customURL?.includes('/sync/v1')\n ) {\n return `${customURL}/v1${path}`;\n }\n return `${customURL || baseURL}${path}`;\n },\n headers: getHeaders,\n fetch: options.fetch,\n });\n\n const createChatModel = (modelId?: BasetenChatModelId) => {\n // Use modelURL if provided, otherwise use default Model APIs\n const customURL = options.modelURL;\n\n if (customURL) {\n // Check if this is a /sync/v1 endpoint (OpenAI-compatible) or /predict endpoint (custom)\n const isOpenAICompatible = customURL.includes('/sync/v1');\n\n if (isOpenAICompatible) {\n // For /sync/v1 endpoints, use standard OpenAI-compatible format\n return new OpenAICompatibleChatLanguageModel(modelId ?? 'placeholder', {\n ...getCommonModelConfig('chat', customURL),\n errorStructure: basetenErrorStructure,\n });\n } else if (customURL.includes('/predict')) {\n throw new Error(\n 'Not supported. You must use a /sync/v1 endpoint for chat models.',\n );\n }\n }\n\n // Use default OpenAI-compatible format for Model APIs\n return new OpenAICompatibleChatLanguageModel(modelId ?? 'chat', {\n ...getCommonModelConfig('chat'),\n errorStructure: basetenErrorStructure,\n });\n };\n\n const createEmbeddingModel = (modelId?: BasetenEmbeddingModelId) => {\n // Use modelURL if provided\n const customURL = options.modelURL;\n if (!customURL) {\n throw new Error(\n 'No model URL provided for embeddings. Please set modelURL option for embeddings.',\n );\n }\n\n // Check if this is a /sync or /sync/v1 endpoint (OpenAI-compatible)\n // We support both /sync and /sync/v1, stripping /v1 before passing to Performance Client, as Performance Client adds /v1 itself\n const isOpenAICompatible = customURL.includes('/sync');\n\n if (isOpenAICompatible) {\n // Create the model using OpenAICompatibleEmbeddingModel and override doEmbed\n const model = new OpenAICompatibleEmbeddingModel(\n modelId ?? 'embeddings',\n {\n ...getCommonModelConfig('embedding', customURL),\n errorStructure: basetenErrorStructure,\n },\n );\n\n // Strip /v1 from URL if present before passing to Performance Client to avoid double /v1\n const performanceClientURL = customURL.replace('/sync/v1', '/sync');\n\n // Initialize the B10 Performance Client once for reuse\n const performanceClient = new PerformanceClient(\n performanceClientURL,\n loadApiKey({\n apiKey: options.apiKey,\n environmentVariableName: 'BASETEN_API_KEY',\n description: 'Baseten API key',\n }),\n );\n\n // Override the doEmbed method to use the pre-created Performance Client\n model.doEmbed = async params => {\n if (!params.values || !Array.isArray(params.values)) {\n throw new Error('params.values must be an array of strings');\n }\n\n // Performance Client handles batching internally, so we don't need to limit in 128 here\n const response = await performanceClient.embed(\n params.values,\n modelId ?? 'embeddings', // model_id is for Model APIs, we don't use it here for dedicated\n );\n // Transform the response to match the expected format\n const embeddings = response.data.map((item: any) => item.embedding);\n\n return {\n embeddings,\n usage: response.usage\n ? { tokens: response.usage.total_tokens }\n : undefined,\n response: { headers: {}, body: response },\n warnings: [],\n };\n };\n\n return model;\n } else {\n throw new Error(\n 'Not supported. You must use a /sync or /sync/v1 endpoint for embeddings.',\n );\n }\n };\n\n const provider = (modelId?: BasetenChatModelId) => createChatModel(modelId);\n\n provider.specificationVersion = 'v3' as const;\n provider.chatModel = createChatModel;\n provider.languageModel = createChatModel;\n provider.imageModel = (modelId: string) => {\n throw new NoSuchModelError({ modelId, modelType: 'imageModel' });\n };\n provider.embeddingModel = createEmbeddingModel;\n provider.textEmbeddingModel = createEmbeddingModel;\n return provider;\n}\n\nexport const baseten = createBaseten();\n","// Version string of this package injected at build time.\ndeclare const __PACKAGE_VERSION__: string | undefined;\nexport const VERSION: string =\n typeof __PACKAGE_VERSION__ !== 'undefined'\n ? __PACKAGE_VERSION__\n : '0.0.0-test';\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AACP;AAAA,EAGE;AAAA,OAEK;AACP;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,SAAS;AAGlB,SAAS,yBAAyB;;;AClB3B,IAAM,UACX,OACI,UACA;;;ADoBN,IAAM,qBAAqB,EAAE,OAAO;AAAA,EAClC,OAAO,EAAE,OAAO;AAClB,CAAC;AAED,IAAM,wBAAkE;AAAA,EACtE,aAAa;AAAA,EACb,gBAAgB,UAAQ,KAAK;AAC/B;AA2DA,IAAM,iBAAiB;AAEhB,SAAS,cACd,UAAmC,CAAC,GACnB;AA/FnB;AAgGE,QAAM,UAAU,sBAAqB,aAAQ,YAAR,YAAmB,cAAc;AACtE,QAAM,aAAa,MACjB;AAAA,IACE;AAAA,MACE,eAAe,UAAU,WAAW;AAAA,QAClC,QAAQ,QAAQ;AAAA,QAChB,yBAAyB;AAAA,QACzB,aAAa;AAAA,MACf,CAAC,CAAC;AAAA,MACF,GAAG,QAAQ;AAAA,IACb;AAAA,IACA,kBAAkB,OAAO;AAAA,EAC3B;AASF,QAAM,uBAAuB,CAC3B,WACA,eACuB;AAAA,IACvB,UAAU,WAAW,SAAS;AAAA,IAC9B,KAAK,CAAC,EAAE,KAAK,MAAM;AAEjB,UACE,cAAc,gBACd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,WAAU;AAC9B,YAAI,CAAC,OAAO,UAAU,CAAC,MAAM,QAAQ,OAAO,MAAM,GAAG;AACnD,gBAAM,IAAI,MAAM,2CAA2C;AAAA,QAC7D;AAGA,cAAM,WAAW,MAAM,kBAAkB;AAAA,UACvC,OAAO;AAAA,UACP,4BAAW;AAAA;AAAA,QACb;AAEA,cAAM,aAAa,SAAS,KAAK,IAAI,CAAC,SAAc,KAAK,SAAS;AAElE,eAAO;AAAA,UACL;AAAA,UACA,OAAO,SAAS,QACZ,EAAE,QAAQ,SAAS,MAAM,aAAa,IACtC;AAAA,UACJ,UAAU,EAAE,SAAS,CAAC,GAAG,MAAM,SAAS;AAAA,UACxC,UAAU,CAAC;AAAA,QACb;AAAA,MACF;AAEA,aAAO;AAAA,IACT,OAAO;AACL,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,QAAM,WAAW,CAAC,YAAiC,gBAAgB,OAAO;AAE1E,WAAS,uBAAuB;AAChC,WAAS,YAAY;AACrB,WAAS,gBAAgB;AACzB,WAAS,aAAa,CAAC,YAAoB;AACzC,UAAM,IAAI,iBAAiB,EAAE,SAAS,WAAW,aAAa,CAAC;AAAA,EACjE;AACA,WAAS,iBAAiB;AAC1B,WAAS,qBAAqB;AAC9B,SAAO;AACT;AAEO,IAAM,UAAU,cAAc;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/baseten",
3
- "version": "1.0.0-beta.8",
3
+ "version": "1.0.0",
4
4
  "license": "Apache-2.0",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/index.js",
@@ -8,7 +8,8 @@
8
8
  "types": "./dist/index.d.ts",
9
9
  "files": [
10
10
  "dist/**/*",
11
- "CHANGELOG.md"
11
+ "CHANGELOG.md",
12
+ "README.md"
12
13
  ],
13
14
  "exports": {
14
15
  "./package.json": "./package.json",
@@ -20,9 +21,9 @@
20
21
  },
21
22
  "dependencies": {
22
23
  "@basetenlabs/performance-client": "^0.0.10",
23
- "@ai-sdk/openai-compatible": "1.1.0-beta.7",
24
- "@ai-sdk/provider": "2.1.0-beta.5",
25
- "@ai-sdk/provider-utils": "3.1.0-beta.7"
24
+ "@ai-sdk/openai-compatible": "2.0.0",
25
+ "@ai-sdk/provider": "3.0.0",
26
+ "@ai-sdk/provider-utils": "4.0.0"
26
27
  },
27
28
  "devDependencies": {
28
29
  "@types/node": "20.17.24",