@ai-sdk/langchain 1.0.0-canary.9 → 1.0.1

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,716 @@
1
1
  # @ai-sdk/langchain
2
2
 
3
+ ## 1.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [4d0c108]
8
+ - ai@5.0.1
9
+
10
+ ## 1.0.0
11
+
12
+ ### Patch Changes
13
+
14
+ - bc3109f: chore (ai): push stream-callbacks into langchain/llamaindex adapters
15
+ - c9fbc57: chore(providers/langchain): extract to separate package
16
+ - Updated dependencies [e1cbf8a]
17
+ - Updated dependencies [a571d6e]
18
+ - Updated dependencies [de2d2ab]
19
+ - Updated dependencies [c22ad54]
20
+ - Updated dependencies [a847c3e]
21
+ - Updated dependencies [13fef90]
22
+ - Updated dependencies [d88455d]
23
+ - Updated dependencies [e7fcc86]
24
+ - Updated dependencies [da1e6f0]
25
+ - Updated dependencies [48378b9]
26
+ - Updated dependencies [5d1e3ba]
27
+ - Updated dependencies [d964901]
28
+ - Updated dependencies [93d53a1]
29
+ - Updated dependencies [e90d45d]
30
+ - Updated dependencies [b32c141]
31
+ - Updated dependencies [bc3109f]
32
+ - Updated dependencies [0a710d8]
33
+ - Updated dependencies [0d9583c]
34
+ - Updated dependencies [9ad0484]
35
+ - Updated dependencies [38ae5cc]
36
+ - Updated dependencies [10b21eb]
37
+ - Updated dependencies [63f9e9b]
38
+ - Updated dependencies [ab7ccef]
39
+ - Updated dependencies [d5f588f]
40
+ - Updated dependencies [9e40cbe]
41
+ - Updated dependencies [6909543]
42
+ - Updated dependencies [86cfc72]
43
+ - Updated dependencies [ec78cdc]
44
+ - Updated dependencies [377bbcf]
45
+ - Updated dependencies [6a83f7d]
46
+ - Updated dependencies [d8aeaef]
47
+ - Updated dependencies [ae77a99]
48
+ - Updated dependencies [4fef487]
49
+ - Updated dependencies [b1e3abd]
50
+ - Updated dependencies [4f3e637]
51
+ - Updated dependencies [db345da]
52
+ - Updated dependencies [496bbc1]
53
+ - Updated dependencies [14cb3be]
54
+ - Updated dependencies [1f6ce57]
55
+ - Updated dependencies [72d7d72]
56
+ - Updated dependencies [40acf9b]
57
+ - Updated dependencies [98f25e5]
58
+ - Updated dependencies [16ccfb2]
59
+ - Updated dependencies [225f087]
60
+ - Updated dependencies [ce1d1f3]
61
+ - Updated dependencies [fc0380b]
62
+ - Updated dependencies [b7eae2d]
63
+ - Updated dependencies [2d03e19]
64
+ - Updated dependencies [6622441]
65
+ - Updated dependencies [4048ce3]
66
+ - Updated dependencies [6c42e56]
67
+ - Updated dependencies [bedb239]
68
+ - Updated dependencies [da70d79]
69
+ - Updated dependencies [9b4d074]
70
+ - Updated dependencies [c60f895]
71
+ - Updated dependencies [bcea599]
72
+ - Updated dependencies [c8fce91]
73
+ - Updated dependencies [655cf3c]
74
+ - Updated dependencies [3e10408]
75
+ - Updated dependencies [d5ae088]
76
+ - Updated dependencies [ced8eee]
77
+ - Updated dependencies [c040e2f]
78
+ - Updated dependencies [d3960e3]
79
+ - Updated dependencies [0560977]
80
+ - Updated dependencies [faea29f]
81
+ - Updated dependencies [66af894]
82
+ - Updated dependencies [332167b]
83
+ - Updated dependencies [9477ebb]
84
+ - Updated dependencies [6b1c55c]
85
+ - Updated dependencies [5a975a4]
86
+ - Updated dependencies [1f55c21]
87
+ - Updated dependencies [507ac1d]
88
+ - Updated dependencies [a166433]
89
+ - Updated dependencies [e7dc6c7]
90
+ - Updated dependencies [26735b5]
91
+ - Updated dependencies [c93a8bc]
92
+ - Updated dependencies [8b86e99]
93
+ - Updated dependencies [0d2c085]
94
+ - Updated dependencies [2b9bbcd]
95
+ - Updated dependencies [04d5063]
96
+ - Updated dependencies [a8c8bd5]
97
+ - Updated dependencies [75c3396]
98
+ - Updated dependencies [cb9c9e4]
99
+ - Updated dependencies [319b989]
100
+ - Updated dependencies [14c9410]
101
+ - Updated dependencies [9bf7291]
102
+ - Updated dependencies [9b0da33]
103
+ - Updated dependencies [a34eb39]
104
+ - Updated dependencies [28ad69e]
105
+ - Updated dependencies [0b78e17]
106
+ - Updated dependencies [20398f2]
107
+ - Updated dependencies [66962ed]
108
+ - Updated dependencies [f04fb4a]
109
+ - Updated dependencies [b71fe8d]
110
+ - Updated dependencies [f7e8bf4]
111
+ - Updated dependencies [7827a49]
112
+ - Updated dependencies [48d675a]
113
+ - Updated dependencies [257224b]
114
+ - Updated dependencies [bd8a36c]
115
+ - Updated dependencies [d9209ca]
116
+ - Updated dependencies [b346545]
117
+ - Updated dependencies [05d2819]
118
+ - Updated dependencies [f2b041e]
119
+ - Updated dependencies [2a62513]
120
+ - Updated dependencies [143c55b]
121
+ - Updated dependencies [9301f86]
122
+ - Updated dependencies [904fa5e]
123
+ - Updated dependencies [fd1924b]
124
+ - Updated dependencies [0a87932]
125
+ - Updated dependencies [2524fc7]
126
+ - Updated dependencies [1675396]
127
+ - Updated dependencies [51f497d]
128
+ - Updated dependencies [cee64b2]
129
+ - Updated dependencies [6fba4c7]
130
+ - Updated dependencies [b4b4bb2]
131
+ - Updated dependencies [f04ffe4]
132
+ - Updated dependencies [bc24722]
133
+ - Updated dependencies [b6f9f3c]
134
+ - Updated dependencies [8aa9e20]
135
+ - Updated dependencies [4617fab]
136
+ - Updated dependencies [8255639]
137
+ - Updated dependencies [f81c720]
138
+ - Updated dependencies [441d042]
139
+ - Updated dependencies [cf9af6e]
140
+ - Updated dependencies [ef256ed]
141
+ - Updated dependencies [ee38081]
142
+ - Updated dependencies [2e4f9e4]
143
+ - Updated dependencies [516be5b]
144
+ - Updated dependencies [a662dea]
145
+ - Updated dependencies [d884051]
146
+ - Updated dependencies [3e3b9df]
147
+ - Updated dependencies [cda32ba]
148
+ - Updated dependencies [e8324c5]
149
+ - Updated dependencies [fafc3f2]
150
+ - Updated dependencies [48a7606]
151
+ - Updated dependencies [cb68df0]
152
+ - Updated dependencies [db64cbe]
153
+ - Updated dependencies [97c35c0]
154
+ - Updated dependencies [1ed0287]
155
+ - Updated dependencies [26695a3]
156
+ - Updated dependencies [90ac328]
157
+ - Updated dependencies [c9ad635]
158
+ - Updated dependencies [60132dd]
159
+ - Updated dependencies [c7710a9]
160
+ - Updated dependencies [4a1e0c8]
161
+ - Updated dependencies [bfbfc4c]
162
+ - Updated dependencies [c6b64a7]
163
+ - Updated dependencies [fccf75c]
164
+ - Updated dependencies [9ae327d]
165
+ - Updated dependencies [9315076]
166
+ - Updated dependencies [247ee0c]
167
+ - Updated dependencies [9121250]
168
+ - Updated dependencies [ea27cc6]
169
+ - Updated dependencies [90ca2b9]
170
+ - Updated dependencies [50f0362]
171
+ - Updated dependencies [109c0ac]
172
+ - Updated dependencies [954aa73]
173
+ - Updated dependencies [33eb499]
174
+ - Updated dependencies [825e8d7]
175
+ - Updated dependencies [901df02]
176
+ - Updated dependencies [7d97ab6]
177
+ - Updated dependencies [4892798]
178
+ - Updated dependencies [0ff02bb]
179
+ - Updated dependencies [c25cbce]
180
+ - Updated dependencies [4f3776c]
181
+ - Updated dependencies [9338f3e]
182
+ - Updated dependencies [b33ed7a]
183
+ - Updated dependencies [92c8e66]
184
+ - Updated dependencies [53569b8]
185
+ - Updated dependencies [82aa95d]
186
+ - Updated dependencies [ed675de]
187
+ - Updated dependencies [e7d2ce3]
188
+ - Updated dependencies [add5ac1]
189
+ - Updated dependencies [37a916d]
190
+ - Updated dependencies [30ac566]
191
+ - Updated dependencies [8026705]
192
+ - Updated dependencies [9bd5ab5]
193
+ - Updated dependencies [ec5933d]
194
+ - Updated dependencies [09f41ac]
195
+ - Updated dependencies [7bb58d4]
196
+ - Updated dependencies [ff1c81a]
197
+ - Updated dependencies [af1d5a5]
198
+ - Updated dependencies [cb3b9c9]
199
+ - Updated dependencies [86293e5]
200
+ - Updated dependencies [d1a034f]
201
+ - Updated dependencies [fd65bc6]
202
+ - Updated dependencies [ea7a7c9]
203
+ - Updated dependencies [d92b9a8]
204
+ - Updated dependencies [102b066]
205
+ - Updated dependencies [142576e]
206
+ - Updated dependencies [84343eb]
207
+ - Updated dependencies [0463011]
208
+ - Updated dependencies [a76a62b]
209
+ - Updated dependencies [89ba235]
210
+ - Updated dependencies [8e31d46]
211
+ - Updated dependencies [dcc549b]
212
+ - Updated dependencies [35fc02c]
213
+ - Updated dependencies [64f6d64]
214
+ - Updated dependencies [bd398e4]
215
+ - Updated dependencies [88a8ee5]
216
+ - Updated dependencies [205077b]
217
+ - Updated dependencies [d91b50d]
218
+ - Updated dependencies [e4c8647]
219
+ - Updated dependencies [c808e4d]
220
+ - Updated dependencies [175b868]
221
+ - Updated dependencies [e862b5b]
222
+ - Updated dependencies [395c85e]
223
+ - Updated dependencies [60e2c56]
224
+ - Updated dependencies [5bdff05]
225
+ - Updated dependencies [13b4f46]
226
+ - Updated dependencies [a4f3007]
227
+ - Updated dependencies [8e64e9c]
228
+ - Updated dependencies [765f1cd]
229
+ - Updated dependencies [cb2b53a]
230
+ - Updated dependencies [b983b51]
231
+ - Updated dependencies [e244a78]
232
+ - Updated dependencies [d306260]
233
+ - Updated dependencies [4bfe9ec]
234
+ - Updated dependencies [56c232b]
235
+ - Updated dependencies [1766ede]
236
+ - Updated dependencies [7324c21]
237
+ - Updated dependencies [2877a74]
238
+ - Updated dependencies [f10304b]
239
+ - Updated dependencies [dd5fd43]
240
+ - Updated dependencies [a753b3a]
241
+ - Updated dependencies [1409e13]
242
+ - Updated dependencies [383cbfa]
243
+ - Updated dependencies [27deb4d]
244
+ - Updated dependencies [5f2b3d4]
245
+ - Updated dependencies [4c8f834]
246
+ - Updated dependencies [f2c7f19]
247
+ - Updated dependencies [b32e192]
248
+ - Updated dependencies [92cb0a2]
249
+ - Updated dependencies [2b637d6]
250
+ - Updated dependencies [7bd025b]
251
+ - ai@5.0.0
252
+
253
+ ## 1.0.0-beta.34
254
+
255
+ ### Patch Changes
256
+
257
+ - Updated dependencies [53569b8]
258
+ - Updated dependencies [88a8ee5]
259
+ - Updated dependencies [f2c7f19]
260
+ - ai@5.0.0-beta.34
261
+
262
+ ## 1.0.0-beta.33
263
+
264
+ ### Patch Changes
265
+
266
+ - Updated dependencies [48378b9]
267
+ - Updated dependencies [93d53a1]
268
+ - Updated dependencies [27deb4d]
269
+ - ai@5.0.0-beta.33
270
+
271
+ ## 1.0.0-beta.32
272
+
273
+ ### Patch Changes
274
+
275
+ - Updated dependencies [bc24722]
276
+ - Updated dependencies [13b4f46]
277
+ - Updated dependencies [56c232b]
278
+ - ai@5.0.0-beta.32
279
+
280
+ ## 1.0.0-beta.31
281
+
282
+ ### Patch Changes
283
+
284
+ - Updated dependencies [6622441]
285
+ - Updated dependencies [ced8eee]
286
+ - Updated dependencies [cee64b2]
287
+ - Updated dependencies [ee38081]
288
+ - Updated dependencies [dd5fd43]
289
+ - ai@5.0.0-beta.31
290
+
291
+ ## 1.0.0-beta.30
292
+
293
+ ### Patch Changes
294
+
295
+ - ai@5.0.0-beta.30
296
+
297
+ ## 1.0.0-beta.29
298
+
299
+ ### Patch Changes
300
+
301
+ - Updated dependencies [e7fcc86]
302
+ - Updated dependencies [d92b9a8]
303
+ - ai@5.0.0-beta.29
304
+
305
+ ## 1.0.0-beta.28
306
+
307
+ ### Patch Changes
308
+
309
+ - Updated dependencies [84343eb]
310
+ - Updated dependencies [a753b3a]
311
+ - ai@5.0.0-beta.28
312
+
313
+ ## 1.0.0-beta.27
314
+
315
+ ### Patch Changes
316
+
317
+ - Updated dependencies [d5ae088]
318
+ - ai@5.0.0-beta.27
319
+
320
+ ## 1.0.0-beta.26
321
+
322
+ ### Patch Changes
323
+
324
+ - Updated dependencies [ae77a99]
325
+ - Updated dependencies [1f6ce57]
326
+ - Updated dependencies [5a975a4]
327
+ - Updated dependencies [2a62513]
328
+ - Updated dependencies [904fa5e]
329
+ - Updated dependencies [f81c720]
330
+ - ai@5.0.0-beta.26
331
+
332
+ ## 1.0.0-beta.25
333
+
334
+ ### Patch Changes
335
+
336
+ - ai@5.0.0-beta.25
337
+
338
+ ## 1.0.0-beta.24
339
+
340
+ ### Patch Changes
341
+
342
+ - Updated dependencies [add5ac1]
343
+ - Updated dependencies [ff1c81a]
344
+ - Updated dependencies [e4c8647]
345
+ - Updated dependencies [383cbfa]
346
+ - ai@5.0.0-beta.24
347
+
348
+ ## 1.0.0-beta.23
349
+
350
+ ### Patch Changes
351
+
352
+ - Updated dependencies [89ba235]
353
+ - ai@5.0.0-beta.23
354
+
355
+ ## 1.0.0-beta.22
356
+
357
+ ### Patch Changes
358
+
359
+ - Updated dependencies [de2d2ab]
360
+ - Updated dependencies [6c42e56]
361
+ - Updated dependencies [c93a8bc]
362
+ - Updated dependencies [20398f2]
363
+ - Updated dependencies [86293e5]
364
+ - Updated dependencies [205077b]
365
+ - ai@5.0.0-beta.22
366
+
367
+ ## 1.0.0-beta.21
368
+
369
+ ### Patch Changes
370
+
371
+ - Updated dependencies [38ae5cc]
372
+ - Updated dependencies [faea29f]
373
+ - Updated dependencies [90ac328]
374
+ - Updated dependencies [4a1e0c8]
375
+ - Updated dependencies [30ac566]
376
+ - ai@5.0.0-beta.21
377
+
378
+ ## 1.0.0-beta.20
379
+
380
+ ### Patch Changes
381
+
382
+ - Updated dependencies [4c8f834]
383
+ - ai@5.0.0-beta.20
384
+
385
+ ## 1.0.0-beta.19
386
+
387
+ ### Patch Changes
388
+
389
+ - Updated dependencies [10b21eb]
390
+ - Updated dependencies [75c3396]
391
+ - Updated dependencies [05d2819]
392
+ - Updated dependencies [db64cbe]
393
+ - ai@5.0.0-beta.19
394
+
395
+ ## 1.0.0-beta.18
396
+
397
+ ### Patch Changes
398
+
399
+ - Updated dependencies [d3960e3]
400
+ - Updated dependencies [9338f3e]
401
+ - ai@5.0.0-beta.18
402
+
403
+ ## 1.0.0-beta.17
404
+
405
+ ### Patch Changes
406
+
407
+ - ai@5.0.0-beta.17
408
+
409
+ ## 1.0.0-beta.16
410
+
411
+ ### Patch Changes
412
+
413
+ - ai@5.0.0-beta.16
414
+
415
+ ## 1.0.0-beta.15
416
+
417
+ ### Patch Changes
418
+
419
+ - Updated dependencies [8e31d46]
420
+ - ai@5.0.0-beta.15
421
+
422
+ ## 1.0.0-beta.14
423
+
424
+ ### Patch Changes
425
+
426
+ - ai@5.0.0-beta.14
427
+
428
+ ## 1.0.0-beta.13
429
+
430
+ ### Patch Changes
431
+
432
+ - Updated dependencies [377bbcf]
433
+ - Updated dependencies [ce1d1f3]
434
+ - Updated dependencies [c040e2f]
435
+ - Updated dependencies [c808e4d]
436
+ - ai@5.0.0-beta.13
437
+
438
+ ## 1.0.0-beta.12
439
+
440
+ ### Patch Changes
441
+
442
+ - Updated dependencies [fc0380b]
443
+ - Updated dependencies [51f497d]
444
+ - Updated dependencies [4f3776c]
445
+ - ai@5.0.0-beta.12
446
+
447
+ ## 1.0.0-beta.11
448
+
449
+ ### Patch Changes
450
+
451
+ - Updated dependencies [9e40cbe]
452
+ - ai@5.0.0-beta.11
453
+
454
+ ## 1.0.0-beta.10
455
+
456
+ ### Patch Changes
457
+
458
+ - Updated dependencies [16ccfb2]
459
+ - Updated dependencies [90ca2b9]
460
+ - Updated dependencies [af1d5a5]
461
+ - Updated dependencies [2b637d6]
462
+ - ai@5.0.0-beta.10
463
+
464
+ ## 1.0.0-beta.9
465
+
466
+ ### Patch Changes
467
+
468
+ - Updated dependencies [86cfc72]
469
+ - ai@5.0.0-beta.9
470
+
471
+ ## 1.0.0-beta.8
472
+
473
+ ### Patch Changes
474
+
475
+ - Updated dependencies [6909543]
476
+ - Updated dependencies [c8fce91]
477
+ - Updated dependencies [9121250]
478
+ - ai@5.0.0-beta.8
479
+
480
+ ## 1.0.0-beta.7
481
+
482
+ ### Patch Changes
483
+
484
+ - Updated dependencies [60132dd]
485
+ - ai@5.0.0-beta.7
486
+
487
+ ## 1.0.0-beta.6
488
+
489
+ ### Patch Changes
490
+
491
+ - Updated dependencies [143c55b]
492
+ - Updated dependencies [f04ffe4]
493
+ - Updated dependencies [97c35c0]
494
+ - Updated dependencies [fccf75c]
495
+ - ai@5.0.0-beta.6
496
+
497
+ ## 1.0.0-beta.5
498
+
499
+ ### Patch Changes
500
+
501
+ - Updated dependencies [4f3e637]
502
+ - ai@5.0.0-beta.5
503
+
504
+ ## 1.0.0-beta.4
505
+
506
+ ### Patch Changes
507
+
508
+ - Updated dependencies [09f41ac]
509
+ - ai@5.0.0-beta.4
510
+
511
+ ## 1.0.0-beta.3
512
+
513
+ ### Patch Changes
514
+
515
+ - ai@5.0.0-beta.3
516
+
517
+ ## 1.0.0-beta.2
518
+
519
+ ### Patch Changes
520
+
521
+ - Updated dependencies [0d9583c]
522
+ - Updated dependencies [c6b64a7]
523
+ - Updated dependencies [cb3b9c9]
524
+ - Updated dependencies [d1a034f]
525
+ - ai@5.0.0-beta.2
526
+
527
+ ## 1.0.0-beta.1
528
+
529
+ ### Patch Changes
530
+
531
+ - Updated dependencies [d88455d]
532
+ - Updated dependencies [9ad0484]
533
+ - Updated dependencies [4048ce3]
534
+ - Updated dependencies [f2b041e]
535
+ - Updated dependencies [cb68df0]
536
+ - Updated dependencies [26695a3]
537
+ - Updated dependencies [e7d2ce3]
538
+ - Updated dependencies [102b066]
539
+ - Updated dependencies [e862b5b]
540
+ - Updated dependencies [7bd025b]
541
+ - ai@5.0.0-beta.1
542
+
543
+ ## 1.0.0-alpha.15
544
+
545
+ ### Patch Changes
546
+
547
+ - Updated dependencies [b1e3abd]
548
+ - Updated dependencies [04d5063]
549
+ - Updated dependencies [b4b4bb2]
550
+ - Updated dependencies [d884051]
551
+ - Updated dependencies [954aa73]
552
+ - Updated dependencies [142576e]
553
+ - Updated dependencies [395c85e]
554
+ - Updated dependencies [60e2c56]
555
+ - ai@5.0.0-alpha.15
556
+
557
+ ## 1.0.0-alpha.14
558
+
559
+ ### Patch Changes
560
+
561
+ - Updated dependencies [63f9e9b]
562
+ - ai@5.0.0-alpha.14
563
+
564
+ ## 1.0.0-alpha.13
565
+
566
+ ### Patch Changes
567
+
568
+ - Updated dependencies [0a710d8]
569
+ - Updated dependencies [6a83f7d]
570
+ - Updated dependencies [1f55c21]
571
+ - Updated dependencies [33eb499]
572
+ - Updated dependencies [901df02]
573
+ - ai@5.0.0-alpha.13
574
+
575
+ ## 1.0.0-alpha.12
576
+
577
+ ### Patch Changes
578
+
579
+ - Updated dependencies [da1e6f0]
580
+ - Updated dependencies [4892798]
581
+ - ai@5.0.0-alpha.12
582
+
583
+ ## 1.0.0-alpha.11
584
+
585
+ ### Patch Changes
586
+
587
+ - Updated dependencies [e8324c5]
588
+ - ai@5.0.0-alpha.11
589
+
590
+ ## 1.0.0-alpha.10
591
+
592
+ ### Patch Changes
593
+
594
+ - Updated dependencies [98f25e5]
595
+ - Updated dependencies [7bb58d4]
596
+ - ai@5.0.0-alpha.10
597
+
598
+ ## 1.0.0-alpha.9
599
+
600
+ ### Patch Changes
601
+
602
+ - Updated dependencies [8255639]
603
+ - Updated dependencies [9ae327d]
604
+ - ai@5.0.0-alpha.9
605
+
606
+ ## 1.0.0-alpha.8
607
+
608
+ ### Patch Changes
609
+
610
+ - Updated dependencies [4fef487]
611
+ - Updated dependencies [6b1c55c]
612
+ - Updated dependencies [2e4f9e4]
613
+ - Updated dependencies [c25cbce]
614
+ - ai@5.0.0-alpha.8
615
+
616
+ ## 1.0.0-alpha.7
617
+
618
+ ### Patch Changes
619
+
620
+ - Updated dependencies [db345da]
621
+ - Updated dependencies [9b0da33]
622
+ - Updated dependencies [247ee0c]
623
+ - ai@5.0.0-alpha.7
624
+
625
+ ## 1.0.0-alpha.6
626
+
627
+ ### Patch Changes
628
+
629
+ - Updated dependencies [0d2c085]
630
+ - Updated dependencies [48a7606]
631
+ - ai@5.0.0-alpha.6
632
+
633
+ ## 1.0.0-alpha.5
634
+
635
+ ### Patch Changes
636
+
637
+ - Updated dependencies [655cf3c]
638
+ - Updated dependencies [1675396]
639
+ - Updated dependencies [cf9af6e]
640
+ - Updated dependencies [ef256ed]
641
+ - Updated dependencies [1ed0287]
642
+ - Updated dependencies [825e8d7]
643
+ - Updated dependencies [7324c21]
644
+ - ai@5.0.0-alpha.5
645
+
646
+ ## 1.0.0-alpha.4
647
+
648
+ ### Patch Changes
649
+
650
+ - Updated dependencies [b32c141]
651
+ - Updated dependencies [72d7d72]
652
+ - Updated dependencies [9315076]
653
+ - Updated dependencies [7d97ab6]
654
+ - Updated dependencies [37a916d]
655
+ - Updated dependencies [5f2b3d4]
656
+ - ai@5.0.0-alpha.4
657
+
658
+ ## 1.0.0-alpha.3
659
+
660
+ ### Patch Changes
661
+
662
+ - Updated dependencies [ab7ccef]
663
+ - Updated dependencies [257224b]
664
+ - Updated dependencies [0463011]
665
+ - Updated dependencies [d306260]
666
+ - ai@5.0.0-alpha.3
667
+
668
+ ## 1.0.0-alpha.2
669
+
670
+ ### Patch Changes
671
+
672
+ - Updated dependencies [82aa95d]
673
+ - ai@5.0.0-alpha.2
674
+
675
+ ## 1.0.0-alpha.1
676
+
677
+ ### Patch Changes
678
+
679
+ - Updated dependencies [b346545]
680
+ - Updated dependencies [109c0ac]
681
+ - ai@5.0.0-alpha.1
682
+
683
+ ## 1.0.0-canary.12
684
+
685
+ ### Patch Changes
686
+
687
+ - Updated dependencies [bedb239]
688
+ - Updated dependencies [507ac1d]
689
+ - Updated dependencies [2b9bbcd]
690
+ - Updated dependencies [f7e8bf4]
691
+ - Updated dependencies [cda32ba]
692
+ - Updated dependencies [50f0362]
693
+ - Updated dependencies [ed675de]
694
+ - Updated dependencies [64f6d64]
695
+ - ai@5.0.0-canary.24
696
+
697
+ ## 1.0.0-canary.11
698
+
699
+ ### Patch Changes
700
+
701
+ - Updated dependencies [40acf9b]
702
+ - ai@5.0.0-canary.23
703
+
704
+ ## 1.0.0-canary.10
705
+
706
+ ### Patch Changes
707
+
708
+ - Updated dependencies [e7dc6c7]
709
+ - Updated dependencies [a34eb39]
710
+ - Updated dependencies [b33ed7a]
711
+ - Updated dependencies [765f1cd]
712
+ - ai@5.0.0-canary.22
713
+
3
714
  ## 1.0.0-canary.9
4
715
 
5
716
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -1,3 +1,5 @@
1
+ import { UIMessageChunk } from 'ai';
2
+
1
3
  /**
2
4
  * Configuration options and helper callback methods for stream lifecycle events.
3
5
  */
@@ -44,89 +46,6 @@ The following streams are supported:
44
46
  - `LangChainAIMessageChunk` streams (LangChain `model.stream` output)
45
47
  - `string` streams (LangChain `StringOutputParser` output)
46
48
  */
47
- declare function toDataStream(stream: ReadableStream<LangChainStreamEvent> | ReadableStream<LangChainAIMessageChunk> | ReadableStream<string>, callbacks?: StreamCallbacks): ReadableStream<{
48
- type: "text";
49
- value: string;
50
- } | {
51
- type: "error";
52
- value: string;
53
- } | {
54
- type: "tool-call";
55
- value: {
56
- toolCallId: string;
57
- toolName: string;
58
- args?: unknown;
59
- };
60
- } | {
61
- type: "tool-result";
62
- value: {
63
- toolCallId: string;
64
- result?: unknown;
65
- providerMetadata?: any;
66
- };
67
- } | {
68
- type: "tool-call-streaming-start";
69
- value: {
70
- toolCallId: string;
71
- toolName: string;
72
- };
73
- } | {
74
- type: "tool-call-delta";
75
- value: {
76
- toolCallId: string;
77
- argsTextDelta: string;
78
- };
79
- } | {
80
- type: "reasoning";
81
- value: {
82
- text: string;
83
- providerMetadata?: Record<string, any> | undefined;
84
- };
85
- } | {
86
- type: "source";
87
- value: {
88
- type: "source";
89
- sourceType: "url";
90
- url: string;
91
- id: string;
92
- providerMetadata?: any;
93
- title?: string | undefined;
94
- };
95
- } | {
96
- type: "file";
97
- value: {
98
- url: string;
99
- mediaType: string;
100
- };
101
- } | {
102
- type: "metadata";
103
- value: {
104
- metadata?: unknown;
105
- };
106
- } | {
107
- type: "start-step";
108
- value: {
109
- metadata?: unknown;
110
- };
111
- } | {
112
- type: "finish-step";
113
- value: {
114
- metadata?: unknown;
115
- };
116
- } | {
117
- type: "start";
118
- value: {
119
- metadata?: unknown;
120
- messageId?: string | undefined;
121
- };
122
- } | {
123
- type: "finish";
124
- value: {
125
- metadata?: unknown;
126
- };
127
- } | {
128
- type: "reasoning-part-finish";
129
- value: null;
130
- }>;
49
+ declare function toUIMessageStream(stream: ReadableStream<LangChainStreamEvent> | ReadableStream<LangChainAIMessageChunk> | ReadableStream<string>, callbacks?: StreamCallbacks): ReadableStream<UIMessageChunk>;
131
50
 
132
- export { toDataStream };
51
+ export { toUIMessageStream };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { UIMessageChunk } from 'ai';
2
+
1
3
  /**
2
4
  * Configuration options and helper callback methods for stream lifecycle events.
3
5
  */
@@ -44,89 +46,6 @@ The following streams are supported:
44
46
  - `LangChainAIMessageChunk` streams (LangChain `model.stream` output)
45
47
  - `string` streams (LangChain `StringOutputParser` output)
46
48
  */
47
- declare function toDataStream(stream: ReadableStream<LangChainStreamEvent> | ReadableStream<LangChainAIMessageChunk> | ReadableStream<string>, callbacks?: StreamCallbacks): ReadableStream<{
48
- type: "text";
49
- value: string;
50
- } | {
51
- type: "error";
52
- value: string;
53
- } | {
54
- type: "tool-call";
55
- value: {
56
- toolCallId: string;
57
- toolName: string;
58
- args?: unknown;
59
- };
60
- } | {
61
- type: "tool-result";
62
- value: {
63
- toolCallId: string;
64
- result?: unknown;
65
- providerMetadata?: any;
66
- };
67
- } | {
68
- type: "tool-call-streaming-start";
69
- value: {
70
- toolCallId: string;
71
- toolName: string;
72
- };
73
- } | {
74
- type: "tool-call-delta";
75
- value: {
76
- toolCallId: string;
77
- argsTextDelta: string;
78
- };
79
- } | {
80
- type: "reasoning";
81
- value: {
82
- text: string;
83
- providerMetadata?: Record<string, any> | undefined;
84
- };
85
- } | {
86
- type: "source";
87
- value: {
88
- type: "source";
89
- sourceType: "url";
90
- url: string;
91
- id: string;
92
- providerMetadata?: any;
93
- title?: string | undefined;
94
- };
95
- } | {
96
- type: "file";
97
- value: {
98
- url: string;
99
- mediaType: string;
100
- };
101
- } | {
102
- type: "metadata";
103
- value: {
104
- metadata?: unknown;
105
- };
106
- } | {
107
- type: "start-step";
108
- value: {
109
- metadata?: unknown;
110
- };
111
- } | {
112
- type: "finish-step";
113
- value: {
114
- metadata?: unknown;
115
- };
116
- } | {
117
- type: "start";
118
- value: {
119
- metadata?: unknown;
120
- messageId?: string | undefined;
121
- };
122
- } | {
123
- type: "finish";
124
- value: {
125
- metadata?: unknown;
126
- };
127
- } | {
128
- type: "reasoning-part-finish";
129
- value: null;
130
- }>;
49
+ declare function toUIMessageStream(stream: ReadableStream<LangChainStreamEvent> | ReadableStream<LangChainAIMessageChunk> | ReadableStream<string>, callbacks?: StreamCallbacks): ReadableStream<UIMessageChunk>;
131
50
 
132
- export { toDataStream };
51
+ export { toUIMessageStream };
package/dist/index.js CHANGED
@@ -20,7 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var src_exports = {};
22
22
  __export(src_exports, {
23
- toDataStream: () => toDataStream
23
+ toUIMessageStream: () => toUIMessageStream
24
24
  });
25
25
  module.exports = __toCommonJS(src_exports);
26
26
 
@@ -48,7 +48,7 @@ function createCallbacksTransformer(callbacks = {}) {
48
48
  }
49
49
 
50
50
  // src/langchain-adapter.ts
51
- function toDataStream(stream, callbacks) {
51
+ function toUIMessageStream(stream, callbacks) {
52
52
  return stream.pipeThrough(
53
53
  new TransformStream({
54
54
  transform: async (value, controller) => {
@@ -71,8 +71,14 @@ function toDataStream(stream, callbacks) {
71
71
  })
72
72
  ).pipeThrough(createCallbacksTransformer(callbacks)).pipeThrough(
73
73
  new TransformStream({
74
+ start: async (controller) => {
75
+ controller.enqueue({ type: "text-start", id: "1" });
76
+ },
74
77
  transform: async (chunk, controller) => {
75
- controller.enqueue({ type: "text", value: chunk });
78
+ controller.enqueue({ type: "text-delta", delta: chunk, id: "1" });
79
+ },
80
+ flush: async (controller) => {
81
+ controller.enqueue({ type: "text-end", id: "1" });
76
82
  }
77
83
  })
78
84
  );
@@ -91,6 +97,6 @@ function forwardAIMessageChunk(chunk, controller) {
91
97
  }
92
98
  // Annotate the CommonJS export names for ESM import in node:
93
99
  0 && (module.exports = {
94
- toDataStream
100
+ toUIMessageStream
95
101
  });
96
102
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/stream-callbacks.ts","../src/langchain-adapter.ts"],"sourcesContent":["export * from './langchain-adapter';\n","/**\n * Configuration options and helper callback methods for stream lifecycle events.\n */\nexport interface StreamCallbacks {\n /** `onStart`: Called once when the stream is initialized. */\n onStart?: () => Promise<void> | void;\n\n /** `onFinal`: Called once when the stream is closed with the final completion message. */\n onFinal?: (completion: string) => Promise<void> | void;\n\n /** `onToken`: Called for each tokenized message. */\n onToken?: (token: string) => Promise<void> | void;\n\n /** `onText`: Called for each text chunk. */\n onText?: (text: string) => Promise<void> | void;\n}\n\n/**\n * Creates a transform stream that encodes input messages and invokes optional callback functions.\n * The transform stream uses the provided callbacks to execute custom logic at different stages of the stream's lifecycle.\n * - `onStart`: Called once when the stream is initialized.\n * - `onToken`: Called for each tokenized message.\n * - `onFinal`: Called once when the stream is closed with the final completion message.\n *\n * This function is useful when you want to process a stream of messages and perform specific actions during the stream's lifecycle.\n *\n * @param {StreamCallbacks} [callbacks] - An object containing the callback functions.\n * @return {TransformStream<string, Uint8Array>} A transform stream that encodes input messages as Uint8Array and allows the execution of custom logic through callbacks.\n *\n * @example\n * const callbacks = {\n * onStart: async () => console.log('Stream started'),\n * onToken: async (token) => console.log(`Token: ${token}`),\n * onFinal: async () => data.close()\n * };\n * const transformer = createCallbacksTransformer(callbacks);\n */\nexport function createCallbacksTransformer(\n callbacks: StreamCallbacks | undefined = {},\n): TransformStream<string, string> {\n let aggregatedResponse = '';\n\n return new TransformStream({\n async start(): Promise<void> {\n if (callbacks.onStart) await callbacks.onStart();\n },\n\n async transform(message, controller): Promise<void> {\n controller.enqueue(message);\n\n aggregatedResponse += message;\n\n if (callbacks.onToken) await callbacks.onToken(message);\n if (callbacks.onText && typeof message === 'string') {\n await callbacks.onText(message);\n }\n },\n\n async flush(): Promise<void> {\n if (callbacks.onFinal) {\n await callbacks.onFinal(aggregatedResponse);\n }\n },\n });\n}\n","import { DataStreamPart } from 'ai';\nimport {\n createCallbacksTransformer,\n StreamCallbacks,\n} from './stream-callbacks';\n\ntype LangChainImageDetail = 'auto' | 'low' | 'high';\n\ntype LangChainMessageContentText = {\n type: 'text';\n text: string;\n};\n\ntype LangChainMessageContentImageUrl = {\n type: 'image_url';\n image_url:\n | string\n | {\n url: string;\n detail?: LangChainImageDetail;\n };\n};\n\ntype LangChainMessageContentComplex =\n | LangChainMessageContentText\n | LangChainMessageContentImageUrl\n | (Record<string, any> & {\n type?: 'text' | 'image_url' | string;\n })\n | (Record<string, any> & {\n type?: never;\n });\n\ntype LangChainMessageContent = string | LangChainMessageContentComplex[];\n\ntype LangChainAIMessageChunk = {\n content: LangChainMessageContent;\n};\n\n// LC stream event v2\ntype LangChainStreamEvent = {\n event: string;\n data: any;\n};\n\n/**\nConverts LangChain output streams to an AI SDK Data Stream.\n\nThe following streams are supported:\n- `LangChainAIMessageChunk` streams (LangChain `model.stream` output)\n- `string` streams (LangChain `StringOutputParser` output)\n */\nexport function toDataStream(\n stream:\n | ReadableStream<LangChainStreamEvent>\n | ReadableStream<LangChainAIMessageChunk>\n | ReadableStream<string>,\n callbacks?: StreamCallbacks,\n) {\n return stream\n .pipeThrough(\n new TransformStream<\n LangChainStreamEvent | LangChainAIMessageChunk | string\n >({\n transform: async (value, controller) => {\n // text stream:\n if (typeof value === 'string') {\n controller.enqueue(value);\n return;\n }\n\n // LC stream events v2:\n if ('event' in value) {\n // chunk is AIMessage Chunk for on_chat_model_stream event:\n if (value.event === 'on_chat_model_stream') {\n forwardAIMessageChunk(\n value.data?.chunk as LangChainAIMessageChunk,\n controller,\n );\n }\n return;\n }\n\n // AI Message chunk stream:\n forwardAIMessageChunk(value, controller);\n },\n }),\n )\n .pipeThrough(createCallbacksTransformer(callbacks))\n .pipeThrough(\n new TransformStream<string, DataStreamPart>({\n transform: async (chunk, controller) => {\n controller.enqueue({ type: 'text', value: chunk });\n },\n }),\n );\n}\n\nfunction forwardAIMessageChunk(\n chunk: LangChainAIMessageChunk,\n controller: TransformStreamDefaultController<any>,\n) {\n if (typeof chunk.content === 'string') {\n controller.enqueue(chunk.content);\n } else {\n const content: LangChainMessageContentComplex[] = chunk.content;\n for (const item of content) {\n if (item.type === 'text') {\n controller.enqueue(item.text);\n }\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACqCO,SAAS,2BACd,YAAyC,CAAC,GACT;AACjC,MAAI,qBAAqB;AAEzB,SAAO,IAAI,gBAAgB;AAAA,IACzB,MAAM,QAAuB;AAC3B,UAAI,UAAU,QAAS,OAAM,UAAU,QAAQ;AAAA,IACjD;AAAA,IAEA,MAAM,UAAU,SAAS,YAA2B;AAClD,iBAAW,QAAQ,OAAO;AAE1B,4BAAsB;AAEtB,UAAI,UAAU,QAAS,OAAM,UAAU,QAAQ,OAAO;AACtD,UAAI,UAAU,UAAU,OAAO,YAAY,UAAU;AACnD,cAAM,UAAU,OAAO,OAAO;AAAA,MAChC;AAAA,IACF;AAAA,IAEA,MAAM,QAAuB;AAC3B,UAAI,UAAU,SAAS;AACrB,cAAM,UAAU,QAAQ,kBAAkB;AAAA,MAC5C;AAAA,IACF;AAAA,EACF,CAAC;AACH;;;ACZO,SAAS,aACd,QAIA,WACA;AACA,SAAO,OACJ;AAAA,IACC,IAAI,gBAEF;AAAA,MACA,WAAW,OAAO,OAAO,eAAe;AAhEhD;AAkEU,YAAI,OAAO,UAAU,UAAU;AAC7B,qBAAW,QAAQ,KAAK;AACxB;AAAA,QACF;AAGA,YAAI,WAAW,OAAO;AAEpB,cAAI,MAAM,UAAU,wBAAwB;AAC1C;AAAA,eACE,WAAM,SAAN,mBAAY;AAAA,cACZ;AAAA,YACF;AAAA,UACF;AACA;AAAA,QACF;AAGA,8BAAsB,OAAO,UAAU;AAAA,MACzC;AAAA,IACF,CAAC;AAAA,EACH,EACC,YAAY,2BAA2B,SAAS,CAAC,EACjD;AAAA,IACC,IAAI,gBAAwC;AAAA,MAC1C,WAAW,OAAO,OAAO,eAAe;AACtC,mBAAW,QAAQ,EAAE,MAAM,QAAQ,OAAO,MAAM,CAAC;AAAA,MACnD;AAAA,IACF,CAAC;AAAA,EACH;AACJ;AAEA,SAAS,sBACP,OACA,YACA;AACA,MAAI,OAAO,MAAM,YAAY,UAAU;AACrC,eAAW,QAAQ,MAAM,OAAO;AAAA,EAClC,OAAO;AACL,UAAM,UAA4C,MAAM;AACxD,eAAW,QAAQ,SAAS;AAC1B,UAAI,KAAK,SAAS,QAAQ;AACxB,mBAAW,QAAQ,KAAK,IAAI;AAAA,MAC9B;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts","../src/stream-callbacks.ts","../src/langchain-adapter.ts"],"sourcesContent":["export * from './langchain-adapter';\n","/**\n * Configuration options and helper callback methods for stream lifecycle events.\n */\nexport interface StreamCallbacks {\n /** `onStart`: Called once when the stream is initialized. */\n onStart?: () => Promise<void> | void;\n\n /** `onFinal`: Called once when the stream is closed with the final completion message. */\n onFinal?: (completion: string) => Promise<void> | void;\n\n /** `onToken`: Called for each tokenized message. */\n onToken?: (token: string) => Promise<void> | void;\n\n /** `onText`: Called for each text chunk. */\n onText?: (text: string) => Promise<void> | void;\n}\n\n/**\n * Creates a transform stream that encodes input messages and invokes optional callback functions.\n * The transform stream uses the provided callbacks to execute custom logic at different stages of the stream's lifecycle.\n * - `onStart`: Called once when the stream is initialized.\n * - `onToken`: Called for each tokenized message.\n * - `onFinal`: Called once when the stream is closed with the final completion message.\n *\n * This function is useful when you want to process a stream of messages and perform specific actions during the stream's lifecycle.\n *\n * @param {StreamCallbacks} [callbacks] - An object containing the callback functions.\n * @return {TransformStream<string, Uint8Array>} A transform stream that encodes input messages as Uint8Array and allows the execution of custom logic through callbacks.\n *\n * @example\n * const callbacks = {\n * onStart: async () => console.log('Stream started'),\n * onToken: async (token) => console.log(`Token: ${token}`),\n * onFinal: async () => data.close()\n * };\n * const transformer = createCallbacksTransformer(callbacks);\n */\nexport function createCallbacksTransformer(\n callbacks: StreamCallbacks | undefined = {},\n): TransformStream<string, string> {\n let aggregatedResponse = '';\n\n return new TransformStream({\n async start(): Promise<void> {\n if (callbacks.onStart) await callbacks.onStart();\n },\n\n async transform(message, controller): Promise<void> {\n controller.enqueue(message);\n\n aggregatedResponse += message;\n\n if (callbacks.onToken) await callbacks.onToken(message);\n if (callbacks.onText && typeof message === 'string') {\n await callbacks.onText(message);\n }\n },\n\n async flush(): Promise<void> {\n if (callbacks.onFinal) {\n await callbacks.onFinal(aggregatedResponse);\n }\n },\n });\n}\n","import { UIMessageChunk } from 'ai';\nimport {\n createCallbacksTransformer,\n StreamCallbacks,\n} from './stream-callbacks';\n\ntype LangChainImageDetail = 'auto' | 'low' | 'high';\n\ntype LangChainMessageContentText = {\n type: 'text';\n text: string;\n};\n\ntype LangChainMessageContentImageUrl = {\n type: 'image_url';\n image_url:\n | string\n | {\n url: string;\n detail?: LangChainImageDetail;\n };\n};\n\ntype LangChainMessageContentComplex =\n | LangChainMessageContentText\n | LangChainMessageContentImageUrl\n | (Record<string, any> & {\n type?: 'text' | 'image_url' | string;\n })\n | (Record<string, any> & {\n type?: never;\n });\n\ntype LangChainMessageContent = string | LangChainMessageContentComplex[];\n\ntype LangChainAIMessageChunk = {\n content: LangChainMessageContent;\n};\n\n// LC stream event v2\ntype LangChainStreamEvent = {\n event: string;\n data: any;\n};\n\n/**\nConverts LangChain output streams to an AI SDK Data Stream.\n\nThe following streams are supported:\n- `LangChainAIMessageChunk` streams (LangChain `model.stream` output)\n- `string` streams (LangChain `StringOutputParser` output)\n */\nexport function toUIMessageStream(\n stream:\n | ReadableStream<LangChainStreamEvent>\n | ReadableStream<LangChainAIMessageChunk>\n | ReadableStream<string>,\n callbacks?: StreamCallbacks,\n) {\n return stream\n .pipeThrough(\n new TransformStream<\n LangChainStreamEvent | LangChainAIMessageChunk | string\n >({\n transform: async (value, controller) => {\n // text stream:\n if (typeof value === 'string') {\n controller.enqueue(value);\n return;\n }\n\n // LC stream events v2:\n if ('event' in value) {\n // chunk is AIMessage Chunk for on_chat_model_stream event:\n if (value.event === 'on_chat_model_stream') {\n forwardAIMessageChunk(\n value.data?.chunk as LangChainAIMessageChunk,\n controller,\n );\n }\n return;\n }\n\n // AI Message chunk stream:\n forwardAIMessageChunk(value, controller);\n },\n }),\n )\n .pipeThrough(createCallbacksTransformer(callbacks))\n .pipeThrough(\n new TransformStream<string, UIMessageChunk>({\n start: async controller => {\n controller.enqueue({ type: 'text-start', id: '1' });\n },\n transform: async (chunk, controller) => {\n controller.enqueue({ type: 'text-delta', delta: chunk, id: '1' });\n },\n flush: async controller => {\n controller.enqueue({ type: 'text-end', id: '1' });\n },\n }),\n );\n}\n\nfunction forwardAIMessageChunk(\n chunk: LangChainAIMessageChunk,\n controller: TransformStreamDefaultController<any>,\n) {\n if (typeof chunk.content === 'string') {\n controller.enqueue(chunk.content);\n } else {\n const content: LangChainMessageContentComplex[] = chunk.content;\n for (const item of content) {\n if (item.type === 'text') {\n controller.enqueue(item.text);\n }\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACqCO,SAAS,2BACd,YAAyC,CAAC,GACT;AACjC,MAAI,qBAAqB;AAEzB,SAAO,IAAI,gBAAgB;AAAA,IACzB,MAAM,QAAuB;AAC3B,UAAI,UAAU,QAAS,OAAM,UAAU,QAAQ;AAAA,IACjD;AAAA,IAEA,MAAM,UAAU,SAAS,YAA2B;AAClD,iBAAW,QAAQ,OAAO;AAE1B,4BAAsB;AAEtB,UAAI,UAAU,QAAS,OAAM,UAAU,QAAQ,OAAO;AACtD,UAAI,UAAU,UAAU,OAAO,YAAY,UAAU;AACnD,cAAM,UAAU,OAAO,OAAO;AAAA,MAChC;AAAA,IACF;AAAA,IAEA,MAAM,QAAuB;AAC3B,UAAI,UAAU,SAAS;AACrB,cAAM,UAAU,QAAQ,kBAAkB;AAAA,MAC5C;AAAA,IACF;AAAA,EACF,CAAC;AACH;;;ACZO,SAAS,kBACd,QAIA,WACA;AACA,SAAO,OACJ;AAAA,IACC,IAAI,gBAEF;AAAA,MACA,WAAW,OAAO,OAAO,eAAe;AAhEhD;AAkEU,YAAI,OAAO,UAAU,UAAU;AAC7B,qBAAW,QAAQ,KAAK;AACxB;AAAA,QACF;AAGA,YAAI,WAAW,OAAO;AAEpB,cAAI,MAAM,UAAU,wBAAwB;AAC1C;AAAA,eACE,WAAM,SAAN,mBAAY;AAAA,cACZ;AAAA,YACF;AAAA,UACF;AACA;AAAA,QACF;AAGA,8BAAsB,OAAO,UAAU;AAAA,MACzC;AAAA,IACF,CAAC;AAAA,EACH,EACC,YAAY,2BAA2B,SAAS,CAAC,EACjD;AAAA,IACC,IAAI,gBAAwC;AAAA,MAC1C,OAAO,OAAM,eAAc;AACzB,mBAAW,QAAQ,EAAE,MAAM,cAAc,IAAI,IAAI,CAAC;AAAA,MACpD;AAAA,MACA,WAAW,OAAO,OAAO,eAAe;AACtC,mBAAW,QAAQ,EAAE,MAAM,cAAc,OAAO,OAAO,IAAI,IAAI,CAAC;AAAA,MAClE;AAAA,MACA,OAAO,OAAM,eAAc;AACzB,mBAAW,QAAQ,EAAE,MAAM,YAAY,IAAI,IAAI,CAAC;AAAA,MAClD;AAAA,IACF,CAAC;AAAA,EACH;AACJ;AAEA,SAAS,sBACP,OACA,YACA;AACA,MAAI,OAAO,MAAM,YAAY,UAAU;AACrC,eAAW,QAAQ,MAAM,OAAO;AAAA,EAClC,OAAO;AACL,UAAM,UAA4C,MAAM;AACxD,eAAW,QAAQ,SAAS;AAC1B,UAAI,KAAK,SAAS,QAAQ;AACxB,mBAAW,QAAQ,KAAK,IAAI;AAAA,MAC9B;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
package/dist/index.mjs CHANGED
@@ -22,7 +22,7 @@ function createCallbacksTransformer(callbacks = {}) {
22
22
  }
23
23
 
24
24
  // src/langchain-adapter.ts
25
- function toDataStream(stream, callbacks) {
25
+ function toUIMessageStream(stream, callbacks) {
26
26
  return stream.pipeThrough(
27
27
  new TransformStream({
28
28
  transform: async (value, controller) => {
@@ -45,8 +45,14 @@ function toDataStream(stream, callbacks) {
45
45
  })
46
46
  ).pipeThrough(createCallbacksTransformer(callbacks)).pipeThrough(
47
47
  new TransformStream({
48
+ start: async (controller) => {
49
+ controller.enqueue({ type: "text-start", id: "1" });
50
+ },
48
51
  transform: async (chunk, controller) => {
49
- controller.enqueue({ type: "text", value: chunk });
52
+ controller.enqueue({ type: "text-delta", delta: chunk, id: "1" });
53
+ },
54
+ flush: async (controller) => {
55
+ controller.enqueue({ type: "text-end", id: "1" });
50
56
  }
51
57
  })
52
58
  );
@@ -64,6 +70,6 @@ function forwardAIMessageChunk(chunk, controller) {
64
70
  }
65
71
  }
66
72
  export {
67
- toDataStream
73
+ toUIMessageStream
68
74
  };
69
75
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/stream-callbacks.ts","../src/langchain-adapter.ts"],"sourcesContent":["/**\n * Configuration options and helper callback methods for stream lifecycle events.\n */\nexport interface StreamCallbacks {\n /** `onStart`: Called once when the stream is initialized. */\n onStart?: () => Promise<void> | void;\n\n /** `onFinal`: Called once when the stream is closed with the final completion message. */\n onFinal?: (completion: string) => Promise<void> | void;\n\n /** `onToken`: Called for each tokenized message. */\n onToken?: (token: string) => Promise<void> | void;\n\n /** `onText`: Called for each text chunk. */\n onText?: (text: string) => Promise<void> | void;\n}\n\n/**\n * Creates a transform stream that encodes input messages and invokes optional callback functions.\n * The transform stream uses the provided callbacks to execute custom logic at different stages of the stream's lifecycle.\n * - `onStart`: Called once when the stream is initialized.\n * - `onToken`: Called for each tokenized message.\n * - `onFinal`: Called once when the stream is closed with the final completion message.\n *\n * This function is useful when you want to process a stream of messages and perform specific actions during the stream's lifecycle.\n *\n * @param {StreamCallbacks} [callbacks] - An object containing the callback functions.\n * @return {TransformStream<string, Uint8Array>} A transform stream that encodes input messages as Uint8Array and allows the execution of custom logic through callbacks.\n *\n * @example\n * const callbacks = {\n * onStart: async () => console.log('Stream started'),\n * onToken: async (token) => console.log(`Token: ${token}`),\n * onFinal: async () => data.close()\n * };\n * const transformer = createCallbacksTransformer(callbacks);\n */\nexport function createCallbacksTransformer(\n callbacks: StreamCallbacks | undefined = {},\n): TransformStream<string, string> {\n let aggregatedResponse = '';\n\n return new TransformStream({\n async start(): Promise<void> {\n if (callbacks.onStart) await callbacks.onStart();\n },\n\n async transform(message, controller): Promise<void> {\n controller.enqueue(message);\n\n aggregatedResponse += message;\n\n if (callbacks.onToken) await callbacks.onToken(message);\n if (callbacks.onText && typeof message === 'string') {\n await callbacks.onText(message);\n }\n },\n\n async flush(): Promise<void> {\n if (callbacks.onFinal) {\n await callbacks.onFinal(aggregatedResponse);\n }\n },\n });\n}\n","import { DataStreamPart } from 'ai';\nimport {\n createCallbacksTransformer,\n StreamCallbacks,\n} from './stream-callbacks';\n\ntype LangChainImageDetail = 'auto' | 'low' | 'high';\n\ntype LangChainMessageContentText = {\n type: 'text';\n text: string;\n};\n\ntype LangChainMessageContentImageUrl = {\n type: 'image_url';\n image_url:\n | string\n | {\n url: string;\n detail?: LangChainImageDetail;\n };\n};\n\ntype LangChainMessageContentComplex =\n | LangChainMessageContentText\n | LangChainMessageContentImageUrl\n | (Record<string, any> & {\n type?: 'text' | 'image_url' | string;\n })\n | (Record<string, any> & {\n type?: never;\n });\n\ntype LangChainMessageContent = string | LangChainMessageContentComplex[];\n\ntype LangChainAIMessageChunk = {\n content: LangChainMessageContent;\n};\n\n// LC stream event v2\ntype LangChainStreamEvent = {\n event: string;\n data: any;\n};\n\n/**\nConverts LangChain output streams to an AI SDK Data Stream.\n\nThe following streams are supported:\n- `LangChainAIMessageChunk` streams (LangChain `model.stream` output)\n- `string` streams (LangChain `StringOutputParser` output)\n */\nexport function toDataStream(\n stream:\n | ReadableStream<LangChainStreamEvent>\n | ReadableStream<LangChainAIMessageChunk>\n | ReadableStream<string>,\n callbacks?: StreamCallbacks,\n) {\n return stream\n .pipeThrough(\n new TransformStream<\n LangChainStreamEvent | LangChainAIMessageChunk | string\n >({\n transform: async (value, controller) => {\n // text stream:\n if (typeof value === 'string') {\n controller.enqueue(value);\n return;\n }\n\n // LC stream events v2:\n if ('event' in value) {\n // chunk is AIMessage Chunk for on_chat_model_stream event:\n if (value.event === 'on_chat_model_stream') {\n forwardAIMessageChunk(\n value.data?.chunk as LangChainAIMessageChunk,\n controller,\n );\n }\n return;\n }\n\n // AI Message chunk stream:\n forwardAIMessageChunk(value, controller);\n },\n }),\n )\n .pipeThrough(createCallbacksTransformer(callbacks))\n .pipeThrough(\n new TransformStream<string, DataStreamPart>({\n transform: async (chunk, controller) => {\n controller.enqueue({ type: 'text', value: chunk });\n },\n }),\n );\n}\n\nfunction forwardAIMessageChunk(\n chunk: LangChainAIMessageChunk,\n controller: TransformStreamDefaultController<any>,\n) {\n if (typeof chunk.content === 'string') {\n controller.enqueue(chunk.content);\n } else {\n const content: LangChainMessageContentComplex[] = chunk.content;\n for (const item of content) {\n if (item.type === 'text') {\n controller.enqueue(item.text);\n }\n }\n }\n}\n"],"mappings":";AAqCO,SAAS,2BACd,YAAyC,CAAC,GACT;AACjC,MAAI,qBAAqB;AAEzB,SAAO,IAAI,gBAAgB;AAAA,IACzB,MAAM,QAAuB;AAC3B,UAAI,UAAU,QAAS,OAAM,UAAU,QAAQ;AAAA,IACjD;AAAA,IAEA,MAAM,UAAU,SAAS,YAA2B;AAClD,iBAAW,QAAQ,OAAO;AAE1B,4BAAsB;AAEtB,UAAI,UAAU,QAAS,OAAM,UAAU,QAAQ,OAAO;AACtD,UAAI,UAAU,UAAU,OAAO,YAAY,UAAU;AACnD,cAAM,UAAU,OAAO,OAAO;AAAA,MAChC;AAAA,IACF;AAAA,IAEA,MAAM,QAAuB;AAC3B,UAAI,UAAU,SAAS;AACrB,cAAM,UAAU,QAAQ,kBAAkB;AAAA,MAC5C;AAAA,IACF;AAAA,EACF,CAAC;AACH;;;ACZO,SAAS,aACd,QAIA,WACA;AACA,SAAO,OACJ;AAAA,IACC,IAAI,gBAEF;AAAA,MACA,WAAW,OAAO,OAAO,eAAe;AAhEhD;AAkEU,YAAI,OAAO,UAAU,UAAU;AAC7B,qBAAW,QAAQ,KAAK;AACxB;AAAA,QACF;AAGA,YAAI,WAAW,OAAO;AAEpB,cAAI,MAAM,UAAU,wBAAwB;AAC1C;AAAA,eACE,WAAM,SAAN,mBAAY;AAAA,cACZ;AAAA,YACF;AAAA,UACF;AACA;AAAA,QACF;AAGA,8BAAsB,OAAO,UAAU;AAAA,MACzC;AAAA,IACF,CAAC;AAAA,EACH,EACC,YAAY,2BAA2B,SAAS,CAAC,EACjD;AAAA,IACC,IAAI,gBAAwC;AAAA,MAC1C,WAAW,OAAO,OAAO,eAAe;AACtC,mBAAW,QAAQ,EAAE,MAAM,QAAQ,OAAO,MAAM,CAAC;AAAA,MACnD;AAAA,IACF,CAAC;AAAA,EACH;AACJ;AAEA,SAAS,sBACP,OACA,YACA;AACA,MAAI,OAAO,MAAM,YAAY,UAAU;AACrC,eAAW,QAAQ,MAAM,OAAO;AAAA,EAClC,OAAO;AACL,UAAM,UAA4C,MAAM;AACxD,eAAW,QAAQ,SAAS;AAC1B,UAAI,KAAK,SAAS,QAAQ;AACxB,mBAAW,QAAQ,KAAK,IAAI;AAAA,MAC9B;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/stream-callbacks.ts","../src/langchain-adapter.ts"],"sourcesContent":["/**\n * Configuration options and helper callback methods for stream lifecycle events.\n */\nexport interface StreamCallbacks {\n /** `onStart`: Called once when the stream is initialized. */\n onStart?: () => Promise<void> | void;\n\n /** `onFinal`: Called once when the stream is closed with the final completion message. */\n onFinal?: (completion: string) => Promise<void> | void;\n\n /** `onToken`: Called for each tokenized message. */\n onToken?: (token: string) => Promise<void> | void;\n\n /** `onText`: Called for each text chunk. */\n onText?: (text: string) => Promise<void> | void;\n}\n\n/**\n * Creates a transform stream that encodes input messages and invokes optional callback functions.\n * The transform stream uses the provided callbacks to execute custom logic at different stages of the stream's lifecycle.\n * - `onStart`: Called once when the stream is initialized.\n * - `onToken`: Called for each tokenized message.\n * - `onFinal`: Called once when the stream is closed with the final completion message.\n *\n * This function is useful when you want to process a stream of messages and perform specific actions during the stream's lifecycle.\n *\n * @param {StreamCallbacks} [callbacks] - An object containing the callback functions.\n * @return {TransformStream<string, Uint8Array>} A transform stream that encodes input messages as Uint8Array and allows the execution of custom logic through callbacks.\n *\n * @example\n * const callbacks = {\n * onStart: async () => console.log('Stream started'),\n * onToken: async (token) => console.log(`Token: ${token}`),\n * onFinal: async () => data.close()\n * };\n * const transformer = createCallbacksTransformer(callbacks);\n */\nexport function createCallbacksTransformer(\n callbacks: StreamCallbacks | undefined = {},\n): TransformStream<string, string> {\n let aggregatedResponse = '';\n\n return new TransformStream({\n async start(): Promise<void> {\n if (callbacks.onStart) await callbacks.onStart();\n },\n\n async transform(message, controller): Promise<void> {\n controller.enqueue(message);\n\n aggregatedResponse += message;\n\n if (callbacks.onToken) await callbacks.onToken(message);\n if (callbacks.onText && typeof message === 'string') {\n await callbacks.onText(message);\n }\n },\n\n async flush(): Promise<void> {\n if (callbacks.onFinal) {\n await callbacks.onFinal(aggregatedResponse);\n }\n },\n });\n}\n","import { UIMessageChunk } from 'ai';\nimport {\n createCallbacksTransformer,\n StreamCallbacks,\n} from './stream-callbacks';\n\ntype LangChainImageDetail = 'auto' | 'low' | 'high';\n\ntype LangChainMessageContentText = {\n type: 'text';\n text: string;\n};\n\ntype LangChainMessageContentImageUrl = {\n type: 'image_url';\n image_url:\n | string\n | {\n url: string;\n detail?: LangChainImageDetail;\n };\n};\n\ntype LangChainMessageContentComplex =\n | LangChainMessageContentText\n | LangChainMessageContentImageUrl\n | (Record<string, any> & {\n type?: 'text' | 'image_url' | string;\n })\n | (Record<string, any> & {\n type?: never;\n });\n\ntype LangChainMessageContent = string | LangChainMessageContentComplex[];\n\ntype LangChainAIMessageChunk = {\n content: LangChainMessageContent;\n};\n\n// LC stream event v2\ntype LangChainStreamEvent = {\n event: string;\n data: any;\n};\n\n/**\nConverts LangChain output streams to an AI SDK Data Stream.\n\nThe following streams are supported:\n- `LangChainAIMessageChunk` streams (LangChain `model.stream` output)\n- `string` streams (LangChain `StringOutputParser` output)\n */\nexport function toUIMessageStream(\n stream:\n | ReadableStream<LangChainStreamEvent>\n | ReadableStream<LangChainAIMessageChunk>\n | ReadableStream<string>,\n callbacks?: StreamCallbacks,\n) {\n return stream\n .pipeThrough(\n new TransformStream<\n LangChainStreamEvent | LangChainAIMessageChunk | string\n >({\n transform: async (value, controller) => {\n // text stream:\n if (typeof value === 'string') {\n controller.enqueue(value);\n return;\n }\n\n // LC stream events v2:\n if ('event' in value) {\n // chunk is AIMessage Chunk for on_chat_model_stream event:\n if (value.event === 'on_chat_model_stream') {\n forwardAIMessageChunk(\n value.data?.chunk as LangChainAIMessageChunk,\n controller,\n );\n }\n return;\n }\n\n // AI Message chunk stream:\n forwardAIMessageChunk(value, controller);\n },\n }),\n )\n .pipeThrough(createCallbacksTransformer(callbacks))\n .pipeThrough(\n new TransformStream<string, UIMessageChunk>({\n start: async controller => {\n controller.enqueue({ type: 'text-start', id: '1' });\n },\n transform: async (chunk, controller) => {\n controller.enqueue({ type: 'text-delta', delta: chunk, id: '1' });\n },\n flush: async controller => {\n controller.enqueue({ type: 'text-end', id: '1' });\n },\n }),\n );\n}\n\nfunction forwardAIMessageChunk(\n chunk: LangChainAIMessageChunk,\n controller: TransformStreamDefaultController<any>,\n) {\n if (typeof chunk.content === 'string') {\n controller.enqueue(chunk.content);\n } else {\n const content: LangChainMessageContentComplex[] = chunk.content;\n for (const item of content) {\n if (item.type === 'text') {\n controller.enqueue(item.text);\n }\n }\n }\n}\n"],"mappings":";AAqCO,SAAS,2BACd,YAAyC,CAAC,GACT;AACjC,MAAI,qBAAqB;AAEzB,SAAO,IAAI,gBAAgB;AAAA,IACzB,MAAM,QAAuB;AAC3B,UAAI,UAAU,QAAS,OAAM,UAAU,QAAQ;AAAA,IACjD;AAAA,IAEA,MAAM,UAAU,SAAS,YAA2B;AAClD,iBAAW,QAAQ,OAAO;AAE1B,4BAAsB;AAEtB,UAAI,UAAU,QAAS,OAAM,UAAU,QAAQ,OAAO;AACtD,UAAI,UAAU,UAAU,OAAO,YAAY,UAAU;AACnD,cAAM,UAAU,OAAO,OAAO;AAAA,MAChC;AAAA,IACF;AAAA,IAEA,MAAM,QAAuB;AAC3B,UAAI,UAAU,SAAS;AACrB,cAAM,UAAU,QAAQ,kBAAkB;AAAA,MAC5C;AAAA,IACF;AAAA,EACF,CAAC;AACH;;;ACZO,SAAS,kBACd,QAIA,WACA;AACA,SAAO,OACJ;AAAA,IACC,IAAI,gBAEF;AAAA,MACA,WAAW,OAAO,OAAO,eAAe;AAhEhD;AAkEU,YAAI,OAAO,UAAU,UAAU;AAC7B,qBAAW,QAAQ,KAAK;AACxB;AAAA,QACF;AAGA,YAAI,WAAW,OAAO;AAEpB,cAAI,MAAM,UAAU,wBAAwB;AAC1C;AAAA,eACE,WAAM,SAAN,mBAAY;AAAA,cACZ;AAAA,YACF;AAAA,UACF;AACA;AAAA,QACF;AAGA,8BAAsB,OAAO,UAAU;AAAA,MACzC;AAAA,IACF,CAAC;AAAA,EACH,EACC,YAAY,2BAA2B,SAAS,CAAC,EACjD;AAAA,IACC,IAAI,gBAAwC;AAAA,MAC1C,OAAO,OAAM,eAAc;AACzB,mBAAW,QAAQ,EAAE,MAAM,cAAc,IAAI,IAAI,CAAC;AAAA,MACpD;AAAA,MACA,WAAW,OAAO,OAAO,eAAe;AACtC,mBAAW,QAAQ,EAAE,MAAM,cAAc,OAAO,OAAO,IAAI,IAAI,CAAC;AAAA,MAClE;AAAA,MACA,OAAO,OAAM,eAAc;AACzB,mBAAW,QAAQ,EAAE,MAAM,YAAY,IAAI,IAAI,CAAC;AAAA,MAClD;AAAA,IACF,CAAC;AAAA,EACH;AACJ;AAEA,SAAS,sBACP,OACA,YACA;AACA,MAAI,OAAO,MAAM,YAAY,UAAU;AACrC,eAAW,QAAQ,MAAM,OAAO;AAAA,EAClC,OAAO;AACL,UAAM,UAA4C,MAAM;AACxD,eAAW,QAAQ,SAAS;AAC1B,UAAI,KAAK,SAAS,QAAQ;AACxB,mBAAW,QAAQ,KAAK,IAAI;AAAA,MAC9B;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/langchain",
3
- "version": "1.0.0-canary.9",
3
+ "version": "1.0.1",
4
4
  "license": "Apache-2.0",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/index.js",
@@ -19,7 +19,7 @@
19
19
  }
20
20
  },
21
21
  "dependencies": {
22
- "ai": "5.0.0-canary.21"
22
+ "ai": "5.0.1"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@types/node": "20.17.24",