openai-types 0.1.3

Typed OpenAI API models — zero dependencies beyond serde
Documentation
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
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
// AUTO-GENERATED by py2rust — do not edit.
// Re-generate: python3 scripts/py2rust.py sync <python_dir> <rust_dir>
// Domain: responses
#![allow(unused_imports)]

use serde::{Deserialize, Serialize};
use super::*;

/// Allows the assistant to create, delete, or update files using unified diffs.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ApplyPatchTool {
    /// The type of the tool. Always `apply_patch`.
    #[serde(rename = "type")]
    pub type_: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct CompactedResponse {
    /// The unique identifier for the compacted response.
    pub id: String,
    /// Unix timestamp (in seconds) when the compacted conversation was created.
    pub created_at: i64,
    /// The object type. Always `response.compaction`.
    pub object: String,
    /// The compacted list of output items.
    pub output: Vec<ResponseOutputItem>,
    /// Token accounting for the compaction pass, including cached, reasoning, and total
    pub usage: ResponseUsage,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ClickButton {
    #[serde(rename = "left")]
    Left,
    #[serde(rename = "right")]
    Right,
    #[serde(rename = "wheel")]
    Wheel,
    #[serde(rename = "back")]
    Back,
    #[serde(rename = "forward")]
    Forward,
}

/// A click action.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct Click {
    /// Indicates which mouse button was pressed during the click.
    pub button: ClickButton,
    /// Specifies the event type. For a click action, this property is always `click`.
    #[serde(rename = "type")]
    pub type_: String,
    /// The x-coordinate where the click occurred.
    pub x: i64,
    /// The y-coordinate where the click occurred.
    pub y: i64,
}

/// A double click action.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct DoubleClick {
    /// Specifies the event type.
    #[serde(rename = "type")]
    pub type_: String,
    /// The x-coordinate where the double click occurred.
    pub x: i64,
    /// The y-coordinate where the double click occurred.
    pub y: i64,
}

/// An x/y coordinate pair, e.g. `{ x: 100, y: 200 }`.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct DragPath {
    /// The x-coordinate.
    pub x: i64,
    /// The y-coordinate.
    pub y: i64,
}

/// A drag action.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct Drag {
    /// An array of coordinates representing the path of the drag action.
    pub path: Vec<DragPath>,
    /// Specifies the event type.
    #[serde(rename = "type")]
    pub type_: String,
}

/// A collection of keypresses the model would like to perform.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct Keypress {
    /// The combination of keys the model is requesting to be pressed.
    pub keys: Vec<String>,
    /// Specifies the event type.
    #[serde(rename = "type")]
    pub type_: String,
}

/// A mouse move action.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct Move {
    /// Specifies the event type.
    #[serde(rename = "type")]
    pub type_: String,
    /// The x-coordinate to move to.
    pub x: i64,
    /// The y-coordinate to move to.
    pub y: i64,
}

/// A screenshot action.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct Screenshot {
    /// Specifies the event type.
    #[serde(rename = "type")]
    pub type_: String,
}

/// A scroll action.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct Scroll {
    /// The horizontal scroll distance.
    pub scroll_x: i64,
    /// The vertical scroll distance.
    pub scroll_y: i64,
    /// Specifies the event type.
    #[serde(rename = "type")]
    pub type_: String,
    /// The x-coordinate where the scroll occurred.
    pub x: i64,
    /// The y-coordinate where the scroll occurred.
    pub y: i64,
}

/// An action to type in text.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct Type {
    /// The text to type.
    pub text: String,
    /// Specifies the event type.
    #[serde(rename = "type")]
    pub type_: String,
}

/// A wait action.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct Wait {
    /// Specifies the event type.
    #[serde(rename = "type")]
    pub type_: String,
}

pub type ComputerAction = serde_json::Value;

pub type ComputerActionList = Vec<ComputerAction>;

/// A tool that controls a virtual computer.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ComputerTool {
    /// The type of the computer tool. Always `computer`.
    #[serde(rename = "type")]
    pub type_: String,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ComputerUsePreviewToolEnvironment {
    #[serde(rename = "windows")]
    Windows,
    #[serde(rename = "mac")]
    Mac,
    #[serde(rename = "linux")]
    Linux,
    #[serde(rename = "ubuntu")]
    Ubuntu,
    #[serde(rename = "browser")]
    Browser,
}

/// A tool that controls a virtual computer.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ComputerUsePreviewTool {
    /// The height of the computer display.
    pub display_height: i64,
    /// The width of the computer display.
    pub display_width: i64,
    /// The type of computer environment to control.
    pub environment: ComputerUsePreviewToolEnvironment,
    /// The type of the computer use tool. Always `computer_use_preview`.
    #[serde(rename = "type")]
    pub type_: String,
}

pub type NetworkPolicy = serde_json::Value;

pub type Skill = serde_json::Value;

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ContainerAutoMemoryLimit {
    #[serde(rename = "1g")]
    V1g,
    #[serde(rename = "4g")]
    V4g,
    #[serde(rename = "16g")]
    V16g,
    #[serde(rename = "64g")]
    V64g,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ContainerAuto {
    /// Automatically creates a container for this request
    #[serde(rename = "type")]
    pub type_: String,
    /// An optional list of uploaded files to make available to your code.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub file_ids: Option<Vec<String>>,
    /// The memory limit for the container.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub memory_limit: Option<ContainerAutoMemoryLimit>,
    /// Network access policy for the container.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub network_policy: Option<NetworkPolicy>,
    /// An optional list of skills referenced by id or inline data.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub skills: Option<Vec<Skill>>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ContainerNetworkPolicyAllowlist {
    /// A list of allowed domains when type is `allowlist`.
    pub allowed_domains: Vec<String>,
    /// Allow outbound network access only to specified domains. Always `allowlist`.
    #[serde(rename = "type")]
    pub type_: String,
    /// Optional domain-scoped secrets for allowlisted domains.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub domain_secrets: Option<Vec<ContainerNetworkPolicyDomainSecret>>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ContainerNetworkPolicyDisabled {
    /// Disable outbound network access. Always `disabled`.
    #[serde(rename = "type")]
    pub type_: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ContainerNetworkPolicyDomainSecret {
    /// The domain associated with the secret.
    pub domain: String,
    /// The name of the secret to inject for the domain.
    pub name: String,
    /// The secret value to inject for the domain.
    pub value: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ContainerReference {
    /// The ID of the referenced container.
    pub container_id: String,
    /// References a container created with the /v1/containers endpoint
    #[serde(rename = "type")]
    pub type_: String,
}

/// A custom tool that processes input using a specified format.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct CustomTool {
    /// The name of the custom tool, used to identify it in tool calls.
    pub name: String,
    /// The type of the custom tool. Always `custom`.
    #[serde(rename = "type")]
    pub type_: String,
    /// Whether this tool should be deferred and discovered via tool search.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub defer_loading: Option<bool>,
    /// Optional description of the custom tool, used to provide more context.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub description: Option<String>,
    /// The input format for the custom tool. Default is unconstrained text.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub format: Option<serde_json::Value>,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum EasyInputMessageRole {
    #[serde(rename = "user")]
    User,
    #[serde(rename = "assistant")]
    Assistant,
    #[serde(rename = "system")]
    System,
    #[serde(rename = "developer")]
    Developer,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum EasyInputMessagePhase {
    #[serde(rename = "commentary")]
    Commentary,
    #[serde(rename = "final_answer")]
    FinalAnswer,
}

pub type Filters = serde_json::Value;

/// Weights that control how reciprocal rank fusion balances semantic embedding matches versus sparse keyword matches when hybrid search is enabled.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct RankingOptionsHybridSearch {
    /// The weight of the embedding in the reciprocal ranking fusion.
    pub embedding_weight: f64,
    /// The weight of the text in the reciprocal ranking fusion.
    pub text_weight: f64,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum RankingOptionsRanker {
    #[serde(rename = "auto")]
    Auto,
    #[serde(rename = "default-2024-11-15")]
    Default20241115,
}

/// Ranking options for search.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct RankingOptions {
    /// Weights that control how reciprocal rank fusion balances semantic embedding
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub hybrid_search: Option<RankingOptionsHybridSearch>,
    /// The ranker to use for the file search.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub ranker: Option<RankingOptionsRanker>,
    /// The score threshold for the file search, a number between 0 and 1.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub score_threshold: Option<f64>,
}

/// A tool that searches for relevant content from uploaded files.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct FileSearchTool {
    /// The type of the file search tool. Always `file_search`.
    #[serde(rename = "type")]
    pub type_: String,
    /// The IDs of the vector stores to search.
    pub vector_store_ids: Vec<String>,
    /// A filter to apply.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub filters: Option<Filters>,
    /// The maximum number of results to return.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub max_num_results: Option<i64>,
    /// Ranking options for search.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub ranking_options: Option<RankingOptions>,
}

pub type Environment = serde_json::Value;

/// A tool that allows the model to execute shell commands.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct FunctionShellTool {
    /// The type of the shell tool. Always `shell`.
    #[serde(rename = "type")]
    pub type_: String,
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub environment: Option<Environment>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct InlineSkill {
    /// The description of the skill.
    pub description: String,
    /// The name of the skill.
    pub name: String,
    /// Inline skill payload
    pub source: InlineSkillSource,
    /// Defines an inline skill for this request.
    #[serde(rename = "type")]
    pub type_: String,
}

/// Inline skill payload
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct InlineSkillSource {
    /// Base64-encoded skill zip bundle.
    pub data: String,
    /// The media type of the inline skill payload. Must be `application/zip`.
    pub media_type: String,
    /// The type of the inline skill source. Must be `base64`.
    #[serde(rename = "type")]
    pub type_: String,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum InputItemListParamsOrder {
    #[serde(rename = "asc")]
    Asc,
    #[serde(rename = "desc")]
    Desc,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct InputItemListParams {
    /// An item ID to list items after, used in pagination.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub after: Option<String>,
    /// Additional fields to include in the response.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub include: Option<Vec<ResponseIncludable>>,
    /// A limit on the number of objects to be returned.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub limit: Option<i64>,
    /// The order to return the input items in. Default is `desc`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub order: Option<InputItemListParamsOrder>,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum InputTokenCountParamsTruncation {
    #[serde(rename = "auto")]
    Auto,
    #[serde(rename = "disabled")]
    Disabled,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct InputTokenCountParams {
    /// The conversation that this response belongs to.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub conversation: Option<Conversation>,
    /// Text, image, or file inputs to the model, used to generate a response
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub input: Option<String>,
    /// A system (or developer) message inserted into the model's context. When used
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub instructions: Option<String>,
    /// Model ID used to generate the response, like `gpt-4o` or `o3`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub model: Option<String>,
    /// Whether to allow the model to run tool calls in parallel.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub parallel_tool_calls: Option<bool>,
    /// The unique ID of the previous response to the model.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub previous_response_id: Option<String>,
    /// **gpt-5 and o-series models only** Configuration options for
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub reasoning: Option<serde_json::Value>,
    /// Configuration options for a text response from the model.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub text: Option<Text>,
    /// Controls which tool the model should use, if any.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub tool_choice: Option<ToolChoice>,
    /// An array of tools the model may call while generating a response.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub tools: Option<Vec<serde_json::Value>>,
    /// The truncation strategy to use for the model response.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub truncation: Option<InputTokenCountParamsTruncation>,
}

pub type Conversation = serde_json::Value;

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum TextVerbosity {
    #[serde(rename = "low")]
    Low,
    #[serde(rename = "medium")]
    Medium,
    #[serde(rename = "high")]
    High,
}

/// Configuration options for a text response from the model.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct Text {
    /// An object specifying the format that the model must output.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub format: Option<serde_json::Value>,
    /// Constrains the verbosity of the model's response.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub verbosity: Option<TextVerbosity>,
}

pub type ToolChoice = serde_json::Value;

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct InputTokenCountResponse {
    pub input_tokens: i64,
    pub object: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct LocalEnvironment {
    /// Use a local computer environment.
    #[serde(rename = "type")]
    pub type_: String,
    /// An optional list of skills.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub skills: Option<Vec<LocalSkill>>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct LocalSkill {
    /// The description of the skill.
    pub description: String,
    /// The name of the skill.
    pub name: String,
    /// The path to the directory containing the skill.
    pub path: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ToolFunction {
    pub name: String,
    #[serde(rename = "type")]
    pub type_: String,
    /// Whether this function should be deferred and discovered via tool search.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub defer_loading: Option<bool>,
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub description: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub parameters: Option<serde_json::Value>,
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub strict: Option<bool>,
}

pub type Tool = serde_json::Value;

/// Groups function/custom tools under a shared namespace.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct NamespaceTool {
    /// A description of the namespace shown to the model.
    pub description: String,
    /// The namespace name used in tool calls (for example, `crm`).
    pub name: String,
    /// The function/custom tools available inside this namespace.
    pub tools: Vec<Tool>,
    /// The type of the tool. Always `namespace`.
    #[serde(rename = "type")]
    pub type_: String,
}

pub type ParsedContent = serde_json::Value;

pub type ParsedResponseOutputItem = serde_json::Value;

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum IncompleteDetailsReason {
    #[serde(rename = "max_output_tokens")]
    MaxOutputTokens,
    #[serde(rename = "content_filter")]
    ContentFilter,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ResponsePromptCacheRetention {
    #[serde(rename = "in-memory")]
    InMemory,
    #[serde(rename = "24h")]
    V24h,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ResponseServiceTier {
    #[serde(rename = "auto")]
    Auto,
    #[serde(rename = "default")]
    Default,
    #[serde(rename = "flex")]
    Flex,
    #[serde(rename = "scale")]
    Scale,
    #[serde(rename = "priority")]
    Priority,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ResponseTruncation {
    #[serde(rename = "auto")]
    Auto,
    #[serde(rename = "disabled")]
    Disabled,
}

/// Instruction describing how to create a file via the apply_patch tool.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct OperationCreateFile {
    /// Diff to apply.
    pub diff: String,
    /// Path of the file to create.
    pub path: String,
    /// Create a new file with the provided diff.
    #[serde(rename = "type")]
    pub type_: String,
}

/// Instruction describing how to delete a file via the apply_patch tool.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct OperationDeleteFile {
    /// Path of the file to delete.
    pub path: String,
    /// Delete the specified file.
    #[serde(rename = "type")]
    pub type_: String,
}

/// Instruction describing how to update a file via the apply_patch tool.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct OperationUpdateFile {
    /// Diff to apply.
    pub diff: String,
    /// Path of the file to update.
    pub path: String,
    /// Update an existing file with the provided diff.
    #[serde(rename = "type")]
    pub type_: String,
}

pub type Operation = serde_json::Value;

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ResponseApplyPatchToolCallStatus {
    #[serde(rename = "in_progress")]
    InProgress,
    #[serde(rename = "completed")]
    Completed,
}

/// A tool call that applies file diffs by creating, deleting, or updating files.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseApplyPatchToolCall {
    /// The unique ID of the apply patch tool call.
    pub id: String,
    /// The unique ID of the apply patch tool call generated by the model.
    pub call_id: String,
    /// One of the create_file, delete_file, or update_file operations applied via
    pub operation: Operation,
    /// The status of the apply patch tool call. One of `in_progress` or `completed`.
    pub status: ResponseApplyPatchToolCallStatus,
    /// The type of the item. Always `apply_patch_call`.
    #[serde(rename = "type")]
    pub type_: String,
    /// The ID of the entity that created this tool call.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub created_by: Option<String>,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ResponseApplyPatchToolCallOutputStatus {
    #[serde(rename = "completed")]
    Completed,
    #[serde(rename = "failed")]
    Failed,
}

/// The output emitted by an apply patch tool call.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseApplyPatchToolCallOutput {
    /// The unique ID of the apply patch tool call output.
    pub id: String,
    /// The unique ID of the apply patch tool call generated by the model.
    pub call_id: String,
    /// The status of the apply patch tool call output. One of `completed` or `failed`.
    pub status: ResponseApplyPatchToolCallOutputStatus,
    /// The type of the item. Always `apply_patch_call_output`.
    #[serde(rename = "type")]
    pub type_: String,
    /// The ID of the entity that created this tool call output.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub created_by: Option<String>,
    /// Optional textual output returned by the apply patch tool.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub output: Option<String>,
}

/// Emitted when there is a partial audio response.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseAudioDeltaEvent {
    /// A chunk of Base64 encoded response audio bytes.
    pub delta: String,
    /// A sequence number for this chunk of the stream response.
    pub sequence_number: i64,
    /// The type of the event. Always `response.audio.delta`.
    #[serde(rename = "type")]
    pub type_: String,
}

/// Emitted when the audio response is complete.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseAudioDoneEvent {
    /// The sequence number of the delta.
    pub sequence_number: i64,
    /// The type of the event. Always `response.audio.done`.
    #[serde(rename = "type")]
    pub type_: String,
}

/// Emitted when there is a partial transcript of audio.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseAudioTranscriptDeltaEvent {
    /// The partial transcript of the audio response.
    pub delta: String,
    /// The sequence number of this event.
    pub sequence_number: i64,
    /// The type of the event. Always `response.audio.transcript.delta`.
    #[serde(rename = "type")]
    pub type_: String,
}

/// Emitted when the full audio transcript is completed.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseAudioTranscriptDoneEvent {
    /// The sequence number of this event.
    pub sequence_number: i64,
    /// The type of the event. Always `response.audio.transcript.done`.
    #[serde(rename = "type")]
    pub type_: String,
}

/// Emitted when a partial code snippet is streamed by the code interpreter.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseCodeInterpreterCallCodeDeltaEvent {
    /// The partial code snippet being streamed by the code interpreter.
    pub delta: String,
    /// The unique identifier of the code interpreter tool call item.
    pub item_id: String,
    /// The index of the output item in the response for which the code is being
    pub output_index: i64,
    /// The sequence number of this event, used to order streaming events.
    pub sequence_number: i64,
    /// The type of the event. Always `response.code_interpreter_call_code.delta`.
    #[serde(rename = "type")]
    pub type_: String,
}

/// Emitted when the code snippet is finalized by the code interpreter.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseCodeInterpreterCallCodeDoneEvent {
    /// The final code snippet output by the code interpreter.
    pub code: String,
    /// The unique identifier of the code interpreter tool call item.
    pub item_id: String,
    /// The index of the output item in the response for which the code is finalized.
    pub output_index: i64,
    /// The sequence number of this event, used to order streaming events.
    pub sequence_number: i64,
    /// The type of the event. Always `response.code_interpreter_call_code.done`.
    #[serde(rename = "type")]
    pub type_: String,
}

/// Emitted when the code interpreter call is completed.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseCodeInterpreterCallCompletedEvent {
    /// The unique identifier of the code interpreter tool call item.
    pub item_id: String,
    /// The index of the output item in the response for which the code interpreter call
    pub output_index: i64,
    /// The sequence number of this event, used to order streaming events.
    pub sequence_number: i64,
    /// The type of the event. Always `response.code_interpreter_call.completed`.
    #[serde(rename = "type")]
    pub type_: String,
}

/// Emitted when a code interpreter call is in progress.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseCodeInterpreterCallInProgressEvent {
    /// The unique identifier of the code interpreter tool call item.
    pub item_id: String,
    /// The index of the output item in the response for which the code interpreter call
    pub output_index: i64,
    /// The sequence number of this event, used to order streaming events.
    pub sequence_number: i64,
    /// The type of the event. Always `response.code_interpreter_call.in_progress`.
    #[serde(rename = "type")]
    pub type_: String,
}

/// Emitted when the code interpreter is actively interpreting the code snippet.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseCodeInterpreterCallInterpretingEvent {
    /// The unique identifier of the code interpreter tool call item.
    pub item_id: String,
    /// The index of the output item in the response for which the code interpreter is
    pub output_index: i64,
    /// The sequence number of this event, used to order streaming events.
    pub sequence_number: i64,
    /// The type of the event. Always `response.code_interpreter_call.interpreting`.
    #[serde(rename = "type")]
    pub type_: String,
}

/// The logs output from the code interpreter.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct OutputLogs {
    /// The logs output from the code interpreter.
    pub logs: String,
    /// The type of the output. Always `logs`.
    #[serde(rename = "type")]
    pub type_: String,
}

/// The image output from the code interpreter.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct OutputImage {
    /// The type of the output. Always `image`.
    #[serde(rename = "type")]
    pub type_: String,
    /// The URL of the image output from the code interpreter.
    pub url: String,
}

pub type Output = serde_json::Value;

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ResponseCodeInterpreterToolCallStatus {
    #[serde(rename = "in_progress")]
    InProgress,
    #[serde(rename = "completed")]
    Completed,
    #[serde(rename = "incomplete")]
    Incomplete,
    #[serde(rename = "interpreting")]
    Interpreting,
    #[serde(rename = "failed")]
    Failed,
}

/// A tool call to run code.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseCodeInterpreterToolCall {
    /// The unique ID of the code interpreter tool call.
    pub id: String,
    /// The code to run, or null if not available.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub code: Option<String>,
    /// The ID of the container used to run the code.
    pub container_id: String,
    /// The outputs generated by the code interpreter, such as logs or images. Can be
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub outputs: Option<Vec<FunctionShellOutput>>,
    /// The status of the code interpreter tool call.
    pub status: ResponseCodeInterpreterToolCallStatus,
    /// The type of the code interpreter tool call. Always `code_interpreter_call`.
    #[serde(rename = "type")]
    pub type_: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseCompactParams {
    /// Model ID used to generate the response, like `gpt-5` or `o3`.
    pub model: Option<String>,
    /// Text, image, or file inputs to the model, used to generate a response
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub input: Option<String>,
    /// A system (or developer) message inserted into the model's context. When used
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub instructions: Option<String>,
    /// The unique ID of the previous response to the model.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub previous_response_id: Option<String>,
    /// A key to use when reading from or writing to the prompt cache.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub prompt_cache_key: Option<String>,
}

/// A compaction item generated by the [`v1/responses/compact` API](https://platform.openai.com/docs/api-reference/responses/compact).
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseCompactionItem {
    /// The unique ID of the compaction item.
    pub id: String,
    /// The encrypted content that was produced by compaction.
    pub encrypted_content: String,
    /// The type of the item. Always `compaction`.
    #[serde(rename = "type")]
    pub type_: String,
    /// The identifier of the actor that created the item.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub created_by: Option<String>,
}

/// A pending safety check for the computer call.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct PendingSafetyCheck {
    /// The ID of the pending safety check.
    pub id: String,
    /// The type of the pending safety check.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub code: Option<String>,
    /// Details about the pending safety check.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub message: Option<String>,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ActionClickButton {
    #[serde(rename = "left")]
    Left,
    #[serde(rename = "right")]
    Right,
    #[serde(rename = "wheel")]
    Wheel,
    #[serde(rename = "back")]
    Back,
    #[serde(rename = "forward")]
    Forward,
}

/// A click action.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ActionClick {
    /// Indicates which mouse button was pressed during the click.
    pub button: ActionClickButton,
    /// Specifies the event type. For a click action, this property is always `click`.
    #[serde(rename = "type")]
    pub type_: String,
    /// The x-coordinate where the click occurred.
    pub x: i64,
    /// The y-coordinate where the click occurred.
    pub y: i64,
}

/// A double click action.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ActionDoubleClick {
    /// Specifies the event type.
    #[serde(rename = "type")]
    pub type_: String,
    /// The x-coordinate where the double click occurred.
    pub x: i64,
    /// The y-coordinate where the double click occurred.
    pub y: i64,
}

/// An x/y coordinate pair, e.g. `{ x: 100, y: 200 }`.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ActionDragPath {
    /// The x-coordinate.
    pub x: i64,
    /// The y-coordinate.
    pub y: i64,
}

/// A drag action.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ActionDrag {
    /// An array of coordinates representing the path of the drag action.
    pub path: Vec<ActionDragPath>,
    /// Specifies the event type.
    #[serde(rename = "type")]
    pub type_: String,
}

/// A collection of keypresses the model would like to perform.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ActionKeypress {
    /// The combination of keys the model is requesting to be pressed.
    pub keys: Vec<String>,
    /// Specifies the event type.
    #[serde(rename = "type")]
    pub type_: String,
}

/// A mouse move action.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ActionMove {
    /// Specifies the event type.
    #[serde(rename = "type")]
    pub type_: String,
    /// The x-coordinate to move to.
    pub x: i64,
    /// The y-coordinate to move to.
    pub y: i64,
}

/// A screenshot action.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ActionScreenshot {
    /// Specifies the event type.
    #[serde(rename = "type")]
    pub type_: String,
}

/// A scroll action.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ActionScroll {
    /// The horizontal scroll distance.
    pub scroll_x: i64,
    /// The vertical scroll distance.
    pub scroll_y: i64,
    /// Specifies the event type.
    #[serde(rename = "type")]
    pub type_: String,
    /// The x-coordinate where the scroll occurred.
    pub x: i64,
    /// The y-coordinate where the scroll occurred.
    pub y: i64,
}

/// An action to type in text.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ActionType {
    /// The text to type.
    pub text: String,
    /// Specifies the event type.
    #[serde(rename = "type")]
    pub type_: String,
}

/// A wait action.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ActionWait {
    /// Specifies the event type.
    #[serde(rename = "type")]
    pub type_: String,
}

pub type Action = serde_json::Value;

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ResponseComputerToolCallStatus {
    #[serde(rename = "in_progress")]
    InProgress,
    #[serde(rename = "completed")]
    Completed,
    #[serde(rename = "incomplete")]
    Incomplete,
}

/// A tool call to a computer use tool.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseComputerToolCall {
    /// The unique ID of the computer call.
    pub id: String,
    /// An identifier used when responding to the tool call with output.
    pub call_id: String,
    /// The pending safety checks for the computer call.
    pub pending_safety_checks: Vec<PendingSafetyCheck>,
    /// The status of the item.
    pub status: ResponseComputerToolCallStatus,
    /// The type of the computer call. Always `computer_call`.
    #[serde(rename = "type")]
    pub type_: String,
    /// A click action.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub action: Option<FunctionShellAction>,
    /// Flattened batched actions for `computer_use`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub actions: Option<ComputerActionList>,
}

/// A pending safety check for the computer call.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct AcknowledgedSafetyCheck {
    /// The ID of the pending safety check.
    pub id: String,
    /// The type of the pending safety check.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub code: Option<String>,
    /// Details about the pending safety check.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub message: Option<String>,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ResponseComputerToolCallOutputItemStatus {
    #[serde(rename = "in_progress")]
    InProgress,
    #[serde(rename = "completed")]
    Completed,
    #[serde(rename = "incomplete")]
    Incomplete,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseComputerToolCallOutputItem {
    /// The unique ID of the computer call tool output.
    pub id: String,
    /// The ID of the computer tool call that produced the output.
    pub call_id: String,
    /// A computer screenshot image used with the computer use tool.
    pub output: ResponseComputerToolCallOutputScreenshot,
    /// The type of the computer tool call output. Always `computer_call_output`.
    #[serde(rename = "type")]
    pub type_: String,
    /// The safety checks reported by the API that have been acknowledged by the
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub acknowledged_safety_checks: Option<Vec<AcknowledgedSafetyCheck>>,
    /// The status of the message input.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub status: Option<ResponseComputerToolCallOutputItemStatus>,
}

/// A computer screenshot image used with the computer use tool.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseComputerToolCallOutputScreenshot {
    /// Specifies the event type.
    #[serde(rename = "type")]
    pub type_: String,
    /// The identifier of an uploaded file that contains the screenshot.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub file_id: Option<String>,
    /// The URL of the screenshot image.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub image_url: Option<String>,
}

/// Represents a container created with /v1/containers.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseContainerReference {
    pub container_id: String,
    /// The environment type. Always `container_reference`.
    #[serde(rename = "type")]
    pub type_: String,
}

/// Reasoning text from the model.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct PartReasoningText {
    /// The reasoning text from the model.
    pub text: String,
    /// The type of the reasoning text. Always `reasoning_text`.
    #[serde(rename = "type")]
    pub type_: String,
}

pub type Part = serde_json::Value;

/// Emitted when a new content part is added.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseContentPartAddedEvent {
    /// The index of the content part that was added.
    pub content_index: i64,
    /// The ID of the output item that the content part was added to.
    pub item_id: String,
    /// The index of the output item that the content part was added to.
    pub output_index: i64,
    /// The content part that was added.
    pub part: ReasoningSummaryPart,
    /// The sequence number of this event.
    pub sequence_number: i64,
    /// The type of the event. Always `response.content_part.added`.
    #[serde(rename = "type")]
    pub type_: String,
}

/// Emitted when a content part is done.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseContentPartDoneEvent {
    /// The index of the content part that is done.
    pub content_index: i64,
    /// The ID of the output item that the content part was added to.
    pub item_id: String,
    /// The index of the output item that the content part was added to.
    pub output_index: i64,
    /// The content part that is done.
    pub part: ReasoningSummaryPart,
    /// The sequence number of this event.
    pub sequence_number: i64,
    /// The type of the event. Always `response.content_part.done`.
    #[serde(rename = "type")]
    pub type_: String,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ResponseCreateParamsBasePromptCacheRetention {
    #[serde(rename = "in-memory")]
    InMemory,
    #[serde(rename = "24h")]
    V24h,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ResponseCreateParamsBaseServiceTier {
    #[serde(rename = "auto")]
    Auto,
    #[serde(rename = "default")]
    Default,
    #[serde(rename = "flex")]
    Flex,
    #[serde(rename = "scale")]
    Scale,
    #[serde(rename = "priority")]
    Priority,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ResponseCreateParamsBaseTruncation {
    #[serde(rename = "auto")]
    Auto,
    #[serde(rename = "disabled")]
    Disabled,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseCreateParamsBase {
    /// Whether to run the model response in the background.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub background: Option<bool>,
    /// Context management configuration for this request.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub context_management: Option<Vec<ContextManagement>>,
    /// The conversation that this response belongs to.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub conversation: Option<Conversation>,
    /// Specify additional output data to include in the model response.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub include: Option<Vec<ResponseIncludable>>,
    /// Text, image, or file inputs to the model, used to generate a response.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub input: Option<String>,
    /// A system (or developer) message inserted into the model's context.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub instructions: Option<String>,
    /// An upper bound for the number of tokens that can be generated for a response,
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub max_output_tokens: Option<i64>,
    /// The maximum number of total calls to built-in tools that can be processed in a
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub max_tool_calls: Option<i64>,
    /// Set of 16 key-value pairs that can be attached to an object.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub metadata: Option<serde_json::Value>,
    /// Model ID used to generate the response, like `gpt-4o` or `o3`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub model: Option<serde_json::Value>,
    /// Whether to allow the model to run tool calls in parallel.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub parallel_tool_calls: Option<bool>,
    /// The unique ID of the previous response to the model.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub previous_response_id: Option<String>,
    /// Reference to a prompt template and its variables.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub prompt: Option<serde_json::Value>,
    /// Used by OpenAI to cache responses for similar requests to optimize your cache
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub prompt_cache_key: Option<String>,
    /// The retention policy for the prompt cache.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub prompt_cache_retention: Option<ResponseCreateParamsBasePromptCacheRetention>,
    /// **gpt-5 and o-series models only**
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub reasoning: Option<serde_json::Value>,
    /// A stable identifier used to help detect users of your application that may be
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub safety_identifier: Option<String>,
    /// Specifies the processing type used for serving the request.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub service_tier: Option<ResponseCreateParamsBaseServiceTier>,
    /// Whether to store the generated model response for later retrieval via API.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub store: Option<bool>,
    /// Options for streaming responses. Only set this when you set `stream: true`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub stream_options: Option<StreamOptions>,
    /// What sampling temperature to use, between 0 and 2.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub temperature: Option<f64>,
    /// Configuration options for a text response from the model.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub text: Option<serde_json::Value>,
    /// How the model should select which tool (or tools) to use when generating a
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub tool_choice: Option<ToolChoice>,
    /// An array of tools the model may call while generating a response.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub tools: Option<Vec<serde_json::Value>>,
    /// An integer between 0 and 20 specifying the number of most likely tokens to
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub top_logprobs: Option<i64>,
    /// An alternative to sampling with temperature, called nucleus sampling, where the
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub top_p: Option<f64>,
    /// The truncation strategy to use for the model response.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub truncation: Option<ResponseCreateParamsBaseTruncation>,
    /// This field is being replaced by `safety_identifier` and `prompt_cache_key`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub user: Option<String>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ContextManagement {
    /// The context management entry type. Currently only 'compaction' is supported.
    #[serde(rename = "type")]
    pub type_: String,
    /// Token threshold at which compaction should be triggered for this entry.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub compact_threshold: Option<i64>,
}

/// Options for streaming responses. Only set this when you set `stream: true`.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct StreamOptions {
    /// When true, stream obfuscation will be enabled.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub include_obfuscation: Option<bool>,
}

pub type ResponseCreateParams = serde_json::Value;

/// An event that is emitted when a response is created.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseCreatedEvent {
    /// The response that was created.
    pub response: Response,
    /// The sequence number for this event.
    pub sequence_number: i64,
    /// The type of the event. Always `response.created`.
    #[serde(rename = "type")]
    pub type_: String,
}

/// A call to a custom tool created by the model.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseCustomToolCall {
    /// An identifier used to map this custom tool call to a tool call output.
    pub call_id: String,
    /// The input for the custom tool call generated by the model.
    pub input: String,
    /// The name of the custom tool being called.
    pub name: String,
    /// The type of the custom tool call. Always `custom_tool_call`.
    #[serde(rename = "type")]
    pub type_: String,
    /// The unique ID of the custom tool call in the OpenAI platform.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub id: Option<String>,
    /// The namespace of the custom tool being called.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub namespace: Option<String>,
}

/// Event representing a delta (partial update) to the input of a custom tool call.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseCustomToolCallInputDeltaEvent {
    /// The incremental input data (delta) for the custom tool call.
    pub delta: String,
    /// Unique identifier for the API item associated with this event.
    pub item_id: String,
    /// The index of the output this delta applies to.
    pub output_index: i64,
    /// The sequence number of this event.
    pub sequence_number: i64,
    /// The event type identifier.
    #[serde(rename = "type")]
    pub type_: String,
}

/// Event indicating that input for a custom tool call is complete.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseCustomToolCallInputDoneEvent {
    /// The complete input data for the custom tool call.
    pub input: String,
    /// Unique identifier for the API item associated with this event.
    pub item_id: String,
    /// The index of the output this event applies to.
    pub output_index: i64,
    /// The sequence number of this event.
    pub sequence_number: i64,
    /// The event type identifier.
    #[serde(rename = "type")]
    pub type_: String,
}

pub type OutputOutputContentList = serde_json::Value;

/// The output of a custom tool call from your code, being sent back to the model.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseCustomToolCallOutput {
    /// The call ID, used to map this custom tool call output to a custom tool call.
    pub call_id: String,
    /// The output from the custom tool call generated by your code. Can be a string or
    pub output: String,
    /// The type of the custom tool call output. Always `custom_tool_call_output`.
    #[serde(rename = "type")]
    pub type_: String,
    /// The unique ID of the custom tool call output in the OpenAI platform.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub id: Option<String>,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ResponseErrorCode {
    #[serde(rename = "server_error")]
    ServerError,
    #[serde(rename = "rate_limit_exceeded")]
    RateLimitExceeded,
    #[serde(rename = "invalid_prompt")]
    InvalidPrompt,
    #[serde(rename = "vector_store_timeout")]
    VectorStoreTimeout,
    #[serde(rename = "invalid_image")]
    InvalidImage,
    #[serde(rename = "invalid_image_format")]
    InvalidImageFormat,
    #[serde(rename = "invalid_base64_image")]
    InvalidBase64Image,
    #[serde(rename = "invalid_image_url")]
    InvalidImageUrl,
    #[serde(rename = "image_too_large")]
    ImageTooLarge,
    #[serde(rename = "image_too_small")]
    ImageTooSmall,
    #[serde(rename = "image_parse_error")]
    ImageParseError,
    #[serde(rename = "image_content_policy_violation")]
    ImageContentPolicyViolation,
    #[serde(rename = "invalid_image_mode")]
    InvalidImageMode,
    #[serde(rename = "image_file_too_large")]
    ImageFileTooLarge,
    #[serde(rename = "unsupported_image_media_type")]
    UnsupportedImageMediaType,
    #[serde(rename = "empty_image_file")]
    EmptyImageFile,
    #[serde(rename = "failed_to_download_image")]
    FailedToDownloadImage,
    #[serde(rename = "image_file_not_found")]
    ImageFileNotFound,
}

/// Emitted when a file search call is completed (results found).
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseFileSearchCallCompletedEvent {
    /// The ID of the output item that the file search call is initiated.
    pub item_id: String,
    /// The index of the output item that the file search call is initiated.
    pub output_index: i64,
    /// The sequence number of this event.
    pub sequence_number: i64,
    /// The type of the event. Always `response.file_search_call.completed`.
    #[serde(rename = "type")]
    pub type_: String,
}

/// Emitted when a file search call is initiated.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseFileSearchCallInProgressEvent {
    /// The ID of the output item that the file search call is initiated.
    pub item_id: String,
    /// The index of the output item that the file search call is initiated.
    pub output_index: i64,
    /// The sequence number of this event.
    pub sequence_number: i64,
    /// The type of the event. Always `response.file_search_call.in_progress`.
    #[serde(rename = "type")]
    pub type_: String,
}

/// Emitted when a file search is currently searching.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseFileSearchCallSearchingEvent {
    /// The ID of the output item that the file search call is initiated.
    pub item_id: String,
    /// The index of the output item that the file search call is searching.
    pub output_index: i64,
    /// The sequence number of this event.
    pub sequence_number: i64,
    /// The type of the event. Always `response.file_search_call.searching`.
    #[serde(rename = "type")]
    pub type_: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct FileSearchResult {
    /// Set of 16 key-value pairs that can be attached to an object.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub attributes: Option<std::collections::HashMap<String, serde_json::Value>>,
    /// The unique ID of the file.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub file_id: Option<String>,
    /// The name of the file.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub filename: Option<String>,
    /// The relevance score of the file - a value between 0 and 1.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub score: Option<f64>,
    /// The text that was retrieved from the file.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub text: Option<String>,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ResponseFileSearchToolCallStatus {
    #[serde(rename = "in_progress")]
    InProgress,
    #[serde(rename = "searching")]
    Searching,
    #[serde(rename = "completed")]
    Completed,
    #[serde(rename = "incomplete")]
    Incomplete,
    #[serde(rename = "failed")]
    Failed,
}

/// The results of a file search tool call.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseFileSearchToolCall {
    /// The unique ID of the file search tool call.
    pub id: String,
    /// The queries used to search for files.
    pub queries: Vec<String>,
    /// The status of the file search tool call.
    pub status: ResponseFileSearchToolCallStatus,
    /// The type of the file search tool call. Always `file_search_call`.
    #[serde(rename = "type")]
    pub type_: String,
    /// The results of the file search tool call.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub results: Option<Vec<FileSearchResult>>,
}

pub type ResponseFormatTextConfig = serde_json::Value;

/// JSON Schema response format.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseFormatTextJSONSchemaConfig {
    /// The name of the response format.
    pub name: String,
    /// The schema for the response format, described as a JSON Schema object. Learn how
    #[serde(rename = "schema")]
    pub schema_: std::collections::HashMap<String, serde_json::Value>,
    /// The type of response format being defined. Always `json_schema`.
    #[serde(rename = "type")]
    pub type_: String,
    /// A description of what the response format is for, used by the model to determine
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub description: Option<String>,
    /// Whether to enable strict schema adherence when generating the output. If set to
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub strict: Option<bool>,
}

pub type ResponseFunctionCallOutputItem = serde_json::Value;

pub type ResponseFunctionCallOutputItemList = Vec<ResponseFunctionCallOutputItem>;

/// Indicates that the shell call exceeded its configured time limit.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct OutcomeTimeout {
    /// The outcome type. Always `timeout`.
    #[serde(rename = "type")]
    pub type_: String,
}

/// Indicates that the shell commands finished and returned an exit code.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct OutcomeExit {
    /// The exit code returned by the shell process.
    pub exit_code: i64,
    /// The outcome type. Always `exit`.
    #[serde(rename = "type")]
    pub type_: String,
}

pub type Outcome = serde_json::Value;

/// Captured stdout and stderr for a portion of a shell tool call output.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseFunctionShellCallOutputContent {
    /// The exit or timeout outcome associated with this shell call.
    pub outcome: Outcome,
    /// Captured stderr output for the shell call.
    pub stderr: String,
    /// Captured stdout output for the shell call.
    pub stdout: String,
}

/// The shell commands and limits that describe how to run the tool call.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct FunctionShellAction {
    pub commands: Vec<String>,
    /// Optional maximum number of characters to return from each command.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub max_output_length: Option<i64>,
    /// Optional timeout in milliseconds for the commands.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub timeout_ms: Option<i64>,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ResponseFunctionShellToolCallStatus {
    #[serde(rename = "in_progress")]
    InProgress,
    #[serde(rename = "completed")]
    Completed,
    #[serde(rename = "incomplete")]
    Incomplete,
}

/// A tool call that executes one or more shell commands in a managed environment.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseFunctionShellToolCall {
    /// The unique ID of the shell tool call.
    pub id: String,
    /// The shell commands and limits that describe how to run the tool call.
    pub action: FunctionShellAction,
    /// The unique ID of the shell tool call generated by the model.
    pub call_id: String,
    /// Represents the use of a local environment to perform shell actions.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub environment: Option<Environment>,
    /// The status of the shell call.
    pub status: ResponseFunctionShellToolCallStatus,
    /// The type of the item. Always `shell_call`.
    #[serde(rename = "type")]
    pub type_: String,
    /// The ID of the entity that created this tool call.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub created_by: Option<String>,
}

/// Indicates that the shell call exceeded its configured time limit.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct OutputOutcomeTimeout {
    /// The outcome type. Always `timeout`.
    #[serde(rename = "type")]
    pub type_: String,
}

/// Indicates that the shell commands finished and returned an exit code.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct OutputOutcomeExit {
    /// Exit code from the shell process.
    pub exit_code: i64,
    /// The outcome type. Always `exit`.
    #[serde(rename = "type")]
    pub type_: String,
}

pub type OutputOutcome = serde_json::Value;

/// The content of a shell tool call output that was emitted.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct FunctionShellOutput {
    /// Represents either an exit outcome (with an exit code) or a timeout outcome for a
    pub outcome: OutputOutcome,
    /// The standard error output that was captured.
    pub stderr: String,
    /// The standard output that was captured.
    pub stdout: String,
    /// The identifier of the actor that created the item.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub created_by: Option<String>,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ResponseFunctionShellToolCallOutputStatus {
    #[serde(rename = "in_progress")]
    InProgress,
    #[serde(rename = "completed")]
    Completed,
    #[serde(rename = "incomplete")]
    Incomplete,
}

/// The output of a shell tool call that was emitted.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseFunctionShellToolCallOutput {
    /// The unique ID of the shell call output.
    pub id: String,
    /// The unique ID of the shell tool call generated by the model.
    pub call_id: String,
    /// The maximum length of the shell command output.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub max_output_length: Option<i64>,
    /// An array of shell call output contents
    pub output: Vec<FunctionShellOutput>,
    /// The status of the shell call output.
    pub status: ResponseFunctionShellToolCallOutputStatus,
    /// The type of the shell call output. Always `shell_call_output`.
    #[serde(rename = "type")]
    pub type_: String,
    /// The identifier of the actor that created the item.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub created_by: Option<String>,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ResponseFunctionToolCallStatus {
    #[serde(rename = "in_progress")]
    InProgress,
    #[serde(rename = "completed")]
    Completed,
    #[serde(rename = "incomplete")]
    Incomplete,
}

/// A tool call to run a function.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseFunctionToolCall {
    /// A JSON string of the arguments to pass to the function.
    pub arguments: String,
    /// The unique ID of the function tool call generated by the model.
    pub call_id: String,
    /// The name of the function to run.
    pub name: String,
    /// The type of the function tool call. Always `function_call`.
    #[serde(rename = "type")]
    pub type_: String,
    /// The unique ID of the function tool call.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub id: Option<String>,
    /// The namespace of the function to run.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub namespace: Option<String>,
    /// The status of the item.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub status: Option<ResponseFunctionToolCallStatus>,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ResponseFunctionToolCallOutputItemStatus {
    #[serde(rename = "in_progress")]
    InProgress,
    #[serde(rename = "completed")]
    Completed,
    #[serde(rename = "incomplete")]
    Incomplete,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseFunctionToolCallOutputItem {
    /// The unique ID of the function call tool output.
    pub id: String,
    /// The unique ID of the function tool call generated by the model.
    pub call_id: String,
    /// The output from the function call generated by your code. Can be a string or an
    pub output: String,
    /// The type of the function tool call output. Always `function_call_output`.
    #[serde(rename = "type")]
    pub type_: String,
    /// The status of the item.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub status: Option<ResponseFunctionToolCallOutputItemStatus>,
}

/// A source used in the search.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ActionSearchSource {
    /// The type of source. Always `url`.
    #[serde(rename = "type")]
    pub type_: String,
    /// The URL of the source.
    pub url: String,
}

/// Action type "search" - Performs a web search query.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ActionSearch {
    /// [DEPRECATED] The search query.
    pub query: String,
    /// The action type.
    #[serde(rename = "type")]
    pub type_: String,
    /// The search queries.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub queries: Option<Vec<String>>,
    /// The sources used in the search.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub sources: Option<Vec<ActionSearchSource>>,
}

/// Action type "open_page" - Opens a specific URL from search results.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ActionOpenPage {
    /// The action type.
    #[serde(rename = "type")]
    pub type_: String,
    /// The URL opened by the model.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub url: Option<String>,
}

/// Action type "find_in_page": Searches for a pattern within a loaded page.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ActionFind {
    /// The pattern or text to search for within the page.
    pub pattern: String,
    /// The action type.
    #[serde(rename = "type")]
    pub type_: String,
    /// The URL of the page searched for the pattern.
    pub url: String,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ResponseFunctionWebSearchStatus {
    #[serde(rename = "in_progress")]
    InProgress,
    #[serde(rename = "searching")]
    Searching,
    #[serde(rename = "completed")]
    Completed,
    #[serde(rename = "failed")]
    Failed,
}

/// The results of a web search tool call.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseFunctionWebSearch {
    /// The unique ID of the web search tool call.
    pub id: String,
    /// An object describing the specific action taken in this web search call. Includes
    pub action: FunctionShellAction,
    /// The status of the web search tool call.
    pub status: ResponseFunctionWebSearchStatus,
    /// The type of the web search tool call. Always `web_search_call`.
    #[serde(rename = "type")]
    pub type_: String,
}

/// Emitted when an image generation tool call has completed and the final image is available.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseImageGenCallCompletedEvent {
    /// The unique identifier of the image generation item being processed.
    pub item_id: String,
    /// The index of the output item in the response's output array.
    pub output_index: i64,
    /// The sequence number of this event.
    pub sequence_number: i64,
    /// The type of the event. Always 'response.image_generation_call.completed'.
    #[serde(rename = "type")]
    pub type_: String,
}

/// Emitted when an image generation tool call is actively generating an image (intermediate state).
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseImageGenCallGeneratingEvent {
    /// The unique identifier of the image generation item being processed.
    pub item_id: String,
    /// The index of the output item in the response's output array.
    pub output_index: i64,
    /// The sequence number of the image generation item being processed.
    pub sequence_number: i64,
    /// The type of the event. Always 'response.image_generation_call.generating'.
    #[serde(rename = "type")]
    pub type_: String,
}

/// Emitted when an image generation tool call is in progress.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseImageGenCallInProgressEvent {
    /// The unique identifier of the image generation item being processed.
    pub item_id: String,
    /// The index of the output item in the response's output array.
    pub output_index: i64,
    /// The sequence number of the image generation item being processed.
    pub sequence_number: i64,
    /// The type of the event. Always 'response.image_generation_call.in_progress'.
    #[serde(rename = "type")]
    pub type_: String,
}

/// Emitted when a partial image is available during image generation streaming.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseImageGenCallPartialImageEvent {
    /// The unique identifier of the image generation item being processed.
    pub item_id: String,
    /// The index of the output item in the response's output array.
    pub output_index: i64,
    /// Base64-encoded partial image data, suitable for rendering as an image.
    pub partial_image_b64: String,
    /// 0-based index for the partial image (backend is 1-based, but this is 0-based for
    pub partial_image_index: i64,
    /// The sequence number of the image generation item being processed.
    pub sequence_number: i64,
    /// The type of the event. Always 'response.image_generation_call.partial_image'.
    #[serde(rename = "type")]
    pub type_: String,
}

/// Emitted when the response is in progress.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseInProgressEvent {
    /// The response that is in progress.
    pub response: Response,
    /// The sequence number of this event.
    pub sequence_number: i64,
    /// The type of the event. Always `response.in_progress`.
    #[serde(rename = "type")]
    pub type_: String,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ResponseIncludable {
    #[serde(rename = "file_search_call.results")]
    FileSearchCallResults,
    #[serde(rename = "web_search_call.results")]
    WebSearchCallResults,
    #[serde(rename = "web_search_call.action.sources")]
    WebSearchCallActionSources,
    #[serde(rename = "message.input_image.image_url")]
    MessageInputImageImageUrl,
    #[serde(rename = "computer_call_output.output.image_url")]
    ComputerCallOutputOutputImageUrl,
    #[serde(rename = "code_interpreter_call.outputs")]
    CodeInterpreterCallOutputs,
    #[serde(rename = "reasoning.encrypted_content")]
    ReasoningEncryptedContent,
    #[serde(rename = "message.output_text.logprobs")]
    MessageOutputTextLogprobs,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum InputAudioFormat {
    #[serde(rename = "mp3")]
    Mp3,
    #[serde(rename = "wav")]
    Wav,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct InputAudio {
    /// Base64-encoded audio data.
    pub data: String,
    /// The format of the audio data. Currently supported formats are `mp3` and `wav`.
    pub format: InputAudioFormat,
}

/// An audio input to the model.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseInputAudio {
    pub input_audio: InputAudio,
    /// The type of the input item. Always `input_audio`.
    #[serde(rename = "type")]
    pub type_: String,
}

pub type ResponseInputContent = serde_json::Value;

/// A file input to the model.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseInputFile {
    /// The type of the input item. Always `input_file`.
    #[serde(rename = "type")]
    pub type_: String,
    /// The content of the file to be sent to the model.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub file_data: Option<String>,
    /// The ID of the file to be sent to the model.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub file_id: Option<String>,
    /// The URL of the file to be sent to the model.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub file_url: Option<String>,
    /// The name of the file to be sent to the model.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub filename: Option<String>,
}

/// A file input to the model.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseInputFileContent {
    /// The type of the input item. Always `input_file`.
    #[serde(rename = "type")]
    pub type_: String,
    /// The base64-encoded data of the file to be sent to the model.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub file_data: Option<String>,
    /// The ID of the file to be sent to the model.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub file_id: Option<String>,
    /// The URL of the file to be sent to the model.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub file_url: Option<String>,
    /// The name of the file to be sent to the model.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub filename: Option<String>,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ResponseInputImageDetail {
    #[serde(rename = "low")]
    Low,
    #[serde(rename = "high")]
    High,
    #[serde(rename = "auto")]
    Auto,
    #[serde(rename = "original")]
    Original,
}

/// An image input to the model.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseInputImage {
    /// The detail level of the image to be sent to the model.
    pub detail: ResponseInputImageDetail,
    /// The type of the input item. Always `input_image`.
    #[serde(rename = "type")]
    pub type_: String,
    /// The ID of the file to be sent to the model.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub file_id: Option<String>,
    /// The URL of the image to be sent to the model.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub image_url: Option<String>,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ResponseInputImageContentDetail {
    #[serde(rename = "low")]
    Low,
    #[serde(rename = "high")]
    High,
    #[serde(rename = "auto")]
    Auto,
    #[serde(rename = "original")]
    Original,
}

/// An image input to the model.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseInputImageContent {
    /// The type of the input item. Always `input_image`.
    #[serde(rename = "type")]
    pub type_: String,
    /// The detail level of the image to be sent to the model.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub detail: Option<ResponseInputImageContentDetail>,
    /// The ID of the file to be sent to the model.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub file_id: Option<String>,
    /// The URL of the image to be sent to the model.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub image_url: Option<String>,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum MessageRole {
    #[serde(rename = "user")]
    User,
    #[serde(rename = "system")]
    System,
    #[serde(rename = "developer")]
    Developer,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum MessageStatus {
    #[serde(rename = "in_progress")]
    InProgress,
    #[serde(rename = "completed")]
    Completed,
    #[serde(rename = "incomplete")]
    Incomplete,
}

/// A message input to the model with a role indicating instruction following
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct Message {
    /// A list of one or many input items to the model, containing different content
    pub content: ResponseInputMessageContentList,
    /// The role of the message input. One of `user`, `system`, or `developer`.
    pub role: MessageRole,
    /// The status of item.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub status: Option<MessageStatus>,
    /// The type of the message input. Always set to `message`.
    #[serde(rename = "type", skip_serializing_if = "Option::is_none", default)]
    pub type_: Option<String>,
}

/// A pending safety check for the computer call.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ComputerCallOutputAcknowledgedSafetyCheck {
    /// The ID of the pending safety check.
    pub id: String,
    /// The type of the pending safety check.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub code: Option<String>,
    /// Details about the pending safety check.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub message: Option<String>,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ComputerCallOutputStatus {
    #[serde(rename = "in_progress")]
    InProgress,
    #[serde(rename = "completed")]
    Completed,
    #[serde(rename = "incomplete")]
    Incomplete,
}

/// The output of a computer tool call.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ComputerCallOutput {
    /// The ID of the computer tool call that produced the output.
    pub call_id: String,
    /// A computer screenshot image used with the computer use tool.
    pub output: ResponseComputerToolCallOutputScreenshot,
    /// The type of the computer tool call output. Always `computer_call_output`.
    #[serde(rename = "type")]
    pub type_: String,
    /// The ID of the computer tool call output.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub id: Option<String>,
    /// The safety checks reported by the API that have been acknowledged by the
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub acknowledged_safety_checks: Option<Vec<ComputerCallOutputAcknowledgedSafetyCheck>>,
    /// The status of the message input.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub status: Option<ComputerCallOutputStatus>,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum FunctionCallOutputStatus {
    #[serde(rename = "in_progress")]
    InProgress,
    #[serde(rename = "completed")]
    Completed,
    #[serde(rename = "incomplete")]
    Incomplete,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ToolSearchCallExecution {
    #[serde(rename = "server")]
    Server,
    #[serde(rename = "client")]
    Client,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ToolSearchCallStatus {
    #[serde(rename = "in_progress")]
    InProgress,
    #[serde(rename = "completed")]
    Completed,
    #[serde(rename = "incomplete")]
    Incomplete,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ToolSearchCall {
    /// The arguments supplied to the tool search call.
    pub arguments: serde_json::Value,
    /// The item type. Always `tool_search_call`.
    #[serde(rename = "type")]
    pub type_: String,
    /// The unique ID of this tool search call.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub id: Option<String>,
    /// The unique ID of the tool search call generated by the model.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub call_id: Option<String>,
    /// Whether tool search was executed by the server or by the client.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub execution: Option<ToolSearchCallExecution>,
    /// The status of the tool search call.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub status: Option<ToolSearchCallStatus>,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ImageGenerationCallStatus {
    #[serde(rename = "in_progress")]
    InProgress,
    #[serde(rename = "completed")]
    Completed,
    #[serde(rename = "generating")]
    Generating,
    #[serde(rename = "failed")]
    Failed,
}

/// An image generation request made by the model.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ImageGenerationCall {
    /// The unique ID of the image generation call.
    pub id: String,
    /// The generated image encoded in base64.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub result: Option<String>,
    /// The status of the image generation call.
    pub status: ImageGenerationCallStatus,
    /// The type of the image generation call. Always `image_generation_call`.
    #[serde(rename = "type")]
    pub type_: String,
}

/// Execute a shell command on the server.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct LocalShellCallAction {
    /// The command to run.
    pub command: Vec<String>,
    /// Environment variables to set for the command.
    pub env: std::collections::HashMap<String, String>,
    /// The type of the local shell action. Always `exec`.
    #[serde(rename = "type")]
    pub type_: String,
    /// Optional timeout in milliseconds for the command.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub timeout_ms: Option<i64>,
    /// Optional user to run the command as.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub user: Option<String>,
    /// Optional working directory to run the command in.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub working_directory: Option<String>,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum LocalShellCallStatus {
    #[serde(rename = "in_progress")]
    InProgress,
    #[serde(rename = "completed")]
    Completed,
    #[serde(rename = "incomplete")]
    Incomplete,
}

/// A tool call to run a command on the local shell.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct LocalShellCall {
    /// The unique ID of the local shell call.
    pub id: String,
    /// Execute a shell command on the server.
    pub action: LocalShellCallAction,
    /// The unique ID of the local shell tool call generated by the model.
    pub call_id: String,
    /// The status of the local shell call.
    pub status: LocalShellCallStatus,
    /// The type of the local shell call. Always `local_shell_call`.
    #[serde(rename = "type")]
    pub type_: String,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum LocalShellCallOutputStatus {
    #[serde(rename = "in_progress")]
    InProgress,
    #[serde(rename = "completed")]
    Completed,
    #[serde(rename = "incomplete")]
    Incomplete,
}

/// The output of a local shell tool call.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct LocalShellCallOutput {
    /// The unique ID of the local shell tool call generated by the model.
    pub id: String,
    /// A JSON string of the output of the local shell tool call.
    pub output: String,
    /// The type of the local shell tool call output. Always `local_shell_call_output`.
    #[serde(rename = "type")]
    pub type_: String,
    /// The status of the item. One of `in_progress`, `completed`, or `incomplete`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub status: Option<LocalShellCallOutputStatus>,
}

/// The shell commands and limits that describe how to run the tool call.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ShellCallAction {
    /// Ordered shell commands for the execution environment to run.
    pub commands: Vec<String>,
    /// Maximum number of UTF-8 characters to capture from combined stdout and stderr
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub max_output_length: Option<i64>,
    /// Maximum wall-clock time in milliseconds to allow the shell commands to run.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub timeout_ms: Option<i64>,
}

pub type ShellCallEnvironment = serde_json::Value;

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ShellCallStatus {
    #[serde(rename = "in_progress")]
    InProgress,
    #[serde(rename = "completed")]
    Completed,
    #[serde(rename = "incomplete")]
    Incomplete,
}

/// A tool representing a request to execute one or more shell commands.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ShellCall {
    /// The shell commands and limits that describe how to run the tool call.
    pub action: ShellCallAction,
    /// The unique ID of the shell tool call generated by the model.
    pub call_id: String,
    /// The type of the item. Always `shell_call`.
    #[serde(rename = "type")]
    pub type_: String,
    /// The unique ID of the shell tool call.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub id: Option<String>,
    /// The environment to execute the shell commands in.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub environment: Option<ShellCallEnvironment>,
    /// The status of the shell call.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub status: Option<ShellCallStatus>,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ShellCallOutputStatus {
    #[serde(rename = "in_progress")]
    InProgress,
    #[serde(rename = "completed")]
    Completed,
    #[serde(rename = "incomplete")]
    Incomplete,
}

/// The streamed output items emitted by a shell tool call.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ShellCallOutput {
    /// The unique ID of the shell tool call generated by the model.
    pub call_id: String,
    /// Captured chunks of stdout and stderr output, along with their associated
    pub output: Vec<ResponseFunctionShellCallOutputContent>,
    /// The type of the item. Always `shell_call_output`.
    #[serde(rename = "type")]
    pub type_: String,
    /// The unique ID of the shell tool call output.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub id: Option<String>,
    /// The maximum number of UTF-8 characters captured for this shell call's combined
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub max_output_length: Option<i64>,
    /// The status of the shell call output.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub status: Option<ShellCallOutputStatus>,
}

/// Instruction for creating a new file via the apply_patch tool.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ApplyPatchCallOperationCreateFile {
    /// Unified diff content to apply when creating the file.
    pub diff: String,
    /// Path of the file to create relative to the workspace root.
    pub path: String,
    /// The operation type. Always `create_file`.
    #[serde(rename = "type")]
    pub type_: String,
}

/// Instruction for deleting an existing file via the apply_patch tool.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ApplyPatchCallOperationDeleteFile {
    /// Path of the file to delete relative to the workspace root.
    pub path: String,
    /// The operation type. Always `delete_file`.
    #[serde(rename = "type")]
    pub type_: String,
}

/// Instruction for updating an existing file via the apply_patch tool.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ApplyPatchCallOperationUpdateFile {
    /// Unified diff content to apply to the existing file.
    pub diff: String,
    /// Path of the file to update relative to the workspace root.
    pub path: String,
    /// The operation type. Always `update_file`.
    #[serde(rename = "type")]
    pub type_: String,
}

pub type ApplyPatchCallOperation = serde_json::Value;

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ApplyPatchCallStatus {
    #[serde(rename = "in_progress")]
    InProgress,
    #[serde(rename = "completed")]
    Completed,
}

/// A tool call representing a request to create, delete, or update files using diff patches.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ApplyPatchCall {
    /// The unique ID of the apply patch tool call generated by the model.
    pub call_id: String,
    /// The specific create, delete, or update instruction for the apply_patch tool
    pub operation: ApplyPatchCallOperation,
    /// The status of the apply patch tool call. One of `in_progress` or `completed`.
    pub status: ApplyPatchCallStatus,
    /// The type of the item. Always `apply_patch_call`.
    #[serde(rename = "type")]
    pub type_: String,
    /// The unique ID of the apply patch tool call.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub id: Option<String>,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ApplyPatchCallOutputStatus {
    #[serde(rename = "completed")]
    Completed,
    #[serde(rename = "failed")]
    Failed,
}

/// The streamed output emitted by an apply patch tool call.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ApplyPatchCallOutput {
    /// The unique ID of the apply patch tool call generated by the model.
    pub call_id: String,
    /// The status of the apply patch tool call output. One of `completed` or `failed`.
    pub status: ApplyPatchCallOutputStatus,
    /// The type of the item. Always `apply_patch_call_output`.
    #[serde(rename = "type")]
    pub type_: String,
    /// The unique ID of the apply patch tool call output.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub id: Option<String>,
    /// Optional human-readable log text from the apply patch tool (e.g., patch results
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub output: Option<String>,
}

/// A tool available on an MCP server.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct McpListToolsTool {
    /// The JSON schema describing the tool's input.
    pub input_schema: serde_json::Value,
    /// The name of the tool.
    pub name: String,
    /// Additional annotations about the tool.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub annotations: Option<serde_json::Value>,
    /// The description of the tool.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub description: Option<String>,
}

/// A list of tools available on an MCP server.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct McpListTools {
    /// The unique ID of the list.
    pub id: String,
    /// The label of the MCP server.
    pub server_label: String,
    /// The tools available on the server.
    pub tools: Vec<McpListToolsTool>,
    /// The type of the item. Always `mcp_list_tools`.
    #[serde(rename = "type")]
    pub type_: String,
    /// Error message if the server could not list tools.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub error: Option<String>,
}

/// A request for human approval of a tool invocation.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct McpApprovalRequest {
    /// The unique ID of the approval request.
    pub id: String,
    /// A JSON string of arguments for the tool.
    pub arguments: String,
    /// The name of the tool to run.
    pub name: String,
    /// The label of the MCP server making the request.
    pub server_label: String,
    /// The type of the item. Always `mcp_approval_request`.
    #[serde(rename = "type")]
    pub type_: String,
}

/// A response to an MCP approval request.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct McpApprovalResponse {
    /// The ID of the approval request being answered.
    pub approval_request_id: String,
    /// Whether the request was approved.
    pub approve: bool,
    /// The type of the item. Always `mcp_approval_response`.
    #[serde(rename = "type")]
    pub type_: String,
    /// The unique ID of the approval response
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub id: Option<String>,
    /// Optional reason for the decision.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub reason: Option<String>,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum McpCallStatus {
    #[serde(rename = "in_progress")]
    InProgress,
    #[serde(rename = "completed")]
    Completed,
    #[serde(rename = "incomplete")]
    Incomplete,
    #[serde(rename = "calling")]
    Calling,
    #[serde(rename = "failed")]
    Failed,
}

/// An invocation of a tool on an MCP server.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct McpCall {
    /// The unique ID of the tool call.
    pub id: String,
    /// A JSON string of the arguments passed to the tool.
    pub arguments: String,
    /// The name of the tool that was run.
    pub name: String,
    /// The label of the MCP server running the tool.
    pub server_label: String,
    /// The type of the item. Always `mcp_call`.
    #[serde(rename = "type")]
    pub type_: String,
    /// Unique identifier for the MCP tool call approval request. Include this value in
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub approval_request_id: Option<String>,
    /// The error from the tool call, if any.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub error: Option<String>,
    /// The output from the tool call.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub output: Option<String>,
    /// The status of the tool call.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub status: Option<McpCallStatus>,
}

/// An internal identifier for an item to reference.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ItemReference {
    /// The ID of the item to reference.
    pub id: String,
    /// The type of item to reference. Always `item_reference`.
    #[serde(rename = "type", skip_serializing_if = "Option::is_none", default)]
    pub type_: Option<String>,
}

pub type ResponseInputMessageContentList = Vec<ResponseInputContent>;

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ResponseInputMessageItemRole {
    #[serde(rename = "user")]
    User,
    #[serde(rename = "system")]
    System,
    #[serde(rename = "developer")]
    Developer,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ResponseInputMessageItemStatus {
    #[serde(rename = "in_progress")]
    InProgress,
    #[serde(rename = "completed")]
    Completed,
    #[serde(rename = "incomplete")]
    Incomplete,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseInputMessageItem {
    /// The unique ID of the message input.
    pub id: String,
    /// A list of one or many input items to the model, containing different content
    pub content: ResponseInputMessageContentList,
    /// The role of the message input. One of `user`, `system`, or `developer`.
    pub role: ResponseInputMessageItemRole,
    /// The status of item.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub status: Option<ResponseInputMessageItemStatus>,
    /// The type of the message input. Always set to `message`.
    #[serde(rename = "type", skip_serializing_if = "Option::is_none", default)]
    pub type_: Option<String>,
}

/// A text input to the model.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseInputText {
    /// The text input to the model.
    pub text: String,
    /// The type of the input item. Always `input_text`.
    #[serde(rename = "type")]
    pub type_: String,
}

/// A text input to the model.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseInputTextContent {
    /// The text input to the model.
    pub text: String,
    /// The type of the input item. Always `input_text`.
    #[serde(rename = "type")]
    pub type_: String,
}

pub type ResponseItem = serde_json::Value;

/// A list of Response items.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseItemList {
    /// A list of items used to generate this response.
    pub data: Vec<ResponseItem>,
    /// The ID of the first item in the list.
    pub first_id: String,
    /// Whether there are more items available.
    pub has_more: bool,
    /// The ID of the last item in the list.
    pub last_id: String,
    /// The type of object returned, must be `list`.
    pub object: String,
}

/// Represents the use of a local environment to perform shell actions.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseLocalEnvironment {
    /// The environment type. Always `local`.
    #[serde(rename = "type")]
    pub type_: String,
}

/// Emitted when there is a delta (partial update) to the arguments of an MCP tool call.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseMcpCallArgumentsDeltaEvent {
    /// A JSON string containing the partial update to the arguments for the MCP tool
    pub delta: String,
    /// The unique identifier of the MCP tool call item being processed.
    pub item_id: String,
    /// The index of the output item in the response's output array.
    pub output_index: i64,
    /// The sequence number of this event.
    pub sequence_number: i64,
    /// The type of the event. Always 'response.mcp_call_arguments.delta'.
    #[serde(rename = "type")]
    pub type_: String,
}

/// Emitted when the arguments for an MCP tool call are finalized.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseMcpCallArgumentsDoneEvent {
    /// A JSON string containing the finalized arguments for the MCP tool call.
    pub arguments: String,
    /// The unique identifier of the MCP tool call item being processed.
    pub item_id: String,
    /// The index of the output item in the response's output array.
    pub output_index: i64,
    /// The sequence number of this event.
    pub sequence_number: i64,
    /// The type of the event. Always 'response.mcp_call_arguments.done'.
    #[serde(rename = "type")]
    pub type_: String,
}

/// Emitted when an MCP  tool call has completed successfully.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseMcpCallCompletedEvent {
    /// The ID of the MCP tool call item that completed.
    pub item_id: String,
    /// The index of the output item that completed.
    pub output_index: i64,
    /// The sequence number of this event.
    pub sequence_number: i64,
    /// The type of the event. Always 'response.mcp_call.completed'.
    #[serde(rename = "type")]
    pub type_: String,
}

/// Emitted when an MCP  tool call has failed.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseMcpCallFailedEvent {
    /// The ID of the MCP tool call item that failed.
    pub item_id: String,
    /// The index of the output item that failed.
    pub output_index: i64,
    /// The sequence number of this event.
    pub sequence_number: i64,
    /// The type of the event. Always 'response.mcp_call.failed'.
    #[serde(rename = "type")]
    pub type_: String,
}

/// Emitted when an MCP  tool call is in progress.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseMcpCallInProgressEvent {
    /// The unique identifier of the MCP tool call item being processed.
    pub item_id: String,
    /// The index of the output item in the response's output array.
    pub output_index: i64,
    /// The sequence number of this event.
    pub sequence_number: i64,
    /// The type of the event. Always 'response.mcp_call.in_progress'.
    #[serde(rename = "type")]
    pub type_: String,
}

/// Emitted when the list of available MCP tools has been successfully retrieved.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseMcpListToolsCompletedEvent {
    /// The ID of the MCP tool call item that produced this output.
    pub item_id: String,
    /// The index of the output item that was processed.
    pub output_index: i64,
    /// The sequence number of this event.
    pub sequence_number: i64,
    /// The type of the event. Always 'response.mcp_list_tools.completed'.
    #[serde(rename = "type")]
    pub type_: String,
}

/// Emitted when the attempt to list available MCP tools has failed.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseMcpListToolsFailedEvent {
    /// The ID of the MCP tool call item that failed.
    pub item_id: String,
    /// The index of the output item that failed.
    pub output_index: i64,
    /// The sequence number of this event.
    pub sequence_number: i64,
    /// The type of the event. Always 'response.mcp_list_tools.failed'.
    #[serde(rename = "type")]
    pub type_: String,
}

/// Emitted when the system is in the process of retrieving the list of available MCP tools.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseMcpListToolsInProgressEvent {
    /// The ID of the MCP tool call item that is being processed.
    pub item_id: String,
    /// The index of the output item that is being processed.
    pub output_index: i64,
    /// The sequence number of this event.
    pub sequence_number: i64,
    /// The type of the event. Always 'response.mcp_list_tools.in_progress'.
    #[serde(rename = "type")]
    pub type_: String,
}

/// Emitted when an output item is marked done.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseOutputItemDoneEvent {
    /// The output item that was marked done.
    pub item: ResponseOutputItem,
    /// The index of the output item that was marked done.
    pub output_index: i64,
    /// The sequence number of this event.
    pub sequence_number: i64,
    /// The type of the event. Always `response.output_item.done`.
    #[serde(rename = "type")]
    pub type_: String,
}

pub type Content = serde_json::Value;

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ResponseOutputMessageStatus {
    #[serde(rename = "in_progress")]
    InProgress,
    #[serde(rename = "completed")]
    Completed,
    #[serde(rename = "incomplete")]
    Incomplete,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ResponseOutputMessagePhase {
    #[serde(rename = "commentary")]
    Commentary,
    #[serde(rename = "final_answer")]
    FinalAnswer,
}

/// An output message from the model.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseOutputMessage {
    /// The unique ID of the output message.
    pub id: String,
    /// The content of the output message.
    pub content: Vec<ReasoningItemContent>,
    /// The role of the output message. Always `assistant`.
    pub role: String,
    /// The status of the message input.
    pub status: ResponseOutputMessageStatus,
    /// The type of the output message. Always `message`.
    #[serde(rename = "type")]
    pub type_: String,
    /// Labels an `assistant` message as intermediate commentary (`commentary`) or the
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub phase: Option<ResponseOutputMessagePhase>,
}

/// A refusal from the model.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseOutputRefusal {
    /// The refusal explanation from the model.
    pub refusal: String,
    /// The type of the refusal. Always `refusal`.
    #[serde(rename = "type")]
    pub type_: String,
}

/// A citation to a file.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct AnnotationFileCitation {
    /// The ID of the file.
    pub file_id: String,
    /// The filename of the file cited.
    pub filename: String,
    /// The index of the file in the list of files.
    pub index: i64,
    /// The type of the file citation. Always `file_citation`.
    #[serde(rename = "type")]
    pub type_: String,
}

/// A citation for a web resource used to generate a model response.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct AnnotationURLCitation {
    /// The index of the last character of the URL citation in the message.
    pub end_index: i64,
    /// The index of the first character of the URL citation in the message.
    pub start_index: i64,
    /// The title of the web resource.
    pub title: String,
    /// The type of the URL citation. Always `url_citation`.
    #[serde(rename = "type")]
    pub type_: String,
    /// The URL of the web resource.
    pub url: String,
}

/// A citation for a container file used to generate a model response.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct AnnotationContainerFileCitation {
    /// The ID of the container file.
    pub container_id: String,
    /// The index of the last character of the container file citation in the message.
    pub end_index: i64,
    /// The ID of the file.
    pub file_id: String,
    /// The filename of the container file cited.
    pub filename: String,
    /// The index of the first character of the container file citation in the message.
    pub start_index: i64,
    /// The type of the container file citation. Always `container_file_citation`.
    #[serde(rename = "type")]
    pub type_: String,
}

/// A path to a file.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct AnnotationFilePath {
    /// The ID of the file.
    pub file_id: String,
    /// The index of the file in the list of files.
    pub index: i64,
    /// The type of the file path. Always `file_path`.
    #[serde(rename = "type")]
    pub type_: String,
}

pub type Annotation = serde_json::Value;

/// The top log probability of a token.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct LogprobTopLogprob {
    pub token: String,
    pub bytes: Vec<i64>,
    pub logprob: f64,
}

/// The log probability of a token.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct Logprob {
    pub token: String,
    pub bytes: Vec<i64>,
    pub logprob: f64,
    pub top_logprobs: Vec<LogprobTopLogprob>,
}

/// A text output from the model.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseOutputText {
    /// The annotations of the text output.
    pub annotations: Vec<Annotation>,
    /// The text output from the model.
    pub text: String,
    /// The type of the output text. Always `output_text`.
    #[serde(rename = "type")]
    pub type_: String,
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub logprobs: Option<Vec<Logprob>>,
}

/// Emitted when an annotation is added to output text content.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseOutputTextAnnotationAddedEvent {
    /// The annotation object being added. (See annotation schema for details.)
    pub annotation: serde_json::Value,
    /// The index of the annotation within the content part.
    pub annotation_index: i64,
    /// The index of the content part within the output item.
    pub content_index: i64,
    /// The unique identifier of the item to which the annotation is being added.
    pub item_id: String,
    /// The index of the output item in the response's output array.
    pub output_index: i64,
    /// The sequence number of this event.
    pub sequence_number: i64,
    /// The type of the event. Always 'response.output_text.annotation.added'.
    #[serde(rename = "type")]
    pub type_: String,
}

pub type Variables = serde_json::Value;

/// Reference to a prompt template and its variables.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponsePrompt {
    /// The unique identifier of the prompt template to use.
    pub id: String,
    /// Optional map of values to substitute in for variables in your prompt.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub variables: Option<std::collections::HashMap<String, Variables>>,
    /// Optional version of the prompt template.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub version: Option<String>,
}

/// Emitted when a response is queued and waiting to be processed.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseQueuedEvent {
    /// The full response object that is queued.
    pub response: Response,
    /// The sequence number for this event.
    pub sequence_number: i64,
    /// The type of the event. Always 'response.queued'.
    #[serde(rename = "type")]
    pub type_: String,
}

/// A summary text from the model.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ReasoningItemSummary {
    /// A summary of the reasoning output from the model so far.
    pub text: String,
    /// The type of the object. Always `summary_text`.
    #[serde(rename = "type")]
    pub type_: String,
}

/// Reasoning text from the model.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ReasoningItemContent {
    /// The reasoning text from the model.
    pub text: String,
    /// The type of the reasoning text. Always `reasoning_text`.
    #[serde(rename = "type")]
    pub type_: String,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ResponseReasoningItemStatus {
    #[serde(rename = "in_progress")]
    InProgress,
    #[serde(rename = "completed")]
    Completed,
    #[serde(rename = "incomplete")]
    Incomplete,
}

/// A description of the chain of thought used by a reasoning model while generating
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseReasoningItem {
    /// The unique identifier of the reasoning content.
    pub id: String,
    /// Reasoning summary content.
    pub summary: Vec<ReasoningItemSummary>,
    /// The type of the object. Always `reasoning`.
    #[serde(rename = "type")]
    pub type_: String,
    /// Reasoning text content.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub content: Option<Vec<ReasoningItemContent>>,
    /// The encrypted content of the reasoning item - populated when a response is
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub encrypted_content: Option<String>,
    /// The status of the item.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub status: Option<ResponseReasoningItemStatus>,
}

/// The summary part that was added.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ReasoningSummaryPart {
    /// The text of the summary part.
    pub text: String,
    /// The type of the summary part. Always `summary_text`.
    #[serde(rename = "type")]
    pub type_: String,
}

/// Emitted when a new reasoning summary part is added.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseReasoningSummaryPartAddedEvent {
    /// The ID of the item this summary part is associated with.
    pub item_id: String,
    /// The index of the output item this summary part is associated with.
    pub output_index: i64,
    /// The summary part that was added.
    pub part: ReasoningSummaryPart,
    /// The sequence number of this event.
    pub sequence_number: i64,
    /// The index of the summary part within the reasoning summary.
    pub summary_index: i64,
    /// The type of the event. Always `response.reasoning_summary_part.added`.
    #[serde(rename = "type")]
    pub type_: String,
}

/// Emitted when a reasoning summary part is completed.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseReasoningSummaryPartDoneEvent {
    /// The ID of the item this summary part is associated with.
    pub item_id: String,
    /// The index of the output item this summary part is associated with.
    pub output_index: i64,
    /// The completed summary part.
    pub part: ReasoningSummaryPart,
    /// The sequence number of this event.
    pub sequence_number: i64,
    /// The index of the summary part within the reasoning summary.
    pub summary_index: i64,
    /// The type of the event. Always `response.reasoning_summary_part.done`.
    #[serde(rename = "type")]
    pub type_: String,
}

/// Emitted when a reasoning summary text is completed.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseReasoningSummaryTextDoneEvent {
    /// The ID of the item this summary text is associated with.
    pub item_id: String,
    /// The index of the output item this summary text is associated with.
    pub output_index: i64,
    /// The sequence number of this event.
    pub sequence_number: i64,
    /// The index of the summary part within the reasoning summary.
    pub summary_index: i64,
    /// The full text of the completed reasoning summary.
    pub text: String,
    /// The type of the event. Always `response.reasoning_summary_text.done`.
    #[serde(rename = "type")]
    pub type_: String,
}

/// Emitted when a reasoning text is completed.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseReasoningTextDoneEvent {
    /// The index of the reasoning content part.
    pub content_index: i64,
    /// The ID of the item this reasoning text is associated with.
    pub item_id: String,
    /// The index of the output item this reasoning text is associated with.
    pub output_index: i64,
    /// The sequence number of this event.
    pub sequence_number: i64,
    /// The full text of the completed reasoning content.
    pub text: String,
    /// The type of the event. Always `response.reasoning_text.done`.
    #[serde(rename = "type")]
    pub type_: String,
}

/// Emitted when there is a partial refusal text.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseRefusalDeltaEvent {
    /// The index of the content part that the refusal text is added to.
    pub content_index: i64,
    /// The refusal text that is added.
    pub delta: String,
    /// The ID of the output item that the refusal text is added to.
    pub item_id: String,
    /// The index of the output item that the refusal text is added to.
    pub output_index: i64,
    /// The sequence number of this event.
    pub sequence_number: i64,
    /// The type of the event. Always `response.refusal.delta`.
    #[serde(rename = "type")]
    pub type_: String,
}

/// Emitted when refusal text is finalized.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseRefusalDoneEvent {
    /// The index of the content part that the refusal text is finalized.
    pub content_index: i64,
    /// The ID of the output item that the refusal text is finalized.
    pub item_id: String,
    /// The index of the output item that the refusal text is finalized.
    pub output_index: i64,
    /// The refusal text that is finalized.
    pub refusal: String,
    /// The sequence number of this event.
    pub sequence_number: i64,
    /// The type of the event. Always `response.refusal.done`.
    #[serde(rename = "type")]
    pub type_: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseRetrieveParamsBase {
    /// Additional fields to include in the response.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub include: Option<Vec<ResponseIncludable>>,
    /// When true, stream obfuscation will be enabled.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub include_obfuscation: Option<bool>,
    /// The sequence number of the event after which to start streaming.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub starting_after: Option<i64>,
}

pub type ResponseRetrieveParams = serde_json::Value;

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ResponseStatus {
    #[serde(rename = "completed")]
    Completed,
    #[serde(rename = "failed")]
    Failed,
    #[serde(rename = "in_progress")]
    InProgress,
    #[serde(rename = "cancelled")]
    Cancelled,
    #[serde(rename = "queued")]
    Queued,
    #[serde(rename = "incomplete")]
    Incomplete,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ResponseTextConfigVerbosity {
    #[serde(rename = "low")]
    Low,
    #[serde(rename = "medium")]
    Medium,
    #[serde(rename = "high")]
    High,
}

/// Emitted when text content is finalized.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseTextDoneEvent {
    /// The index of the content part that the text content is finalized.
    pub content_index: i64,
    /// The ID of the output item that the text content is finalized.
    pub item_id: String,
    /// The log probabilities of the tokens in the delta.
    pub logprobs: Vec<Logprob>,
    /// The index of the output item that the text content is finalized.
    pub output_index: i64,
    /// The sequence number for this event.
    pub sequence_number: i64,
    /// The text content that is finalized.
    pub text: String,
    /// The type of the event. Always `response.output_text.done`.
    #[serde(rename = "type")]
    pub type_: String,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ResponseToolSearchCallExecution {
    #[serde(rename = "server")]
    Server,
    #[serde(rename = "client")]
    Client,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ResponseToolSearchCallStatus {
    #[serde(rename = "in_progress")]
    InProgress,
    #[serde(rename = "completed")]
    Completed,
    #[serde(rename = "incomplete")]
    Incomplete,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseToolSearchCall {
    /// The unique ID of the tool search call item.
    pub id: String,
    /// Arguments used for the tool search call.
    pub arguments: serde_json::Value,
    /// The unique ID of the tool search call generated by the model.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub call_id: Option<String>,
    /// Whether tool search was executed by the server or by the client.
    pub execution: ResponseToolSearchCallExecution,
    /// The status of the tool search call item that was recorded.
    pub status: ResponseToolSearchCallStatus,
    /// The type of the item. Always `tool_search_call`.
    #[serde(rename = "type")]
    pub type_: String,
    /// The identifier of the actor that created the item.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub created_by: Option<String>,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ResponseToolSearchOutputItemExecution {
    #[serde(rename = "server")]
    Server,
    #[serde(rename = "client")]
    Client,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ResponseToolSearchOutputItemStatus {
    #[serde(rename = "in_progress")]
    InProgress,
    #[serde(rename = "completed")]
    Completed,
    #[serde(rename = "incomplete")]
    Incomplete,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseToolSearchOutputItem {
    /// The unique ID of the tool search output item.
    pub id: String,
    /// The unique ID of the tool search call generated by the model.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub call_id: Option<String>,
    /// Whether tool search was executed by the server or by the client.
    pub execution: ResponseToolSearchOutputItemExecution,
    /// The status of the tool search output item that was recorded.
    pub status: ResponseToolSearchOutputItemStatus,
    /// The loaded tool definitions returned by tool search.
    pub tools: Vec<Tool>,
    /// The type of the item. Always `tool_search_output`.
    #[serde(rename = "type")]
    pub type_: String,
    /// The identifier of the actor that created the item.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub created_by: Option<String>,
}

/// Emitted when a web search call is completed.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseWebSearchCallCompletedEvent {
    /// Unique ID for the output item associated with the web search call.
    pub item_id: String,
    /// The index of the output item that the web search call is associated with.
    pub output_index: i64,
    /// The sequence number of the web search call being processed.
    pub sequence_number: i64,
    /// The type of the event. Always `response.web_search_call.completed`.
    #[serde(rename = "type")]
    pub type_: String,
}

/// Emitted when a web search call is initiated.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseWebSearchCallInProgressEvent {
    /// Unique ID for the output item associated with the web search call.
    pub item_id: String,
    /// The index of the output item that the web search call is associated with.
    pub output_index: i64,
    /// The sequence number of the web search call being processed.
    pub sequence_number: i64,
    /// The type of the event. Always `response.web_search_call.in_progress`.
    #[serde(rename = "type")]
    pub type_: String,
}

/// Emitted when a web search call is executing.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponseWebSearchCallSearchingEvent {
    /// Unique ID for the output item associated with the web search call.
    pub item_id: String,
    /// The index of the output item that the web search call is associated with.
    pub output_index: i64,
    /// The sequence number of the web search call being processed.
    pub sequence_number: i64,
    /// The type of the event. Always `response.web_search_call.searching`.
    #[serde(rename = "type")]
    pub type_: String,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ResponsesClientEventPromptCacheRetention {
    #[serde(rename = "in-memory")]
    InMemory,
    #[serde(rename = "24h")]
    V24h,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ResponsesClientEventServiceTier {
    #[serde(rename = "auto")]
    Auto,
    #[serde(rename = "default")]
    Default,
    #[serde(rename = "flex")]
    Flex,
    #[serde(rename = "scale")]
    Scale,
    #[serde(rename = "priority")]
    Priority,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ResponsesClientEventTruncation {
    #[serde(rename = "auto")]
    Auto,
    #[serde(rename = "disabled")]
    Disabled,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ResponsesClientEvent {
    /// The type of the client event. Always `response.create`.
    #[serde(rename = "type")]
    pub type_: String,
    /// Whether to run the model response in the background.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub background: Option<bool>,
    /// Context management configuration for this request.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub context_management: Option<Vec<ContextManagement>>,
    /// The conversation that this response belongs to.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub conversation: Option<Conversation>,
    /// Specify additional output data to include in the model response.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub include: Option<Vec<ResponseIncludable>>,
    /// Text, image, or file inputs to the model, used to generate a response.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub input: Option<String>,
    /// A system (or developer) message inserted into the model's context.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub instructions: Option<String>,
    /// An upper bound for the number of tokens that can be generated for a response,
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub max_output_tokens: Option<i64>,
    /// The maximum number of total calls to built-in tools that can be processed in a
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub max_tool_calls: Option<i64>,
    /// Set of 16 key-value pairs that can be attached to an object.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub metadata: Option<serde_json::Value>,
    /// Model ID used to generate the response, like `gpt-4o` or `o3`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub model: Option<serde_json::Value>,
    /// Whether to allow the model to run tool calls in parallel.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub parallel_tool_calls: Option<bool>,
    /// The unique ID of the previous response to the model.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub previous_response_id: Option<String>,
    /// Reference to a prompt template and its variables.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub prompt: Option<ResponsePrompt>,
    /// Used by OpenAI to cache responses for similar requests to optimize your cache
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub prompt_cache_key: Option<String>,
    /// The retention policy for the prompt cache.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub prompt_cache_retention: Option<ResponsesClientEventPromptCacheRetention>,
    /// **gpt-5 and o-series models only**
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub reasoning: Option<serde_json::Value>,
    /// A stable identifier used to help detect users of your application that may be
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub safety_identifier: Option<String>,
    /// Specifies the processing type used for serving the request.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub service_tier: Option<ResponsesClientEventServiceTier>,
    /// Whether to store the generated model response for later retrieval via API.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub store: Option<bool>,
    /// If set to true, the model response data will be streamed to the client as it is
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub stream: Option<bool>,
    /// Options for streaming responses. Only set this when you set `stream: true`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub stream_options: Option<StreamOptions>,
    /// What sampling temperature to use, between 0 and 2.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub temperature: Option<f64>,
    /// Configuration options for a text response from the model.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub text: Option<ResponseTextConfig>,
    /// How the model should select which tool (or tools) to use when generating a
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub tool_choice: Option<ToolChoice>,
    /// An array of tools the model may call while generating a response.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub tools: Option<Vec<Tool>>,
    /// An integer between 0 and 20 specifying the number of most likely tokens to
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub top_logprobs: Option<i64>,
    /// An alternative to sampling with temperature, called nucleus sampling, where the
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub top_p: Option<f64>,
    /// The truncation strategy to use for the model response.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub truncation: Option<ResponsesClientEventTruncation>,
    /// This field is being replaced by `safety_identifier` and `prompt_cache_key`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub user: Option<String>,
}

pub type ResponsesServerEvent = serde_json::Value;

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct SkillReference {
    /// The ID of the referenced skill.
    pub skill_id: String,
    /// References a skill created with the /v1/skills endpoint.
    #[serde(rename = "type")]
    pub type_: String,
    /// Optional skill version. Use a positive integer or 'latest'. Omit for default.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub version: Option<String>,
}

/// A filter object to specify which tools are allowed.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct McpAllowedToolsMcpToolFilter {
    /// Indicates whether or not a tool modifies data or is read-only.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub read_only: Option<bool>,
    /// List of allowed tool names.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub tool_names: Option<Vec<String>>,
}

pub type McpAllowedTools = serde_json::Value;

/// A filter object to specify which tools are allowed.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct McpRequireApprovalMcpToolApprovalFilterAlways {
    /// Indicates whether or not a tool modifies data or is read-only.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub read_only: Option<bool>,
    /// List of allowed tool names.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub tool_names: Option<Vec<String>>,
}

/// A filter object to specify which tools are allowed.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct McpRequireApprovalMcpToolApprovalFilterNever {
    /// Indicates whether or not a tool modifies data or is read-only.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub read_only: Option<bool>,
    /// List of allowed tool names.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub tool_names: Option<Vec<String>>,
}

/// Specify which of the MCP server's tools require approval.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct McpRequireApprovalMcpToolApprovalFilter {
    /// A filter object to specify which tools are allowed.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub always: Option<McpRequireApprovalMcpToolApprovalFilterAlways>,
    /// A filter object to specify which tools are allowed.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub never: Option<McpRequireApprovalMcpToolApprovalFilterNever>,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum McpRequireApproval {
    Always,
    Never,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum McpConnectorId {
    #[serde(rename = "connector_dropbox")]
    ConnectorDropbox,
    #[serde(rename = "connector_gmail")]
    ConnectorGmail,
    #[serde(rename = "connector_googlecalendar")]
    ConnectorGooglecalendar,
    #[serde(rename = "connector_googledrive")]
    ConnectorGoogledrive,
    #[serde(rename = "connector_microsoftteams")]
    ConnectorMicrosoftteams,
    #[serde(rename = "connector_outlookcalendar")]
    ConnectorOutlookcalendar,
    #[serde(rename = "connector_outlookemail")]
    ConnectorOutlookemail,
    #[serde(rename = "connector_sharepoint")]
    ConnectorSharepoint,
}

/// Give the model access to additional tools via remote Model Context Protocol
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct Mcp {
    /// A label for this MCP server, used to identify it in tool calls.
    pub server_label: String,
    /// The type of the MCP tool. Always `mcp`.
    #[serde(rename = "type")]
    pub type_: String,
    /// List of allowed tool names or a filter object.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub allowed_tools: Option<McpAllowedTools>,
    /// An OAuth access token that can be used with a remote MCP server, either with a
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub authorization: Option<String>,
    /// Identifier for service connectors, like those available in ChatGPT.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub connector_id: Option<McpConnectorId>,
    /// Whether this MCP tool is deferred and discovered via tool search.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub defer_loading: Option<bool>,
    /// Optional HTTP headers to send to the MCP server.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub headers: Option<std::collections::HashMap<String, String>>,
    /// Specify which of the MCP server's tools require approval.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub require_approval: Option<McpRequireApproval>,
    /// Optional description of the MCP server, used to provide more context.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub server_description: Option<String>,
    /// The URL for the MCP server.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub server_url: Option<String>,
}

pub type CodeInterpreterContainerCodeInterpreterToolAutoNetworkPolicy = serde_json::Value;

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum CodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit {
    #[serde(rename = "1g")]
    V1g,
    #[serde(rename = "4g")]
    V4g,
    #[serde(rename = "16g")]
    V16g,
    #[serde(rename = "64g")]
    V64g,
}

/// Configuration for a code interpreter container.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct CodeInterpreterContainerCodeInterpreterToolAuto {
    /// Always `auto`.
    #[serde(rename = "type")]
    pub type_: String,
    /// An optional list of uploaded files to make available to your code.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub file_ids: Option<Vec<String>>,
    /// The memory limit for the code interpreter container.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub memory_limit: Option<CodeInterpreterContainerCodeInterpreterToolAutoMemoryLimit>,
    /// Network access policy for the container.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub network_policy: Option<CodeInterpreterContainerCodeInterpreterToolAutoNetworkPolicy>,
}

pub type CodeInterpreterContainer = serde_json::Value;

/// A tool that runs Python code to help generate a response to a prompt.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct CodeInterpreter {
    /// The code interpreter container.
    pub container: CodeInterpreterContainer,
    /// The type of the code interpreter tool. Always `code_interpreter`.
    #[serde(rename = "type")]
    pub type_: String,
}

/// Optional mask for inpainting.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ImageGenerationInputImageMask {
    /// File ID for the mask image.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub file_id: Option<String>,
    /// Base64-encoded mask image.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub image_url: Option<String>,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ImageGenerationAction {
    #[serde(rename = "generate")]
    Generate,
    #[serde(rename = "edit")]
    Edit,
    #[serde(rename = "auto")]
    Auto,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ImageGenerationBackground {
    #[serde(rename = "transparent")]
    Transparent,
    #[serde(rename = "opaque")]
    Opaque,
    #[serde(rename = "auto")]
    Auto,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ImageGenerationInputFidelity {
    #[serde(rename = "high")]
    High,
    #[serde(rename = "low")]
    Low,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ImageGenerationModeration {
    #[serde(rename = "auto")]
    Auto,
    #[serde(rename = "low")]
    Low,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ImageGenerationOutputFormat {
    #[serde(rename = "png")]
    Png,
    #[serde(rename = "webp")]
    Webp,
    #[serde(rename = "jpeg")]
    Jpeg,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ImageGenerationQuality {
    #[serde(rename = "low")]
    Low,
    #[serde(rename = "medium")]
    Medium,
    #[serde(rename = "high")]
    High,
    #[serde(rename = "auto")]
    Auto,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ImageGenerationSize {
    #[serde(rename = "1024x1024")]
    V1024x1024,
    #[serde(rename = "1024x1536")]
    V1024x1536,
    #[serde(rename = "1536x1024")]
    V1536x1024,
    #[serde(rename = "auto")]
    Auto,
}

/// A tool that generates images using the GPT image models.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ImageGeneration {
    /// The type of the image generation tool. Always `image_generation`.
    #[serde(rename = "type")]
    pub type_: String,
    /// Whether to generate a new image or edit an existing image. Default: `auto`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub action: Option<ImageGenerationAction>,
    /// Background type for the generated image.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub background: Option<ImageGenerationBackground>,
    /// Control how much effort the model will exert to match the style and features,
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub input_fidelity: Option<ImageGenerationInputFidelity>,
    /// Optional mask for inpainting.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub input_image_mask: Option<ImageGenerationInputImageMask>,
    /// The image generation model to use. Default: `gpt-image-1`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub model: Option<String>,
    /// Moderation level for the generated image. Default: `auto`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub moderation: Option<ImageGenerationModeration>,
    /// Compression level for the output image. Default: 100.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub output_compression: Option<i64>,
    /// The output format of the generated image.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub output_format: Option<ImageGenerationOutputFormat>,
    /// Number of partial images to generate in streaming mode, from 0 (default value)
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub partial_images: Option<i64>,
    /// The quality of the generated image.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub quality: Option<ImageGenerationQuality>,
    /// The size of the generated image.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub size: Option<ImageGenerationSize>,
}

/// A tool that allows the model to execute shell commands in a local environment.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct LocalShell {
    /// The type of the local shell tool. Always `local_shell`.
    #[serde(rename = "type")]
    pub type_: String,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ToolChoiceAllowedMode {
    #[serde(rename = "auto")]
    Auto,
    #[serde(rename = "required")]
    Required,
}

/// Constrains the tools available to the model to a pre-defined set.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ToolChoiceAllowed {
    /// Constrains the tools available to the model to a pre-defined set.
    pub mode: ToolChoiceAllowedMode,
    /// A list of tool definitions that the model should be allowed to call.
    pub tools: Vec<std::collections::HashMap<String, serde_json::Value>>,
    /// Allowed tool configuration type. Always `allowed_tools`.
    #[serde(rename = "type")]
    pub type_: String,
}

/// Forces the model to call the apply_patch tool when executing a tool call.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ToolChoiceApplyPatch {
    /// The tool to call. Always `apply_patch`.
    #[serde(rename = "type")]
    pub type_: String,
}

/// Use this option to force the model to call a specific custom tool.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ToolChoiceCustom {
    /// The name of the custom tool to call.
    pub name: String,
    /// For custom tool calling, the type is always `custom`.
    #[serde(rename = "type")]
    pub type_: String,
}

/// Use this option to force the model to call a specific tool on a remote MCP server.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ToolChoiceMcp {
    /// The label of the MCP server to use.
    pub server_label: String,
    /// For MCP tools, the type is always `mcp`.
    #[serde(rename = "type")]
    pub type_: String,
    /// The name of the tool to call on the server.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub name: Option<String>,
}

/// Forces the model to call the shell tool when a tool call is required.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ToolChoiceShell {
    /// The tool to call. Always `shell`.
    #[serde(rename = "type")]
    pub type_: String,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ToolChoiceTypesType {
    #[serde(rename = "file_search")]
    FileSearch,
    #[serde(rename = "web_search_preview")]
    WebSearchPreview,
    #[serde(rename = "computer")]
    Computer,
    #[serde(rename = "computer_use_preview")]
    ComputerUsePreview,
    #[serde(rename = "computer_use")]
    ComputerUse,
    #[serde(rename = "web_search_preview_2025_03_11")]
    WebSearchPreview20250311,
    #[serde(rename = "image_generation")]
    ImageGeneration,
    #[serde(rename = "code_interpreter")]
    CodeInterpreter,
}

/// Indicates that the model should use a built-in tool to generate a response.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ToolChoiceTypes {
    /// The type of hosted tool the model should to use.
    #[serde(rename = "type")]
    pub type_: ToolChoiceTypesType,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum ToolSearchToolExecution {
    #[serde(rename = "server")]
    Server,
    #[serde(rename = "client")]
    Client,
}

/// Hosted or BYOT tool search configuration for deferred tools.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ToolSearchTool {
    /// The type of the tool. Always `tool_search`.
    #[serde(rename = "type")]
    pub type_: String,
    /// Description shown to the model for a client-executed tool search tool.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub description: Option<String>,
    /// Whether tool search is executed by the server or by the client.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub execution: Option<ToolSearchToolExecution>,
    /// Parameter schema for a client-executed tool search tool.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub parameters: Option<serde_json::Value>,
}

/// The user's location.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct UserLocation {
    /// The type of location approximation. Always `approximate`.
    #[serde(rename = "type")]
    pub type_: String,
    /// Free text input for the city of the user, e.g. `San Francisco`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub city: Option<String>,
    /// The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub country: Option<String>,
    /// Free text input for the region of the user, e.g. `California`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub region: Option<String>,
    /// The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub timezone: Option<String>,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum WebSearchPreviewToolType {
    #[serde(rename = "web_search_preview")]
    WebSearchPreview,
    #[serde(rename = "web_search_preview_2025_03_11")]
    WebSearchPreview20250311,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum WebSearchPreviewToolSearchContextSize {
    #[serde(rename = "low")]
    Low,
    #[serde(rename = "medium")]
    Medium,
    #[serde(rename = "high")]
    High,
}

/// This tool searches the web for relevant results to use in a response.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct WebSearchPreviewTool {
    /// The type of the web search tool.
    #[serde(rename = "type")]
    pub type_: WebSearchPreviewToolType,
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub search_content_types: Option<Vec<serde_json::Value>>,
    /// High level guidance for the amount of context window space to use for the
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub search_context_size: Option<WebSearchPreviewToolSearchContextSize>,
    /// The user's location.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub user_location: Option<UserLocation>,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum WebSearchToolType {
    #[serde(rename = "web_search")]
    WebSearch,
    #[serde(rename = "web_search_2025_08_26")]
    WebSearch20250826,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum WebSearchToolSearchContextSize {
    #[serde(rename = "low")]
    Low,
    #[serde(rename = "medium")]
    Medium,
    #[serde(rename = "high")]
    High,
}

/// Search the Internet for sources related to the prompt.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct WebSearchTool {
    /// The type of the web search tool.
    #[serde(rename = "type")]
    pub type_: WebSearchToolType,
    /// Filters for the search.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub filters: Option<Filters>,
    /// High level guidance for the amount of context window space to use for the
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub search_context_size: Option<WebSearchToolSearchContextSize>,
    /// The approximate location of the user.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub user_location: Option<UserLocation>,
}