File size: 58,995 Bytes
31e8457
689aa9f
31e8457
689aa9f
 
 
 
 
 
31e8457
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
689aa9f
 
31e8457
 
 
689aa9f
 
31e8457
 
 
 
 
 
 
 
 
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
689aa9f
 
31e8457
 
689aa9f
31e8457
 
 
689aa9f
 
 
31e8457
689aa9f
31e8457
 
 
689aa9f
 
31e8457
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
 
 
 
689aa9f
 
31e8457
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
689aa9f
 
31e8457
 
 
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
689aa9f
 
31e8457
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
689aa9f
 
31e8457
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
689aa9f
 
31e8457
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
 
 
 
 
689aa9f
 
31e8457
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
689aa9f
31e8457
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
689aa9f
 
31e8457
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
689aa9f
 
 
31e8457
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
689aa9f
 
31e8457
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
689aa9f
 
31e8457
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
689aa9f
 
31e8457
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
 
 
 
 
689aa9f
 
31e8457
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
689aa9f
31e8457
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
689aa9f
 
31e8457
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
689aa9f
 
31e8457
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
689aa9f
 
31e8457
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
 
689aa9f
 
31e8457
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
 
 
 
 
689aa9f
 
31e8457
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
689aa9f
 
31e8457
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
689aa9f
 
31e8457
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
689aa9f
 
31e8457
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
689aa9f
 
31e8457
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
689aa9f
 
31e8457
 
 
 
689aa9f
 
31e8457
 
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
 
 
 
689aa9f
 
31e8457
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
689aa9f
 
31e8457
 
 
 
 
 
 
 
689aa9f
 
31e8457
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
 
 
689aa9f
 
31e8457
 
 
 
689aa9f
 
31e8457
 
 
 
 
 
 
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
 
 
 
 
689aa9f
 
31e8457
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
689aa9f
 
31e8457
 
689aa9f
 
31e8457
 
 
 
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
 
 
 
 
689aa9f
 
31e8457
 
 
 
 
 
689aa9f
 
 
 
 
31e8457
689aa9f
31e8457
 
 
 
 
 
 
 
 
689aa9f
 
31e8457
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
689aa9f
 
31e8457
 
 
 
 
 
689aa9f
 
 
 
 
 
 
 
 
 
 
 
 
 
31e8457
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
 
689aa9f
 
31e8457
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
689aa9f
 
31e8457
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
 
 
689aa9f
 
31e8457
 
 
 
689aa9f
 
31e8457
 
 
 
 
 
 
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
689aa9f
 
31e8457
 
 
 
689aa9f
 
31e8457
 
 
 
 
 
 
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
689aa9f
 
31e8457
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
689aa9f
 
31e8457
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
 
 
689aa9f
 
31e8457
 
 
 
 
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
 
689aa9f
 
 
 
 
 
 
 
31e8457
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
689aa9f
 
31e8457
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
689aa9f
 
31e8457
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
689aa9f
 
31e8457
 
 
 
689aa9f
 
 
 
 
 
31e8457
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
689aa9f
 
31e8457
 
 
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
689aa9f
 
31e8457
 
 
 
 
 
689aa9f
 
 
 
 
 
 
 
 
 
31e8457
689aa9f
31e8457
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
/**
 * Defines a shared data model for AI model output.
 *
 * Responses are represented as typed parts so different providers can expose
 * text, reasoning, tool calls, files, sources, metadata, finish information, and
 * errors through one shape. The same model is used for complete responses and
 * streaming responses, where start, delta, and end parts describe content as it
 * arrives. This module also carries provider metadata and schemas used by tools
 * that need to validate response parts.
 *
 * @since 4.0.0
 */
import type * as DateTime from "../../DateTime.ts";
import * as Schema from "../../Schema.ts";
import type * as Tool from "./Tool.ts";
import type * as Toolkit from "./Toolkit.ts";
declare const PartTypeId: "~effect/ai/Content/Part";
/**
 * Type guard to check if a value is a Response Part.
 *
 * @category guards
 * @since 4.0.0
 */
export declare const isPart: (u: unknown) => u is AnyPart;
/**
 * Union type representing all possible response content parts.
 *
 * @category models
 * @since 4.0.0
 */
export type AnyPart = TextPart | TextStartPart | TextDeltaPart | TextEndPart | ReasoningPart | ReasoningStartPart | ReasoningDeltaPart | ReasoningEndPart | ToolParamsStartPart | ToolParamsDeltaPart | ToolParamsEndPart | ToolCallPart<any, any> | ToolResultPart<any, any, any> | ToolApprovalRequestPart | FilePart | DocumentSourcePart | UrlSourcePart | ResponseMetadataPart | FinishPart | ErrorPart;
/**
 * Encoded representation of all possible response content parts for serialization.
 *
 * @category models
 * @since 4.0.0
 */
export type AnyPartEncoded = TextPartEncoded | TextStartPartEncoded | TextDeltaPartEncoded | TextEndPartEncoded | ReasoningPartEncoded | ReasoningStartPartEncoded | ReasoningDeltaPartEncoded | ReasoningEndPartEncoded | ToolParamsStartPartEncoded | ToolParamsDeltaPartEncoded | ToolParamsEndPartEncoded | ToolCallPartEncoded | ToolResultPartEncoded | ToolApprovalRequestPartEncoded | FilePartEncoded | DocumentSourcePartEncoded | UrlSourcePartEncoded | ResponseMetadataPartEncoded | FinishPartEncoded | ErrorPartEncoded;
/**
 * Union type for all response parts with tool-specific typing.
 *
 * @category models
 * @since 4.0.0
 */
export type AllParts<Tools extends Record<string, Tool.Any>> = TextPart | TextStartPart | TextDeltaPart | TextEndPart | ReasoningPart | ReasoningStartPart | ReasoningDeltaPart | ReasoningEndPart | ToolParamsStartPart | ToolParamsDeltaPart | ToolParamsEndPart | ToolCallParts<Tools> | ToolResultParts<Tools> | ToolApprovalRequestPart | FilePart | DocumentSourcePart | UrlSourcePart | ResponseMetadataPart | FinishPart | ErrorPart;
/**
 * Encoded representation of all response parts for serialization.
 *
 * @category models
 * @since 4.0.0
 */
export type AllPartsEncoded = TextPartEncoded | TextStartPartEncoded | TextDeltaPartEncoded | TextEndPartEncoded | ReasoningPartEncoded | ReasoningStartPartEncoded | ReasoningDeltaPartEncoded | ReasoningEndPartEncoded | ToolParamsStartPartEncoded | ToolParamsDeltaPartEncoded | ToolParamsEndPartEncoded | ToolCallPartEncoded | ToolResultPartEncoded | ToolApprovalRequestPartEncoded | FilePartEncoded | DocumentSourcePartEncoded | UrlSourcePartEncoded | ResponseMetadataPartEncoded | FinishPartEncoded | ErrorPartEncoded;
/**
 * Creates a Schema for all response parts based on a toolkit.
 *
 * **Details**
 *
 * Generates a schema that includes all possible response parts, with tool call
 * and tool result parts dynamically created based on the provided toolkit.
 *
 * **Example** (Building a response parts schema)
 *
 * ```ts
 * import { Schema } from "effect"
 * import { Response, Tool, Toolkit } from "effect/unstable/ai"
 *
 * const myToolkit = Toolkit.make(
 *   Tool.make("GetWeather", {
 *     parameters: Schema.Struct({ city: Schema.String }),
 *     success: Schema.Struct({ temperature: Schema.Number })
 *   })
 * )
 *
 * const allPartsSchema = Response.AllParts(myToolkit)
 * ```
 *
 * @category schemas
 * @since 4.0.0
 */
export declare const AllParts: <T extends Toolkit.Any | Toolkit.WithHandler<any>>(toolkit: T) => Schema.Codec<AllParts<T extends Toolkit.Any ? Toolkit.Tools<T> : Toolkit.WithHandlerTools<T>>, AllPartsEncoded, Tool.ResultDecodingServices<Toolkit.Tools<T>[keyof Toolkit.Tools<T>]>, Tool.ResultEncodingServices<Toolkit.Tools<T>[keyof Toolkit.Tools<T>]>>;
/**
 * A type for representing non-streaming response parts with tool-specific
 * typing.
 *
 * @category models
 * @since 4.0.0
 */
export type Part<Tools extends Record<string, Tool.Any>> = TextPart | ReasoningPart | ToolCallParts<Tools> | ToolResultParts<Tools> | ToolApprovalRequestPart | FilePart | DocumentSourcePart | UrlSourcePart | ResponseMetadataPart | FinishPart;
/**
 * Encoded representation of non-streaming response parts for serialization.
 *
 * @category models
 * @since 4.0.0
 */
export type PartEncoded = TextPartEncoded | ReasoningPartEncoded | ReasoningDeltaPartEncoded | ReasoningEndPartEncoded | ToolCallPartEncoded | ToolResultPartEncoded | ToolApprovalRequestPartEncoded | FilePartEncoded | DocumentSourcePartEncoded | UrlSourcePartEncoded | ResponseMetadataPartEncoded | FinishPartEncoded;
/**
 * Creates a Schema for non-streaming response parts based on a toolkit.
 *
 * @category schemas
 * @since 4.0.0
 */
export declare const Part: <T extends Toolkit.Any | Toolkit.WithHandler<any>>(toolkit: T) => Schema.Codec<Part<T extends Toolkit.Any ? Toolkit.Tools<T> : Toolkit.WithHandlerTools<T>>, PartEncoded, Tool.ResultDecodingServices<Toolkit.Tools<T>[keyof Toolkit.Tools<T>]>, Tool.ResultEncodingServices<Toolkit.Tools<T>[keyof Toolkit.Tools<T>]>>;
/**
 * A type for representing streaming response parts with tool-specific typing.
 *
 * @category models
 * @since 4.0.0
 */
export type StreamPart<Tools extends Record<string, Tool.Any>> = TextStartPart | TextDeltaPart | TextEndPart | ReasoningStartPart | ReasoningDeltaPart | ReasoningEndPart | ToolParamsStartPart | ToolParamsDeltaPart | ToolParamsEndPart | ToolCallParts<Tools> | ToolResultParts<Tools> | ToolApprovalRequestPart | FilePart | DocumentSourcePart | UrlSourcePart | ResponseMetadataPart | FinishPart | ErrorPart;
/**
 * Encoded representation of streaming response parts for serialization.
 *
 * @category models
 * @since 4.0.0
 */
export type StreamPartEncoded = TextStartPartEncoded | TextDeltaPartEncoded | TextEndPartEncoded | ReasoningStartPartEncoded | ReasoningDeltaPartEncoded | ReasoningEndPartEncoded | ToolParamsStartPartEncoded | ToolParamsDeltaPartEncoded | ToolParamsEndPartEncoded | ToolCallPartEncoded | ToolResultPartEncoded | ToolApprovalRequestPartEncoded | FilePartEncoded | DocumentSourcePartEncoded | UrlSourcePartEncoded | ResponseMetadataPartEncoded | FinishPartEncoded | ErrorPartEncoded;
/**
 * Creates a Schema for streaming response parts based on a toolkit.
 *
 * @category schemas
 * @since 4.0.0
 */
export declare const StreamPart: <T extends Toolkit.Any | Toolkit.WithHandler<any>>(toolkit: T) => Schema.Codec<StreamPart<T extends Toolkit.Any ? Toolkit.Tools<T> : Toolkit.WithHandlerTools<T>>, StreamPartEncoded, Tool.ResultDecodingServices<Toolkit.Tools<T>[keyof Toolkit.Tools<T>]>, Tool.ResultEncodingServices<Toolkit.Tools<T>[keyof Toolkit.Tools<T>]>>;
/**
 * Utility type that extracts tool call parts from a set of tools.
 *
 * @category utility types
 * @since 4.0.0
 */
export type ToolCallParts<Tools extends Record<string, Tool.Any>> = {
    [Name in keyof Tools]: Name extends string ? ToolCallPart<Name, Tool.Parameters<Tools[Name]>> : never;
}[keyof Tools];
/**
 * Utility type that extracts tool result parts from a set of tools.
 *
 * @category utility types
 * @since 4.0.0
 */
export type ToolResultParts<Tools extends Record<string, Tool.Any>> = {
    [Name in keyof Tools]: Name extends string ? ToolResultPart<Name, Tool.Success<Tools[Name]>, Tool.FailureResult<Tools[Name]>> : never;
}[keyof Tools];
/**
 * Schema for provider-specific metadata attached to response parts,
 * represented as a record from provider-specific keys to JSON values or `null`.
 *
 * @category schemas
 * @since 4.0.0
 */
export declare const ProviderMetadata: Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>;
/**
 * Type of provider-specific metadata attached to response parts, keyed by
 * provider-specific names with JSON or `null` values.
 *
 * @category models
 * @since 4.0.0
 */
export type ProviderMetadata = typeof ProviderMetadata.Type;
/**
 * Base interface for all response content parts, including the type identifier
 * and optional metadata.
 *
 * @category models
 * @since 4.0.0
 */
export interface BasePart<Type extends string, Metadata extends ProviderMetadata> {
    readonly [PartTypeId]: typeof PartTypeId;
    /**
     * The type of this response part.
     */
    readonly type: Type;
    /**
     * Optional provider-specific metadata for this part.
     */
    readonly metadata: Metadata;
}
/**
 * Base interface for encoded response content parts.
 *
 * @category models
 * @since 4.0.0
 */
export interface BasePartEncoded<Type extends string, Metadata extends ProviderMetadata> {
    /**
     * The type of this response part.
     */
    readonly type: Type;
    /**
     * Optional provider-specific metadata for this part.
     */
    readonly metadata?: Metadata | undefined;
}
/**
 * Creates a new response content part of the specified type.
 *
 * **Example** (Creating response content parts)
 *
 * ```ts
 * import { Response } from "effect/unstable/ai"
 *
 * const textPart = Response.makePart("text", {
 *   text: "Hello, world!"
 * })
 *
 * const toolCallPart = Response.makePart("tool-call", {
 *   id: "call_123",
 *   name: "get_weather",
 *   params: { city: "San Francisco" },
 *   providerExecuted: false
 * })
 * ```
 *
 * @category constructors
 * @since 4.0.0
 */
export declare const makePart: <const Type extends AnyPart["type"]>(
/**
 * The type of part to create.
 */
type: Type, 
/**
 * Parameters specific to the part type being created.
 */
params: Omit<Extract<AnyPart, {
    type: Type;
}>, typeof PartTypeId | "type" | "metadata"> & {
    /**
     * Optional provider-specific metadata for this part.
     */
    readonly metadata?: Extract<AnyPart, {
        type: Type;
    }>["metadata"] | undefined;
}) => Extract<AnyPart, {
    type: Type;
}>;
/**
 * A utility type for specifying the parameters required to construct a
 * specific response part.
 *
 * @category utility types
 * @since 4.0.0
 */
export type ConstructorParams<Part extends AnyPart> = Omit<Part, typeof PartTypeId | "type" | "sourceType" | "metadata"> & {
    /**
     * Optional provider-specific metadata for this part.
     */
    readonly metadata?: Part["metadata"] | undefined;
};
/**
 * Response part representing plain text content.
 *
 * **Example** (Creating a text part)
 *
 * ```ts
 * import { Response } from "effect/unstable/ai"
 *
 * const textPart: Response.TextPart = Response.makePart("text", {
 *   text: "The answer to your question is 42."
 * })
 * ```
 *
 * @category models
 * @since 4.0.0
 */
export interface TextPart extends BasePart<"text", TextPartMetadata> {
    /**
     * The text content.
     */
    readonly text: string;
}
/**
 * Encoded representation of text parts for serialization.
 *
 * @category models
 * @since 4.0.0
 */
export interface TextPartEncoded extends BasePartEncoded<"text", TextPartMetadata> {
    /**
     * The text content.
     */
    readonly text: string;
}
/**
 * Represents provider-specific metadata that can be associated with a
 * `TextPart` through module augmentation.
 *
 * @category configuration
 * @since 4.0.0
 */
export interface TextPartMetadata extends ProviderMetadata {
}
/**
 * Schema for validation and encoding of text parts.
 *
 * @category schemas
 * @since 4.0.0
 */
export declare const TextPart: Schema.Struct<{
    readonly type: Schema.tag<"text">;
    readonly text: Schema.String;
    readonly "~effect/ai/Content/Part": Schema.withDecodingDefaultKey<Schema.tag<"~effect/ai/Content/Part">>;
    readonly metadata: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.Codec<Schema.Json>>>;
}>;
/**
 * Response part indicating the start of streaming text content with a unique
 * text chunk identifier.
 *
 * @category models
 * @since 4.0.0
 */
export interface TextStartPart extends BasePart<"text-start", TextStartPartMetadata> {
    /**
     * Unique identifier for this text chunk.
     */
    readonly id: string;
}
/**
 * Encoded representation of text start parts for serialization.
 *
 * @category models
 * @since 4.0.0
 */
export interface TextStartPartEncoded extends BasePartEncoded<"text-start", TextStartPartMetadata> {
    /**
     * Unique identifier for this text chunk.
     */
    readonly id: string;
}
/**
 * Represents provider-specific metadata that can be associated with a
 * `TextStartPart` through module augmentation.
 *
 * @category configuration
 * @since 4.0.0
 */
export interface TextStartPartMetadata extends ProviderMetadata {
}
/**
 * Schema for validation and encoding of text start parts.
 *
 * @category schemas
 * @since 4.0.0
 */
export declare const TextStartPart: Schema.Struct<{
    readonly type: Schema.tag<"text-start">;
    readonly id: Schema.String;
    readonly "~effect/ai/Content/Part": Schema.withDecodingDefaultKey<Schema.tag<"~effect/ai/Content/Part">>;
    readonly metadata: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.Codec<Schema.Json>>>;
}>;
/**
 * Response part containing incremental text content to be added to the existing
 * text chunk with the same unique identifier.
 *
 * @category models
 * @since 4.0.0
 */
export interface TextDeltaPart extends BasePart<"text-delta", TextDeltaPartMetadata> {
    /**
     * Unique identifier matching the corresponding text chunk.
     */
    readonly id: string;
    /**
     * The incremental text content to add.
     */
    readonly delta: string;
}
/**
 * Encoded representation of text delta parts for serialization.
 *
 * @category models
 * @since 4.0.0
 */
export interface TextDeltaPartEncoded extends BasePartEncoded<"text-delta", TextDeltaPartMetadata> {
    /**
     * Unique identifier matching the corresponding text chunk.
     */
    readonly id: string;
    /**
     * The incremental text content to add.
     */
    readonly delta: string;
}
/**
 * Represents provider-specific metadata that can be associated with a
 * `TextDeltaPart` through module augmentation.
 *
 * @category configuration
 * @since 4.0.0
 */
export interface TextDeltaPartMetadata extends ProviderMetadata {
}
/**
 * Schema for validation and encoding of text delta parts.
 *
 * @category schemas
 * @since 4.0.0
 */
export declare const TextDeltaPart: Schema.Struct<{
    readonly type: Schema.tag<"text-delta">;
    readonly id: Schema.String;
    readonly delta: Schema.String;
    readonly "~effect/ai/Content/Part": Schema.withDecodingDefaultKey<Schema.tag<"~effect/ai/Content/Part">>;
    readonly metadata: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.Codec<Schema.Json>>>;
}>;
/**
 * Response part indicating the completion of a streaming text chunk.
 *
 * @category models
 * @since 4.0.0
 */
export interface TextEndPart extends BasePart<"text-end", TextEndPartMetadata> {
    /**
     * Unique identifier matching the corresponding text chunk.
     */
    readonly id: string;
}
/**
 * Encoded representation of text end parts for serialization.
 *
 * @category models
 * @since 4.0.0
 */
export interface TextEndPartEncoded extends BasePartEncoded<"text-end", TextEndPartMetadata> {
    /**
     * Unique identifier matching the corresponding text chunk.
     */
    readonly id: string;
}
/**
 * Represents provider-specific metadata that can be associated with a
 * `TextEndPart` through module augmentation.
 *
 * @category configuration
 * @since 4.0.0
 */
export interface TextEndPartMetadata extends ProviderMetadata {
}
/**
 * Schema for validation and encoding of text end parts.
 *
 * @category schemas
 * @since 4.0.0
 */
export declare const TextEndPart: Schema.Struct<{
    readonly type: Schema.tag<"text-end">;
    readonly id: Schema.String;
    readonly "~effect/ai/Content/Part": Schema.withDecodingDefaultKey<Schema.tag<"~effect/ai/Content/Part">>;
    readonly metadata: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.Codec<Schema.Json>>>;
}>;
/**
 * Response part carrying provider-supplied reasoning text, such as an exposed
 * reasoning summary or explanation. Do not assume it contains hidden
 * chain-of-thought.
 *
 * **Example** (Creating a reasoning part)
 *
 * ```ts
 * import { Response } from "effect/unstable/ai"
 *
 * const reasoningPart: Response.ReasoningPart = Response.makePart("reasoning", {
 *   text:
 *     "Let me think step by step: First I need to analyze the user's question..."
 * })
 * ```
 *
 * @category models
 * @since 4.0.0
 */
export interface ReasoningPart extends BasePart<"reasoning", ReasoningPartMetadata> {
    /**
     * The reasoning or thought process text.
     */
    readonly text: string;
}
/**
 * Encoded representation of reasoning parts for serialization.
 *
 * @category models
 * @since 4.0.0
 */
export interface ReasoningPartEncoded extends BasePartEncoded<"reasoning", ReasoningPartMetadata> {
    /**
     * The reasoning or thought process text.
     */
    readonly text: string;
}
/**
 * Represents provider-specific metadata that can be associated with a
 * `ReasoningPart` through module augmentation.
 *
 * @category configuration
 * @since 4.0.0
 */
export interface ReasoningPartMetadata extends ProviderMetadata {
}
/**
 * Schema for validation and encoding of reasoning parts.
 *
 * @category schemas
 * @since 4.0.0
 */
export declare const ReasoningPart: Schema.Struct<{
    readonly type: Schema.tag<"reasoning">;
    readonly text: Schema.String;
    readonly "~effect/ai/Content/Part": Schema.withDecodingDefaultKey<Schema.tag<"~effect/ai/Content/Part">>;
    readonly metadata: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.Codec<Schema.Json>>>;
}>;
/**
 * Response part indicating the start of streaming reasoning content with a
 * unique reasoning chunk identifier.
 *
 * @category models
 * @since 4.0.0
 */
export interface ReasoningStartPart extends BasePart<"reasoning-start", ReasoningStartPartMetadata> {
    /**
     * Unique identifier for this reasoning chunk.
     */
    readonly id: string;
}
/**
 * Encoded representation of reasoning start parts for serialization.
 *
 * @category models
 * @since 4.0.0
 */
export interface ReasoningStartPartEncoded extends BasePartEncoded<"reasoning-start", ReasoningStartPartMetadata> {
    /**
     * Unique identifier for this reasoning stream.
     */
    readonly id: string;
}
/**
 * Represents provider-specific metadata that can be associated with a
 * `ReasoningStartPart` through module augmentation.
 *
 * @category configuration
 * @since 4.0.0
 */
export interface ReasoningStartPartMetadata extends ProviderMetadata {
}
/**
 * Schema for validation and encoding of reasoning start parts.
 *
 * @category schemas
 * @since 4.0.0
 */
export declare const ReasoningStartPart: Schema.Struct<{
    readonly type: Schema.tag<"reasoning-start">;
    readonly id: Schema.String;
    readonly "~effect/ai/Content/Part": Schema.withDecodingDefaultKey<Schema.tag<"~effect/ai/Content/Part">>;
    readonly metadata: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.Codec<Schema.Json>>>;
}>;
/**
 * Response part containing incremental reasoning content to be added to the
 * existing chunk of reasoning text with the same unique identifier.
 *
 * @category models
 * @since 4.0.0
 */
export interface ReasoningDeltaPart extends BasePart<"reasoning-delta", ReasoningDeltaPartMetadata> {
    /**
     * Unique identifier matching the corresponding reasoning chunk.
     */
    readonly id: string;
    /**
     * The incremental reasoning content to add.
     */
    readonly delta: string;
}
/**
 * Encoded representation of reasoning delta parts for serialization.
 *
 * @category models
 * @since 4.0.0
 */
export interface ReasoningDeltaPartEncoded extends BasePartEncoded<"reasoning-delta", ReasoningDeltaPartMetadata> {
    /**
     * Unique identifier matching the corresponding reasoning chunk.
     */
    readonly id: string;
    /**
     * The incremental reasoning content to add.
     */
    readonly delta: string;
}
/**
 * Represents provider-specific metadata that can be associated with a
 * `ReasoningDeltaPart` through module augmentation.
 *
 * @category configuration
 * @since 4.0.0
 */
export interface ReasoningDeltaPartMetadata extends ProviderMetadata {
}
/**
 * Schema for validation and encoding of reasoning delta parts.
 *
 * @category schemas
 * @since 4.0.0
 */
export declare const ReasoningDeltaPart: Schema.Struct<{
    readonly type: Schema.tag<"reasoning-delta">;
    readonly id: Schema.String;
    readonly delta: Schema.String;
    readonly "~effect/ai/Content/Part": Schema.withDecodingDefaultKey<Schema.tag<"~effect/ai/Content/Part">>;
    readonly metadata: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.Codec<Schema.Json>>>;
}>;
/**
 * Response part indicating the completion of a streaming reasoning chunk.
 *
 * @category models
 * @since 4.0.0
 */
export interface ReasoningEndPart extends BasePart<"reasoning-end", ReasoningEndPartMetadata> {
    /**
     * Unique identifier matching the corresponding reasoning chunk.
     */
    readonly id: string;
}
/**
 * Encoded representation of reasoning end parts for serialization.
 *
 * @category models
 * @since 4.0.0
 */
export interface ReasoningEndPartEncoded extends BasePartEncoded<"reasoning-end", ReasoningEndPartMetadata> {
    /**
     * Unique identifier matching the corresponding reasoning chunk.
     */
    readonly id: string;
}
/**
 * Represents provider-specific metadata that can be associated with a
 * `ReasoningEndPart` through module augmentation.
 *
 * @category configuration
 * @since 4.0.0
 */
export interface ReasoningEndPartMetadata extends ProviderMetadata {
}
/**
 * Schema for validation and encoding of reasoning end parts.
 *
 * @category schemas
 * @since 4.0.0
 */
export declare const ReasoningEndPart: Schema.Struct<{
    readonly type: Schema.tag<"reasoning-end">;
    readonly id: Schema.String;
    readonly "~effect/ai/Content/Part": Schema.withDecodingDefaultKey<Schema.tag<"~effect/ai/Content/Part">>;
    readonly metadata: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.Codec<Schema.Json>>>;
}>;
/**
 * Response part indicating the start of streaming tool parameters.
 *
 * **Details**
 *
 * Marks the beginning of tool parameter streaming with metadata about the tool
 * call.
 *
 * @category models
 * @since 4.0.0
 */
export interface ToolParamsStartPart extends BasePart<"tool-params-start", ToolParamsStartPartMetadata> {
    /**
     * Unique identifier for this tool parameter chunk.
     */
    readonly id: string;
    /**
     * Name of the tool being called, which corresponds to the name of the tool
     * in the `Toolkit` included with the request.
     */
    readonly name: string;
    /**
     * Whether the tool was executed by the provider (true) or framework (false).
     */
    readonly providerExecuted: boolean;
}
/**
 * Encoded representation of tool params start parts for serialization.
 *
 * @category models
 * @since 4.0.0
 */
export interface ToolParamsStartPartEncoded extends BasePartEncoded<"tool-params-start", ToolParamsStartPartMetadata> {
    /**
     * Unique identifier for this tool parameter chunk.
     */
    readonly id: string;
    /**
     * Name of the tool being called, which corresponds to the name of the tool
     * in the `Toolkit` included with the request.
     */
    readonly name: string;
    /**
     * Whether the tool was executed by the provider (true) or framework (false).
     */
    readonly providerExecuted?: boolean;
}
/**
 * Represents provider-specific metadata that can be associated with a
 * `ToolParamsStartPart` through module augmentation.
 *
 * @category configuration
 * @since 4.0.0
 */
export interface ToolParamsStartPartMetadata extends ProviderMetadata {
}
/**
 * Schema for validation and encoding of tool params start parts.
 *
 * @category schemas
 * @since 4.0.0
 */
export declare const ToolParamsStartPart: Schema.Struct<{
    readonly type: Schema.tag<"tool-params-start">;
    readonly id: Schema.String;
    readonly name: Schema.String;
    readonly providerExecuted: Schema.withDecodingDefaultKey<Schema.Boolean>;
    readonly "~effect/ai/Content/Part": Schema.withDecodingDefaultKey<Schema.tag<"~effect/ai/Content/Part">>;
    readonly metadata: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.Codec<Schema.Json>>>;
}>;
/**
 * Response part containing incremental tool parameter content.
 *
 * **Details**
 *
 * Represents a chunk of tool parameters being streamed, containing the
 * incremental JSON content that forms the tool parameters.
 *
 * @category models
 * @since 4.0.0
 */
export interface ToolParamsDeltaPart extends BasePart<"tool-params-delta", ToolParamsDeltaPartMetadata> {
    /**
     * Unique identifier matching the corresponding tool parameter chunk.
     */
    readonly id: string;
    /**
     * The incremental parameter content (typically JSON fragment) to add.
     */
    readonly delta: string;
}
/**
 * Encoded representation of tool params delta parts for serialization.
 *
 * @category models
 * @since 4.0.0
 */
export interface ToolParamsDeltaPartEncoded extends BasePartEncoded<"tool-params-delta", ToolParamsDeltaPartMetadata> {
    /**
     * Unique identifier matching the corresponding tool parameter chunk.
     */
    readonly id: string;
    /**
     * The incremental parameter content (typically JSON fragment) to add.
     */
    readonly delta: string;
}
/**
 * Represents provider-specific metadata that can be associated with a
 * `ToolParamsDeltaPart` through module augmentation.
 *
 * @category configuration
 * @since 4.0.0
 */
export interface ToolParamsDeltaPartMetadata extends ProviderMetadata {
}
/**
 * Schema for validation and encoding of tool params delta parts.
 *
 * @category schemas
 * @since 4.0.0
 */
export declare const ToolParamsDeltaPart: Schema.Struct<{
    readonly type: Schema.tag<"tool-params-delta">;
    readonly id: Schema.String;
    readonly delta: Schema.String;
    readonly "~effect/ai/Content/Part": Schema.withDecodingDefaultKey<Schema.tag<"~effect/ai/Content/Part">>;
    readonly metadata: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.Codec<Schema.Json>>>;
}>;
/**
 * Response part indicating the end of streaming tool parameters.
 *
 * **Details**
 *
 * Marks the completion of a tool parameter stream, indicating that all
 * parameter data has been sent and the tool call is ready to be executed.
 *
 * @category models
 * @since 4.0.0
 */
export interface ToolParamsEndPart extends BasePart<"tool-params-end", ToolParamsEndPartMetadata> {
    /**
     * Unique identifier matching the corresponding tool parameter chunk.
     */
    readonly id: string;
}
/**
 * Encoded representation of tool params end parts for serialization.
 *
 * @category models
 * @since 4.0.0
 */
export interface ToolParamsEndPartEncoded extends BasePartEncoded<"tool-params-end", ToolParamsEndPartMetadata> {
    /**
     * Unique identifier matching the corresponding tool parameter stream.
     */
    readonly id: string;
}
/**
 * Represents provider-specific metadata that can be associated with a
 * `ToolParamsEndPart` through module augmentation.
 *
 * @category configuration
 * @since 4.0.0
 */
export interface ToolParamsEndPartMetadata extends ProviderMetadata {
}
/**
 * Schema for validation and encoding of tool params end parts.
 *
 * @category schemas
 * @since 4.0.0
 */
export declare const ToolParamsEndPart: Schema.Struct<{
    readonly type: Schema.tag<"tool-params-end">;
    readonly id: Schema.String;
    readonly "~effect/ai/Content/Part": Schema.withDecodingDefaultKey<Schema.tag<"~effect/ai/Content/Part">>;
    readonly metadata: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.Codec<Schema.Json>>>;
}>;
/**
 * Response part representing a tool call request.
 *
 * **Example** (Creating a tool call part)
 *
 * ```ts
 * import { Schema } from "effect"
 * import { Response } from "effect/unstable/ai"
 *
 * const weatherParams = Schema.Struct({
 *   city: Schema.String,
 *   units: Schema.optional(Schema.Literals(["celsius", "fahrenheit"]))
 * })
 *
 * const toolCallPart: Response.ToolCallPart<
 *   "get_weather",
 *   {
 *     readonly city: string
 *     readonly units?: "celsius" | "fahrenheit"
 *   }
 * > = Response.makePart("tool-call", {
 *   id: "call_123",
 *   name: "get_weather",
 *   params: { city: "San Francisco", units: "celsius" },
 *   providerExecuted: false
 * })
 * ```
 *
 * @category models
 * @since 4.0.0
 */
export interface ToolCallPart<Name extends string, Params> extends BasePart<"tool-call", ToolCallPartMetadata> {
    /**
     * Unique identifier for this tool call.
     */
    readonly id: string;
    /**
     * Name of the tool being called, which corresponds to the name of the tool
     * in the `Toolkit` included with the request.
     */
    readonly name: Name;
    /**
     * Parameters to pass to the tool.
     */
    readonly params: Params;
    /**
     * Whether the tool was executed by the provider (true) or framework (false).
     */
    readonly providerExecuted: boolean;
}
/**
 * Encoded representation of tool call parts for serialization.
 *
 * @category models
 * @since 4.0.0
 */
export interface ToolCallPartEncoded extends BasePartEncoded<"tool-call", ToolCallPartMetadata> {
    /**
     * Unique identifier for this tool call.
     */
    readonly id: string;
    /**
     * Name of the tool being called, which corresponds to the name of the tool
     * in the `Toolkit` included with the request.
     */
    readonly name: string;
    /**
     * Parameters to pass to the tool.
     */
    readonly params: unknown;
    /**
     * Whether the tool was executed by the provider (true) or framework (false).
     */
    readonly providerExecuted?: boolean | undefined;
}
/**
 * Represents provider-specific metadata that can be associated with a
 * `ToolCallPart` through module augmentation.
 *
 * @category configuration
 * @since 4.0.0
 */
export interface ToolCallPartMetadata extends ProviderMetadata {
}
/**
 * Creates a Schema for tool call parts with specific tool name and parameters.
 *
 * @category schemas
 * @since 4.0.0
 */
export declare const ToolCallPart: <const Name extends string, Params extends Schema.Top>(name: Name, params: Params) => Schema.Struct<{
    readonly type: Schema.Literal<"tool-call">;
    readonly id: Schema.String;
    readonly name: Schema.Literal<Name>;
    readonly params: Params;
    readonly providerExecuted: Schema.withDecodingDefaultKey<Schema.Boolean>;
    readonly "~effect/ai/Content/Part": Schema.withDecodingDefaultKey<Schema.tag<"~effect/ai/Content/Part">>;
    readonly metadata: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.Codec<Schema.Json>>>;
}>;
/**
 * Constructs a new tool call part.
 *
 * @category constructors
 * @since 4.0.0
 */
export declare const toolCallPart: <const Name extends string, Params>(params: ConstructorParams<ToolCallPart<Name, Params>>) => ToolCallPart<Name, Params>;
/**
 * The base fields of a tool result part.
 *
 * @category models
 * @since 4.0.0
 */
export interface BaseToolResult<Name extends string> extends BasePart<"tool-result", ToolResultPartMetadata> {
    /**
     * Unique identifier matching the original tool call.
     */
    readonly id: string;
    /**
     * Name of the tool being called, which corresponds to the name of the tool
     * in the `Toolkit` included with the request.
     */
    readonly name: Name;
    /**
     * The encoded result for serialization purposes.
     */
    readonly encodedResult: unknown;
    /**
     * Whether the tool was executed by the provider (true) or framework (false).
     */
    readonly providerExecuted: boolean;
    /**
     * Whether this is a preliminary (intermediate) result.
     *
     * **Details**
     *
     * Preliminary results represent progress updates during streaming tool
     * execution. Only the final result (where `preliminary` is `false` or
     * `undefined`) should be used as the authoritative output.
     *
     * **Gotchas**
     *
     * Only applicable for framework-executed tools during streaming.
     */
    readonly preliminary: boolean;
}
/**
 * Represents a successful tool call result.
 *
 * @category models
 * @since 4.0.0
 */
export interface ToolResultSuccess<Name extends string, Success> extends BaseToolResult<Name> {
    /**
     * The decoded success returned by the tool execution.
     */
    readonly result: Success;
    /**
     * Whether or not the result of executing the tool call handler was an error.
     */
    readonly isFailure: false;
}
/**
 * Represents a failed tool call result.
 *
 * @category models
 * @since 4.0.0
 */
export interface ToolResultFailure<Name extends string, Failure> extends BaseToolResult<Name> {
    /**
     * The decoded failure returned by the tool execution.
     */
    readonly result: Failure;
    /**
     * Whether or not the result of executing the tool call handler was an error.
     */
    readonly isFailure: true;
}
/**
 * Response part representing the result of a tool call.
 *
 * **Example** (Creating a tool result part)
 *
 * ```ts
 * import { Response } from "effect/unstable/ai"
 *
 * interface WeatherData {
 *   temperature: number
 *   condition: string
 *   humidity: number
 * }
 *
 * const toolResultPart: Response.ToolResultPart<
 *   "get_weather",
 *   WeatherData,
 *   never
 * > = Response.toolResultPart({
 *   id: "call_123",
 *   name: "get_weather",
 *   isFailure: false,
 *   result: {
 *     temperature: 22,
 *     condition: "sunny",
 *     humidity: 65
 *   },
 *   encodedResult: {
 *     temperature: 22,
 *     condition: "sunny",
 *     humidity: 65
 *   },
 *   providerExecuted: false,
 *   preliminary: false
 * })
 * ```
 *
 * @category models
 * @since 4.0.0
 */
export type ToolResultPart<Name extends string, Success, Failure> = ToolResultSuccess<Name, Success> | ToolResultFailure<Name, Failure>;
/**
 * Encoded representation of tool result parts for serialization.
 *
 * @category models
 * @since 4.0.0
 */
export interface ToolResultPartEncoded extends BasePartEncoded<"tool-result", ToolResultPartMetadata> {
    /**
     * Unique identifier matching the original tool call.
     */
    readonly id: string;
    /**
     * Name of the tool being called, which corresponds to the name of the tool
     * in the `Toolkit` included with the request.
     */
    readonly name: string;
    /**
     * The result returned by the tool execution.
     */
    readonly result: unknown;
    /**
     * Whether or not the result of executing the tool call handler was an error.
     */
    readonly isFailure: boolean;
    /**
     * Whether the tool was executed by the provider (true) or framework (false).
     */
    readonly providerExecuted?: boolean | undefined;
    /**
     * Whether this is a preliminary (intermediate) result.
     *
     * **Gotchas**
     *
     * Only applicable for framework-executed tools during streaming.
     */
    readonly preliminary?: boolean | undefined;
}
/**
 * Represents provider-specific metadata that can be associated with a
 * `ToolResultPart` through module augmentation.
 *
 * @category configuration
 * @since 4.0.0
 */
export interface ToolResultPartMetadata extends ProviderMetadata {
}
/**
 * Creates a Schema for tool result parts with specific tool name and result type.
 *
 * @category schemas
 * @since 4.0.0
 */
export declare const ToolResultPart: <const Name extends string, Success extends Schema.Top, Failure extends Schema.Top>(name: Name, success: Success, failure: Failure) => Schema.decodeTo<Schema.Struct<{
    readonly "~effect/ai/Content/Part": Schema.Literal<"~effect/ai/Content/Part">;
    readonly result: Schema.Union<readonly [Success, Failure]>;
    readonly providerExecuted: Schema.Boolean;
    readonly metadata: Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>;
    readonly encodedResult: Schema.toEncoded<Schema.Union<readonly [Success, Failure]>>;
    readonly preliminary: Schema.Boolean;
    readonly id: Schema.String;
    readonly type: Schema.Literal<"tool-result">;
    readonly isFailure: Schema.Boolean;
    readonly name: Schema.Literal<Name>;
}>, Schema.Struct<{
    readonly result: Schema.toEncoded<Schema.Union<readonly [Success, Failure]>>;
    readonly providerExecuted: Schema.optional<Schema.Boolean>;
    readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
    readonly preliminary: Schema.optional<Schema.Boolean>;
    readonly id: Schema.String;
    readonly type: Schema.Literal<"tool-result">;
    readonly isFailure: Schema.Boolean;
    readonly name: Schema.Literal<Name>;
}>>;
/**
 * Constructs a new tool result part.
 *
 * @category constructors
 * @since 4.0.0
 */
export declare const toolResultPart: <const Params extends ConstructorParams<ToolResultPart<string, unknown, unknown>>>(params: Params) => Params extends {
    readonly name: infer Name extends string;
    readonly isFailure: false;
    readonly result: infer Success;
} ? ToolResultPart<Name, Success, never> : Params extends {
    readonly name: infer Name extends string;
    readonly isFailure: true;
    readonly result: infer Failure;
} ? ToolResultPart<Name, never, Failure> : never;
/**
 * Response part representing a tool approval request.
 *
 * **Details**
 *
 * Emitted when a tool requires user approval before execution. The framework
 * checks the tool's `needsApproval` property and emits this part instead of
 * executing the tool when approval is required.
 *
 * **Example** (Creating an approval request part)
 *
 * ```ts
 * import { Response } from "effect/unstable/ai"
 *
 * const approvalRequest: Response.ToolApprovalRequestPart = Response.makePart(
 *   "tool-approval-request",
 *   {
 *     approvalId: "approval_123",
 *     toolCallId: "call_456"
 *   }
 * )
 * ```
 *
 * @category models
 * @since 4.0.0
 */
export interface ToolApprovalRequestPart extends BasePart<"tool-approval-request", ToolApprovalRequestPartMetadata> {
    /**
     * Unique identifier for this approval flow.
     */
    readonly approvalId: string;
    /**
     * The tool call ID requiring approval.
     */
    readonly toolCallId: string;
}
/**
 * Encoded representation of tool approval request parts for serialization.
 *
 * @category models
 * @since 4.0.0
 */
export interface ToolApprovalRequestPartEncoded extends BasePartEncoded<"tool-approval-request", ToolApprovalRequestPartMetadata> {
    /**
     * Unique identifier for this approval flow.
     */
    readonly approvalId: string;
    /**
     * The tool call ID requiring approval.
     */
    readonly toolCallId: string;
}
/**
 * Represents provider-specific metadata that can be associated with a
 * `ToolApprovalRequestPart` through module augmentation.
 *
 * @category configuration
 * @since 4.0.0
 */
export interface ToolApprovalRequestPartMetadata extends ProviderMetadata {
}
/**
 * Schema for validation and encoding of tool approval request parts.
 *
 * @category schemas
 * @since 4.0.0
 */
export declare const ToolApprovalRequestPart: Schema.Struct<{
    readonly type: Schema.tag<"tool-approval-request">;
    readonly approvalId: Schema.String;
    readonly toolCallId: Schema.String;
    readonly "~effect/ai/Content/Part": Schema.withDecodingDefaultKey<Schema.tag<"~effect/ai/Content/Part">>;
    readonly metadata: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.Codec<Schema.Json>>>;
}>;
/**
 * Constructs a new tool approval request part.
 *
 * @category constructors
 * @since 4.0.0
 */
export declare const toolApprovalRequestPart: (params: ConstructorParams<ToolApprovalRequestPart>) => ToolApprovalRequestPart;
/**
 * Response part representing a file attachment.
 *
 * **Details**
 *
 * Supports various file types including images, documents, and binary data.
 *
 * **Example** (Creating a file part)
 *
 * ```ts
 * import { Response } from "effect/unstable/ai"
 *
 * const imagePart: Response.FilePart = Response.makePart("file", {
 *   mediaType: "image/jpeg",
 *   data: new Uint8Array([1, 2, 3])
 * })
 * ```
 *
 * @category models
 * @since 4.0.0
 */
export interface FilePart extends BasePart<"file", FilePartMetadata> {
    /**
     * MIME type of the file (e.g., "image/jpeg", "application/pdf").
     */
    readonly mediaType: string;
    /**
     * File data as a byte array.
     */
    readonly data: Uint8Array;
}
/**
 * Encoded representation of file parts for serialization.
 *
 * @category models
 * @since 4.0.0
 */
export interface FilePartEncoded extends BasePartEncoded<"file", FilePartMetadata> {
    /**
     * MIME type of the file (e.g., "image/jpeg", "application/pdf").
     */
    readonly mediaType: string;
    /**
     * File data as a base64 string.
     */
    readonly data: string;
}
/**
 * Represents provider-specific metadata that can be associated with a
 * `FilePart` through module augmentation.
 *
 * @category configuration
 * @since 4.0.0
 */
export interface FilePartMetadata extends ProviderMetadata {
}
/**
 * Schema for validation and encoding of file parts.
 *
 * **Details**
 *
 * Decoded `data` is a `Uint8Array`; encoded `data` is a base64 string through
 * `Schema.Uint8ArrayFromBase64`.
 *
 * @category schemas
 * @since 4.0.0
 */
export declare const FilePart: Schema.Struct<{
    readonly type: Schema.tag<"file">;
    readonly mediaType: Schema.String;
    readonly data: Schema.Uint8ArrayFromBase64;
    readonly "~effect/ai/Content/Part": Schema.withDecodingDefaultKey<Schema.tag<"~effect/ai/Content/Part">>;
    readonly metadata: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.Codec<Schema.Json>>>;
}>;
/**
 * Response part representing a document source reference used in generating the
 * response.
 *
 * @category models
 * @since 4.0.0
 */
export interface DocumentSourcePart extends BasePart<"source", DocumentSourcePartMetadata> {
    /**
     * Type discriminator for document sources.
     */
    readonly sourceType: "document";
    /**
     * Unique identifier for the document.
     */
    readonly id: string;
    /**
     * MIME type of the document.
     */
    readonly mediaType: string;
    /**
     * Display title of the document.
     */
    readonly title: string;
    /**
     * Optional filename of the document.
     */
    readonly fileName?: string;
}
/**
 * Encoded representation of document source parts for serialization.
 *
 * @category models
 * @since 4.0.0
 */
export interface DocumentSourcePartEncoded extends BasePartEncoded<"source", DocumentSourcePartMetadata> {
    /**
     * Type discriminator for document sources.
     */
    readonly sourceType: "document";
    /**
     * Unique identifier for the document.
     */
    readonly id: string;
    /**
     * MIME type of the document.
     */
    readonly mediaType: string;
    /**
     * Display title of the document.
     */
    readonly title: string;
    /**
     * Optional filename of the document.
     */
    readonly fileName?: string;
}
/**
 * Represents provider-specific metadata that can be associated with a
 * `DocumentSourcePart` through module augmentation.
 *
 * @category configuration
 * @since 4.0.0
 */
export interface DocumentSourcePartMetadata extends ProviderMetadata {
}
/**
 * Schema for validation and encoding of document source parts.
 *
 * **When to use**
 *
 * Use to validate or encode document source references returned as response
 * content parts.
 *
 * **Details**
 *
 * Validates `type: "source"`, `sourceType: "document"`, required `id`,
 * `mediaType`, and `title`, optional `fileName`, and the metadata fields
 * inherited from response parts.
 *
 * @see {@link UrlSourcePart} for URL source references
 * @see {@link DocumentSourcePartEncoded} for the encoded document source representation
 *
 * @category schemas
 * @since 4.0.0
 */
export declare const DocumentSourcePart: Schema.Struct<{
    readonly type: Schema.tag<"source">;
    readonly sourceType: Schema.tag<"document">;
    readonly id: Schema.String;
    readonly mediaType: Schema.String;
    readonly title: Schema.String;
    readonly fileName: Schema.optionalKey<Schema.String>;
    readonly "~effect/ai/Content/Part": Schema.withDecodingDefaultKey<Schema.tag<"~effect/ai/Content/Part">>;
    readonly metadata: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.Codec<Schema.Json>>>;
}>;
/**
 * Response part representing a URL source reference used in generating the
 * response.
 *
 * @category models
 * @since 4.0.0
 */
export interface UrlSourcePart extends BasePart<"source", UrlSourcePartMetadata> {
    /**
     * Type discriminator for URL sources.
     */
    readonly sourceType: "url";
    /**
     * Unique identifier for the URL.
     */
    readonly id: string;
    /**
     * The URL that was referenced.
     */
    readonly url: URL;
    /**
     * Display title of the URL content.
     */
    readonly title: string;
}
/**
 * Encoded representation of URL source parts for serialization.
 *
 * @category models
 * @since 4.0.0
 */
export interface UrlSourcePartEncoded extends BasePartEncoded<"source", UrlSourcePartMetadata> {
    /**
     * Type discriminator for URL sources.
     */
    readonly sourceType: "url";
    /**
     * Unique identifier for the URL.
     */
    readonly id: string;
    /**
     * The URL that was referenced as a string.
     */
    readonly url: string;
    /**
     * Display title of the URL content.
     */
    readonly title: string;
}
/**
 * Represents provider-specific metadata that can be associated with a
 * `UrlSourcePart` through module augmentation.
 *
 * @category configuration
 * @since 4.0.0
 */
export interface UrlSourcePartMetadata extends ProviderMetadata {
}
/**
 * Schema for validation and encoding of url source parts.
 *
 * @category schemas
 * @since 4.0.0
 */
export declare const UrlSourcePart: Schema.Struct<{
    readonly type: Schema.tag<"source">;
    readonly sourceType: Schema.tag<"url">;
    readonly id: Schema.String;
    readonly url: Schema.URLFromString;
    readonly title: Schema.String;
    readonly "~effect/ai/Content/Part": Schema.withDecodingDefaultKey<Schema.tag<"~effect/ai/Content/Part">>;
    readonly metadata: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.Codec<Schema.Json>>>;
}>;
/**
 * Schema for HTTP request details associated with an AI response.
 *
 * **Details**
 *
 * Captures comprehensive information about the HTTP request made to the
 * AI provider, enabling inspection of request metadata for debugging and
 * observability purposes.
 *
 * **Example** (Describing an HTTP request)
 *
 * ```ts
 * import type { Response } from "effect/unstable/ai"
 *
 * const requestDetails: typeof Response.HttpRequestDetails.Type = {
 *   method: "POST",
 *   url: "https://api.openai.com/v1/responses",
 *   urlParams: [],
 *   hash: undefined,
 *   headers: { "Content-Type": "application/json" }
 * }
 * ```
 *
 * @category schemas
 * @since 4.0.0
 */
export declare const HttpRequestDetails: Schema.Struct<{
    readonly method: Schema.Literals<readonly ["GET", "POST", "PATCH", "PUT", "DELETE", "HEAD", "OPTIONS", "TRACE"]>;
    readonly url: Schema.String;
    readonly urlParams: Schema.$Array<Schema.Tuple<readonly [Schema.String, Schema.String]>>;
    readonly hash: Schema.UndefinedOr<Schema.String>;
    readonly headers: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Redacted<Schema.String>]>>;
}>;
/**
 * Schema for HTTP response details associated with an AI response.
 *
 * **Details**
 *
 * Captures essential information about the HTTP response received from
 * the AI provider, including status codes and headers for debugging and
 * observability purposes.
 *
 * **Example** (Describing an HTTP response)
 *
 * ```ts
 * import type { Response } from "effect/unstable/ai"
 *
 * const responseDetails: typeof Response.HttpResponseDetails.Type = {
 *   status: 200,
 *   headers: {
 *     "Content-Type": "application/json",
 *     "X-Request-Id": "req_abc123"
 *   }
 * }
 * ```
 *
 * @category schemas
 * @since 4.0.0
 */
export declare const HttpResponseDetails: Schema.Struct<{
    readonly status: Schema.Number;
    readonly headers: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Redacted<Schema.String>]>>;
}>;
/**
 * Response part containing metadata about the large language model response.
 *
 * **Example** (Creating a metadata part)
 *
 * ```ts
 * import { DateTime } from "effect"
 * import { Response } from "effect/unstable/ai"
 *
 * const metadataPart: Response.ResponseMetadataPart = Response.makePart(
 *   "response-metadata",
 *   {
 *     id: "resp_123",
 *     modelId: "gpt-4",
 *     timestamp: DateTime.nowUnsafe(),
 *     request: undefined
 *   }
 * )
 * ```
 *
 * @category models
 * @since 4.0.0
 */
export interface ResponseMetadataPart extends BasePart<"response-metadata", ResponseMetadataPartMetadata> {
    /**
     * Optional unique identifier for this specific response.
     */
    readonly id: string | undefined;
    /**
     * Optional identifier of the AI model that generated the response.
     */
    readonly modelId: string | undefined;
    /**
     * Optional timestamp when the response was generated.
     */
    readonly timestamp: DateTime.Utc | undefined;
    /**
     * Optional HTTP request details for the request made to the AI provider.
     */
    readonly request: typeof HttpRequestDetails.Type | undefined;
}
/**
 * Encoded representation of response metadata parts for serialization.
 *
 * @category models
 * @since 4.0.0
 */
export interface ResponseMetadataPartEncoded extends BasePartEncoded<"response-metadata", ResponseMetadataPartMetadata> {
    /**
     * Optional unique identifier for this specific response.
     */
    readonly id?: string | undefined;
    /**
     * Optional identifier of the AI model that generated the response.
     */
    readonly modelId?: string | undefined;
    /**
     * Optional timestamp when the response was generated.
     */
    readonly timestamp?: string | undefined;
    /**
     * Optional HTTP request details for the request made to the AI provider.
     */
    readonly request?: typeof HttpRequestDetails.Encoded | undefined;
}
/**
 * Represents provider-specific metadata that can be associated with a
 * `ResponseMetadataPart` through module augmentation.
 *
 * @category configuration
 * @since 4.0.0
 */
export interface ResponseMetadataPartMetadata extends ProviderMetadata {
}
/**
 * Schema for validation and encoding of response metadata parts.
 *
 * @category schemas
 * @since 4.0.0
 */
export declare const ResponseMetadataPart: Schema.Struct<{
    readonly type: Schema.tag<"response-metadata">;
    readonly id: Schema.UndefinedOr<Schema.String>;
    readonly modelId: Schema.UndefinedOr<Schema.String>;
    readonly timestamp: Schema.UndefinedOr<Schema.DateTimeUtcFromString>;
    readonly request: Schema.UndefinedOr<typeof HttpRequestDetails>;
    readonly "~effect/ai/Content/Part": Schema.withDecodingDefaultKey<Schema.tag<"~effect/ai/Content/Part">>;
    readonly metadata: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.Codec<Schema.Json>>>;
}>;
/**
 * Represents the reason why a model finished generation of a response.
 *
 * **Details**
 *
 * Possible finish reasons:
 * - `"stop"`: The model generated a stop sequence.
 * - `"length"`: The model exceeded its token budget.
 * - `"content-filter"`: The model generated content which violated a content filter.
 * - `"tool-calls"`: The model triggered a tool call.
 * - `"error"`: The model encountered an error.
 * - `"pause"`: The model requested to pause execution.
 * - `"other"`: The model stopped for a reason not supported by this protocol.
 * - `"unknown"`: The model did not specify a finish reason.
 *
 * @category models
 * @since 4.0.0
 */
export declare const FinishReason: Schema.Literals<[
    "stop",
    "length",
    "content-filter",
    "tool-calls",
    "error",
    "pause",
    "other",
    "unknown"
]>;
/**
 * Type of the reason why a model stopped generating a response.
 *
 * **Details**
 *
 * Values include normal stops, token-limit stops, content filtering,
 * tool-call pauses, provider errors, and unknown provider-specific finish
 * reasons.
 *
 * @category models
 * @since 4.0.0
 */
export type FinishReason = typeof FinishReason.Type;
declare const Usage_base: Schema.Class<Usage, Schema.Struct<{
    /**
     * Information about input (i.e. prompt) token utilization.
     */
    readonly inputTokens: Schema.Struct<{
        /**
         * The number of non-cached input (i.e. prompt) tokens used.
         */
        readonly uncached: Schema.UndefinedOr<Schema.Number>;
        /**
         * The total of number of input (i.e. prompt) tokens used.
         */
        readonly total: Schema.UndefinedOr<Schema.Number>;
        /**
         * The number of cached input (i.e. prompt) tokens read.
         */
        readonly cacheRead: Schema.UndefinedOr<Schema.Number>;
        /**
         * The number of cached input (i.e. prompt) tokens written.
         */
        readonly cacheWrite: Schema.UndefinedOr<Schema.Number>;
    }>;
    /**
     * Information about the output (i.e. response) tokens used.
     */
    readonly outputTokens: Schema.Struct<{
        /**
         * The total of number of output (i.e. response) tokens used.
         */
        readonly total: Schema.UndefinedOr<Schema.Number>;
        /**
         * The number of text tokens used.
         */
        readonly text: Schema.UndefinedOr<Schema.Number>;
        /**
         * The number of reasoning tokens used.
         */
        readonly reasoning: Schema.UndefinedOr<Schema.Number>;
    }>;
}>, {}>;
/**
 * Represents usage information for a request to a large language model provider.
 *
 * **Details**
 *
 * If the model provider returns additional usage information than what is
 * specified here, you can generally find that information under the provider
 * metadata of the finish part of the response.
 *
 * @category models
 * @since 4.0.0
 */
export declare class Usage extends Usage_base {
}
/**
 * Response part indicating the completion of a response generation.
 *
 * **Example** (Creating a finish part)
 *
 * ```ts
 * import { Response } from "effect/unstable/ai"
 *
 * const finishPart: Response.FinishPart = Response.makePart("finish", {
 *   reason: "stop",
 *   usage: new Response.Usage({
 *     inputTokens: {
 *       uncached: undefined,
 *       total: 50,
 *       cacheRead: undefined,
 *       cacheWrite: undefined
 *     },
 *     outputTokens: {
 *       total: 25,
 *       text: undefined,
 *       reasoning: undefined
 *     }
 *   }),
 *   response: undefined
 * })
 * ```
 *
 * @category models
 * @since 4.0.0
 */
export interface FinishPart extends BasePart<"finish", FinishPartMetadata> {
    /**
     * The reason why the model finished generating the response.
     */
    readonly reason: FinishReason;
    /**
     * Token usage statistics for the request.
     */
    readonly usage: Usage;
    /**
     * Optional HTTP response details from the AI provider.
     */
    readonly response: typeof HttpResponseDetails.Type | undefined;
}
/**
 * Encoded representation of finish parts for serialization.
 *
 * @category models
 * @since 4.0.0
 */
export interface FinishPartEncoded extends BasePartEncoded<"finish", FinishPartMetadata> {
    /**
     * The reason why the model finished generating the response.
     */
    readonly reason: typeof FinishReason.Encoded;
    /**
     * Token usage statistics for the request.
     */
    readonly usage: typeof Usage.Encoded;
    /**
     * Optional HTTP response details from the AI provider.
     */
    readonly response?: typeof HttpResponseDetails.Encoded | undefined;
}
/**
 * Represents provider-specific metadata that can be associated with a
 * `FinishPart` through module augmentation.
 *
 * @category configuration
 * @since 4.0.0
 */
export interface FinishPartMetadata extends ProviderMetadata {
}
/**
 * Schema for finish response parts.
 *
 * **Details**
 *
 * Validates `type: "finish"`, `reason` through `FinishReason`, `usage`
 * through `Usage`, and optional provider HTTP response details.
 *
 * @category schemas
 * @since 4.0.0
 */
export declare const FinishPart: Schema.Struct<{
    readonly type: Schema.tag<"finish">;
    readonly reason: Schema.Literals<[
        "stop",
        "length",
        "content-filter",
        "tool-calls",
        "error",
        "pause",
        "other",
        "unknown"
    ]>;
    readonly usage: typeof Usage;
    readonly response: Schema.UndefinedOr<typeof HttpResponseDetails>;
    readonly "~effect/ai/Content/Part": Schema.withDecodingDefaultKey<Schema.tag<"~effect/ai/Content/Part">>;
    readonly metadata: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.Codec<Schema.Json>>>;
}>;
/**
 * Response part indicating that an error occurred generating the response.
 *
 * **Example** (Creating an error part)
 *
 * ```ts
 * import { Response } from "effect/unstable/ai"
 *
 * const errorPart: Response.ErrorPart = Response.makePart("error", {
 *   error: new Error("boom")
 * })
 * ```
 *
 * @category models
 * @since 4.0.0
 */
export interface ErrorPart extends BasePart<"error", ErrorPartMetadata> {
    readonly error: unknown;
}
/**
 * Encoded representation of error parts for serialization.
 *
 * @category models
 * @since 4.0.0
 */
export interface ErrorPartEncoded extends BasePartEncoded<"error", ErrorPartMetadata> {
    readonly error: unknown;
}
/**
 * Represents provider-specific metadata that can be associated with a
 * `ErrorPart` through module augmentation.
 *
 * @category configuration
 * @since 4.0.0
 */
export interface ErrorPartMetadata extends ProviderMetadata {
}
/**
 * Schema for validation and encoding of error parts.
 *
 * **Details**
 *
 * Validates and encodes error parts with `type: "error"` and an `error` payload
 * kept as `unknown`.
 *
 * **Gotchas**
 *
 * The decoded `error` value is not guaranteed to be an `Error`; narrow it before
 * reading `Error`-specific fields.
 *
 * @category schemas
 * @since 4.0.0
 */
export declare const ErrorPart: Schema.Struct<{
    readonly type: Schema.tag<"error">;
    readonly error: Schema.Unknown;
    readonly "~effect/ai/Content/Part": Schema.withDecodingDefaultKey<Schema.tag<"~effect/ai/Content/Part">>;
    readonly metadata: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.Codec<Schema.Json>>>;
}>;
export {};
//# sourceMappingURL=Response.d.ts.map