File size: 118,223 Bytes
627ba70
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Welcome to the Second Lab - Week 1, Day 3\n",
    "\n",
    "Today we will work with lots of models! This is a way to get comfortable with APIs."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<table style=\"margin: 0; text-align: left; width:100%\">\n",
    "    <tr>\n",
    "        <td style=\"width: 150px; height: 150px; vertical-align: middle;\">\n",
    "            <img src=\"../assets/stop.png\" width=\"150\" height=\"150\" style=\"display: block;\" />\n",
    "        </td>\n",
    "        <td>\n",
    "            <h2 style=\"color:#ff7800;\">Important point - please read</h2>\n",
    "            <span style=\"color:#ff7800;\">The way I collaborate with you may be different to other courses you've taken. I prefer not to type code while you watch. Rather, I execute Jupyter Labs, like this, and give you an intuition for what's going on. My suggestion is that you carefully execute this yourself, <b>after</b> watching the lecture. Add print statements to understand what's going on, and then come up with your own variations.<br/><br/>If you have time, I'd love it if you submit a PR for changes in the community_contributions folder - instructions in the resources. Also, if you have a Github account, use this to showcase your variations. Not only is this essential practice, but it demonstrates your skills to others, including perhaps future clients or employers...\n",
    "            </span>\n",
    "        </td>\n",
    "    </tr>\n",
    "</table>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Start with imports - ask ChatGPT to explain any package that you don't know\n",
    "\n",
    "import os\n",
    "import json\n",
    "from dotenv import load_dotenv\n",
    "from openai import OpenAI\n",
    "from anthropic import Anthropic\n",
    "from IPython.display import Markdown, display"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Always remember to do this!\n",
    "load_dotenv(override=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "OpenAI API Key exists and begins sk-proj-\n",
      "Anthropic API Key exists and begins sk-ant-\n",
      "Google API Key exists and begins AI\n",
      "DeepSeek API Key exists and begins sk-\n",
      "Groq API Key exists and begins gsk_\n"
     ]
    }
   ],
   "source": [
    "# Print the key prefixes to help with any debugging\n",
    "\n",
    "openai_api_key = os.getenv('OPENAI_API_KEY')\n",
    "anthropic_api_key = os.getenv('ANTHROPIC_API_KEY')\n",
    "google_api_key = os.getenv('GOOGLE_API_KEY')\n",
    "deepseek_api_key = os.getenv('DEEPSEEK_API_KEY')\n",
    "groq_api_key = os.getenv('GROQ_API_KEY')\n",
    "\n",
    "if openai_api_key:\n",
    "    print(f\"OpenAI API Key exists and begins {openai_api_key[:8]}\")\n",
    "else:\n",
    "    print(\"OpenAI API Key not set\")\n",
    "    \n",
    "if anthropic_api_key:\n",
    "    print(f\"Anthropic API Key exists and begins {anthropic_api_key[:7]}\")\n",
    "else:\n",
    "    print(\"Anthropic API Key not set (and this is optional)\")\n",
    "\n",
    "if google_api_key:\n",
    "    print(f\"Google API Key exists and begins {google_api_key[:2]}\")\n",
    "else:\n",
    "    print(\"Google API Key not set (and this is optional)\")\n",
    "\n",
    "if deepseek_api_key:\n",
    "    print(f\"DeepSeek API Key exists and begins {deepseek_api_key[:3]}\")\n",
    "else:\n",
    "    print(\"DeepSeek API Key not set (and this is optional)\")\n",
    "\n",
    "if groq_api_key:\n",
    "    print(f\"Groq API Key exists and begins {groq_api_key[:4]}\")\n",
    "else:\n",
    "    print(\"Groq API Key not set (and this is optional)\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "request = \"Please come up with a challenging, nuanced question that I can ask a number of LLMs to evaluate their intelligence. \"\n",
    "request += \"Answer only with the question, no explanation.\"\n",
    "messages = [{\"role\": \"user\", \"content\": request}]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[{'role': 'user',\n",
       "  'content': 'Please come up with a challenging, nuanced question that I can ask a number of LLMs to evaluate their intelligence. Answer only with the question, no explanation.'}]"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "messages"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "How would you design a societal system that balances the benefits of technological advancement with the ethical implications of potential job displacement, ensuring inclusivity and equity for all socioeconomic classes?\n"
     ]
    }
   ],
   "source": [
    "openai = OpenAI()\n",
    "response = openai.chat.completions.create(\n",
    "    model=\"gpt-4o-mini\",\n",
    "    messages=messages,\n",
    ")\n",
    "question = response.choices[0].message.content\n",
    "print(question)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "competitors = []\n",
    "answers = []\n",
    "messages = [{\"role\": \"user\", \"content\": question}]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/markdown": [
       "Designing a societal system that balances technological advancement with ethical considerations, particularly addressing potential job displacement and ensuring inclusivity and equity, requires a multifaceted approach. Here are key components for such a system:\n",
       "\n",
       "### 1. **Comprehensive Education and Upskilling Programs**\n",
       "\n",
       "- **Lifelong Learning Initiatives**: Implement accessible lifelong learning programs that provide skills training, particularly in fields less likely to be automated and in emerging industries.\n",
       "- **Public-Private Partnerships**: Collaborate with businesses to create training programs aligned with labor market needs, ensuring that workers can transition to new roles.\n",
       "- **Digital Literacy**: Enhance digital literacy from early education to help individuals adapt to changing technological landscapes.\n",
       "\n",
       "### 2. **Universal Basic Income (UBI) or Social Safety Nets**\n",
       "\n",
       "- **Financial Security**: Explore UBI or enhanced unemployment benefits as a buffer for those displaced by technology, ensuring a basic standard of living while they retrain or find new employment.\n",
       "- **Support for Transition**: Create funds that assist individuals during their transition to new careers and invest in mental health and support services.\n",
       "\n",
       "### 3. **Flexible Work Arrangements**\n",
       "\n",
       "- **Gig Economy Regulations**: Establish regulations to protect gig workers and ensure they have access to benefits such as healthcare, retirement plans, and job security.\n",
       "- **Remote Work Opportunities**: Promote remote work as a standard option to open jobs to a wider audience and accommodate varying needs of the workforce.\n",
       "\n",
       "### 4. **Inclusive Policy Making**\n",
       "\n",
       "- **Diverse Stakeholder Engagement**: Ensure that policy decisions about technology and employment involve diverse stakeholders, including workers, communities, and experts from various fields.\n",
       "- **Feedback Mechanisms**: Implement systems for regular feedback from workers and communities affected by technological changes, allowing for agile policy adaptations.\n",
       "\n",
       "### 5. **Technological Responsiveness**\n",
       "\n",
       "- **Ethical Oversight and Regulation**: Develop ethical frameworks for technology deployment that prioritize human welfare and minimize harm, including regular assessments of automation impacts on employment.\n",
       "- **Promotion of Human-Centric Technologies**: Encourage the development and use of technologies that complement human abilities rather than replace them, fostering collaboration between machines and workers.\n",
       "\n",
       "### 6. **Investment in Public Infrastructure and Services**\n",
       "\n",
       "- **Infrastructure Jobs**: Invest in infrastructure projects that create jobs in communities, which can counterbalance some impacts of automation.\n",
       "- **Healthcare and Well-being**: Strengthen healthcare, mental health services, and community support systems to ensure no one falls through the cracks as economies transition.\n",
       "\n",
       "### 7. **Encouragement of Social Enterprises**\n",
       "\n",
       "- **Support for Startups and Cooperatives**: Foster social enterprises that prioritize community well-being and job creation over profit maximization.\n",
       "- **Incentives for Businesses**: Provide incentives for companies that adopt practices ensuring equitable pay, diverse hiring, and community investment.\n",
       "\n",
       "### 8. **Research and Development Funding**\n",
       "\n",
       "- **Public Investment in R&D**: Increase public funding for research that focuses on technology's impact on society, ensuring advancements align with societal needs.\n",
       "- **Focus on Accessibility**: Promote research into technologies that benefit underserved communities, addressing inequalities exacerbated by technological advances.\n",
       "\n",
       "### 9. **Community-Based Approaches**\n",
       "\n",
       "- **Local Solutions**: Encourage local governance and community-led initiatives to design solutions that are culturally and contextually relevant to specific populations.\n",
       "- **Civic Engagement**: Empower local communities to participate actively in conversations about technology and work, fostering a sense of ownership and responsibility.\n",
       "\n",
       "### 10. **Global Collaboration**\n",
       "\n",
       "- **International Cooperation**: Collaborate with other nations on best practices for technology advancement and labor rights, ensuring that global standards support equitable outcomes.\n",
       "- **Development Aid**: Assist developing countries in leveraging technology for local economic development, preventing inequity at a global scale.\n",
       "\n",
       "### Conclusion\n",
       "\n",
       "The balance between technological advancement and ethical considerations regarding job displacement requires a proactive, inclusive societal approach. By engaging stakeholders at all levels, investing in education and safety nets, and promoting ethical practices, we can harness technology's benefits while minimizing harmful impacts on the workforce, ensuring a fair future for all."
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# The API we know well\n",
    "\n",
    "model_name = \"gpt-4o-mini\"\n",
    "\n",
    "response = openai.chat.completions.create(model=model_name, messages=messages)\n",
    "answer = response.choices[0].message.content\n",
    "\n",
    "display(Markdown(answer))\n",
    "competitors.append(model_name)\n",
    "answers.append(answer)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "# # Anthropic has a slightly different API, and Max Tokens is required\n",
    "\n",
    "# model_name = \"claude-3-7-sonnet-latest\"\n",
    "\n",
    "# claude = Anthropic()\n",
    "# response = claude.messages.create(model=model_name, messages=messages, max_tokens=1000)\n",
    "# answer = response.content[0].text\n",
    "\n",
    "# display(Markdown(answer))\n",
    "# competitors.append(model_name)\n",
    "# answers.append(answer)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/markdown": [
       "Designing a societal system that balances technological advancement with ethical considerations, job displacement, inclusivity, and equity is a complex challenge requiring a multi-pronged approach. Here's a proposed design:\n",
       "\n",
       "**I. Foundational Principles:**\n",
       "\n",
       "*   **Human-Centered Technology:**  Technology should serve humanity, not the other way around.  Development should prioritize human well-being, dignity, and purpose.\n",
       "*   **Shared Prosperity:**  The benefits of technological advancement should be broadly distributed, not concentrated in the hands of a few.\n",
       "*   **Lifelong Learning & Adaptability:** Education and training systems must be agile and responsive to evolving skill demands.  Individuals need to be equipped for continuous learning.\n",
       "*   **Strong Social Safety Net:**  A robust safety net is essential to provide basic security and support during periods of transition and disruption.\n",
       "*   **Ethical Governance:**  Governance structures must proactively address the ethical implications of new technologies and ensure accountability.\n",
       "*   **Democratization of Technology:** Broadening access to technology, digital literacy, and innovation opportunities for all.\n",
       "*   **Environmental Sustainability:** Integrating environmental considerations into technological development and deployment to prevent negative ecological consequences.\n",
       "\n",
       "**II. Key Pillars & Mechanisms:**\n",
       "\n",
       "*   **A. Education & Skills Development:**\n",
       "\n",
       "    *   **Future-Oriented Curriculum:** Shift education focus to critical thinking, problem-solving, creativity, collaboration, emotional intelligence, and adaptability – skills less susceptible to automation. Incorporate ethics training related to AI, biotechnology, and other emerging fields.\n",
       "    *   **Universal Access to High-Quality Education:** Ensure equitable access to quality education from early childhood to higher education, regardless of socioeconomic background.\n",
       "    *   **Vocational Training & Apprenticeships:**  Invest in robust vocational training programs and apprenticeships that provide practical skills aligned with industry needs. Partner with businesses to ensure relevance.\n",
       "    *   **Lifelong Learning Accounts (LILA):** Provide individuals with government-funded accounts that can be used for retraining, upskilling, and acquiring new skills throughout their lives. Offer personalized learning pathways.\n",
       "    *   **Digital Literacy Programs:**  Widespread digital literacy initiatives to empower individuals to navigate the digital world effectively and participate in the digital economy.\n",
       "\n",
       "*   **B. Economic Policies & Job Creation:**\n",
       "\n",
       "    *   **Investment in New Industries:**  Proactively invest in emerging industries and technologies that create new job opportunities (e.g., renewable energy, sustainable agriculture, biotechnology, personalized medicine, circular economy).\n",
       "    *   **Support for Small Businesses & Entrepreneurship:**  Provide funding, mentorship, and regulatory support for small businesses and entrepreneurs, which are often significant job creators.\n",
       "    *   **Targeted Job Creation Programs:**  Develop geographically targeted job creation programs that address the specific needs of communities most affected by job displacement.\n",
       "    *   **Reforming Labor Laws:**  Adapt labor laws to the changing nature of work, including the gig economy, remote work, and alternative employment models. Consider policies that promote worker cooperatives and employee ownership.\n",
       "    *   **Job Guarantee/Public Works Programs:** Explore the feasibility of job guarantee programs or expanded public works projects that provide employment opportunities in areas such as infrastructure development, environmental conservation, and community service.\n",
       "    *   **Reduced Work Week:** Examine the potential of a shorter work week with no reduction in pay as a way to distribute available work more equitably and improve work-life balance.\n",
       "\n",
       "*   **C. Social Safety Net & Income Redistribution:**\n",
       "\n",
       "    *   **Universal Basic Income (UBI) or Guaranteed Minimum Income (GMI):**  Explore the implementation of a UBI or GMI to provide a basic level of income security to all citizens, regardless of employment status.  Pilot programs and rigorous evaluation are crucial.\n",
       "    *   **Strengthened Social Security & Unemployment Benefits:**  Strengthen existing social security and unemployment benefits to provide a safety net for those who lose their jobs or face economic hardship.\n",
       "    *   **Progressive Taxation:** Implement a progressive tax system where higher earners pay a larger percentage of their income in taxes to fund social programs and redistribute wealth.\n",
       "    *   **Wealth Tax:** Consider a wealth tax on the assets of the wealthiest individuals to generate revenue for public services and address wealth inequality.\n",
       "    *   **Expansion of Public Services:** Invest in public services such as healthcare, education, affordable housing, and transportation to improve the quality of life for all citizens.\n",
       "\n",
       "*   **D. Ethical Oversight & Governance:**\n",
       "\n",
       "    *   **AI Ethics Boards:** Establish independent AI ethics boards to oversee the development and deployment of AI technologies and ensure that they are used ethically and responsibly.\n",
       "    *   **Data Privacy Regulations:** Implement strong data privacy regulations to protect individuals' personal data from misuse and exploitation.\n",
       "    *   **Algorithmic Transparency & Accountability:**  Require transparency in the algorithms used in decision-making processes and hold developers accountable for the fairness and accuracy of their algorithms.\n",
       "    *   **Public Dialogue & Engagement:**  Foster public dialogue and engagement on the ethical implications of new technologies and ensure that diverse perspectives are considered in policy-making.\n",
       "    *   **International Cooperation:**  Promote international cooperation on the ethical governance of technology to address global challenges such as AI bias, data security, and autonomous weapons.\n",
       "\n",
       "*   **E. Democratization of Technology & Innovation:**\n",
       "\n",
       "    *   **Open-Source Technologies:** Support the development and adoption of open-source technologies to promote innovation and reduce dependence on proprietary systems.\n",
       "    *   **Community Innovation Hubs:** Create community innovation hubs that provide access to technology, training, and mentorship for aspiring entrepreneurs and innovators.\n",
       "    *   **Crowdfunding & Alternative Finance:** Encourage the use of crowdfunding and other alternative financing mechanisms to support innovative projects and startups.\n",
       "    *   **Citizen Science Initiatives:** Support citizen science initiatives that involve the public in scientific research and data collection.\n",
       "    *   **Decentralized Autonomous Organizations (DAOs):** Explore the potential of DAOs to empower communities to participate in decision-making and resource allocation.\n",
       "\n",
       "**III. Implementation & Monitoring:**\n",
       "\n",
       "*   **Pilot Programs & Experimentation:**  Implement pilot programs and experiments to test different policies and approaches before widespread implementation.\n",
       "*   **Data Collection & Analysis:**  Collect and analyze data on the impact of technology on employment, inequality, and social well-being.\n",
       "*   **Regular Evaluation & Adaptation:**  Regularly evaluate the effectiveness of policies and programs and adapt them as needed based on data and feedback.\n",
       "*   **Stakeholder Engagement:**  Engage with stakeholders from all sectors of society, including government, business, labor, academia, and civil society, to ensure that policies are effective and equitable.\n",
       "\n",
       "**Challenges & Considerations:**\n",
       "\n",
       "*   **Political Will:** Implementing these policies requires significant political will and a commitment to addressing the challenges of technological change.\n",
       "*   **Funding:**  Funding these initiatives will require significant investment and may necessitate tax increases or reallocation of resources.\n",
       "*   **Implementation Complexity:**  Implementing these policies will be complex and require careful planning and coordination.\n",
       "*   **Unforeseen Consequences:** It is important to be aware of the potential for unforeseen consequences and to be prepared to adapt policies as needed.\n",
       "*   **Global Cooperation:** Many of these challenges are global in nature and require international cooperation to address effectively.\n",
       "\n",
       "**Conclusion:**\n",
       "\n",
       "This is a framework, not a blueprint.  The specific policies and programs that are most appropriate will depend on the specific context and needs of each society.  However, by embracing the principles of human-centered technology, shared prosperity, lifelong learning, and ethical governance, we can create a future where technology benefits all of humanity. It requires constant vigilance, adaptation, and a commitment to equitable outcomes.  This is an ongoing process, not a destination.\n"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "gemini = OpenAI(api_key=google_api_key, base_url=\"https://generativelanguage.googleapis.com/v1beta/openai/\")\n",
    "model_name = \"gemini-2.0-flash\"\n",
    "\n",
    "response = gemini.chat.completions.create(model=model_name, messages=messages)\n",
    "answer = response.choices[0].message.content\n",
    "\n",
    "display(Markdown(answer))\n",
    "competitors.append(model_name)\n",
    "answers.append(answer)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "# deepseek = OpenAI(api_key=deepseek_api_key, base_url=\"https://api.deepseek.com/v1\")\n",
    "# model_name = \"deepseek-chat\"\n",
    "\n",
    "# response = deepseek.chat.completions.create(model=model_name, messages=messages)\n",
    "# answer = response.choices[0].message.content\n",
    "\n",
    "# display(Markdown(answer))\n",
    "# competitors.append(model_name)\n",
    "# answers.append(answer)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/markdown": [
       "Designing a societal system that balances the benefits of technological advancement with the ethical implications of potential job displacement requires a multi-faceted approach that prioritizes inclusivity, equity, and social welfare. Here's a potential framework:\n",
       "\n",
       "**I. Educational and Training Infrastructure**\n",
       "\n",
       "1. **Lifelong Learning**: Implement a lifelong learning program that provides free or low-cost education and training for workers to acquire new skills and adapt to changing job requirements.\n",
       "2. **Vocational Training**: Offer vocational training in emerging fields, such as AI, data science, and renewable energy, to equip workers with in-demand skills.\n",
       "3. **Upskilling and Reskilling**: Encourage companies to invest in upskilling and reskilling programs for their employees, ensuring they remain competitive in the job market.\n",
       "\n",
       "**II. Social Safety Nets and Support**\n",
       "\n",
       "1. **Universal Basic Income (UBI)**: Consider implementing a UBI or a guaranteed minimum income to ensure that all citizens have a basic level of economic security, regardless of their employment status.\n",
       "2. **Worker Re-training and Placement**: Establish programs to help displaced workers transition to new industries or roles, including job placement services and career counseling.\n",
       "3. **Mental Health Support**: Provide access to mental health resources and counseling to help workers cope with the stress and uncertainty of job displacement.\n",
       "\n",
       "**III. Inclusive and Equitable Economic Policies**\n",
       "\n",
       "1. **Progressive Taxation**: Implement a progressive taxation system, where corporations and high-income individuals are taxed at a higher rate to fund social programs and support for displaced workers.\n",
       "2. **Social Entrepreneurship**: Encourage social entrepreneurship and social impact investing to create jobs and stimulate economic growth in underserved communities.\n",
       "3. **Cooperative Ownership**: Foster cooperative ownership models, such as worker-owned cooperatives or community land trusts, to promote community wealth and economic empowerment.\n",
       "\n",
       "**IV. Technological Governance and Regulation**\n",
       "\n",
       "1. **AI and Automation Regulation**: Establish regulations and guidelines for the development and deployment of AI and automation technologies, ensuring that they prioritize human well-being and social welfare.\n",
       "2. **Data Protection and Transparency**: Implement robust data protection and transparency measures to prevent exploitation and ensure that individuals have control over their personal data.\n",
       "3. **Technological Assessment and Impact Analysis**: Conduct regular assessments of new technologies to understand their potential impact on employment and social welfare, and develop strategies to mitigate negative effects.\n",
       "\n",
       "**V. Community Engagement and Participation**\n",
       "\n",
       "1. **Public Engagement and Consultation**: Engage with citizens, workers, and community organizations to gather feedback and input on technological development and deployment, ensuring that their concerns and needs are addressed.\n",
       "2. **Participatory Governance**: Establish participatory governance structures, such as citizen juries or community assemblies, to involve stakeholders in decision-making processes related to technological development and social policy.\n",
       "3. **Inclusive and Representative Decision-Making**: Ensure that decision-making bodies, such as regulatory agencies or corporate boards, are representative of diverse socioeconomic backgrounds and perspectives.\n",
       "\n",
       "**VI. Cultural and Social Adaptation**\n",
       "\n",
       "1. **Cultural Competence and Awareness**: Promote cultural competence and awareness among policymakers, business leaders, and the general public to recognize and address the social and cultural implications of technological change.\n",
       "2. **Social Cohesion and Community Building**: Invest in community building and social cohesion initiatives to foster a sense of belonging and solidarity among citizens, particularly in areas experiencing significant technological disruption.\n",
       "3. **Narratives and Storytelling**: Develop and promote narratives and storytelling that highlight the human impact of technological change, promoting empathy and understanding among different socioeconomic groups.\n",
       "\n",
       "By implementing this framework, societies can create a more inclusive and equitable system that balances the benefits of technological advancement with the need to support workers and communities affected by job displacement. Ultimately, this approach requires a fundamental transformation of our economic and social systems, prioritizing human well-being, social welfare, and environmental sustainability over profit and technological progress alone."
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "groq = OpenAI(api_key=groq_api_key, base_url=\"https://api.groq.com/openai/v1\")\n",
    "model_name = \"llama-3.3-70b-versatile\"\n",
    "\n",
    "response = groq.chat.completions.create(model=model_name, messages=messages)\n",
    "answer = response.choices[0].message.content\n",
    "\n",
    "display(Markdown(answer))\n",
    "competitors.append(model_name)\n",
    "answers.append(answer)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## For the next cell, we will use Ollama\n",
    "\n",
    "Ollama runs a local web service that gives an OpenAI compatible endpoint,  \n",
    "and runs models locally using high performance C++ code.\n",
    "\n",
    "If you don't have Ollama, install it here by visiting https://ollama.com then pressing Download and following the instructions.\n",
    "\n",
    "After it's installed, you should be able to visit here: http://localhost:11434 and see the message \"Ollama is running\"\n",
    "\n",
    "You might need to restart Cursor (and maybe reboot). Then open a Terminal (control+\\`) and run `ollama serve`\n",
    "\n",
    "Useful Ollama commands (run these in the terminal, or with an exclamation mark in this notebook):\n",
    "\n",
    "`ollama pull <model_name>` downloads a model locally  \n",
    "`ollama ls` lists all the models you've downloaded  \n",
    "`ollama rm <model_name>` deletes the specified model from your downloads"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<table style=\"margin: 0; text-align: left; width:100%\">\n",
    "    <tr>\n",
    "        <td style=\"width: 150px; height: 150px; vertical-align: middle;\">\n",
    "            <img src=\"../assets/stop.png\" width=\"150\" height=\"150\" style=\"display: block;\" />\n",
    "        </td>\n",
    "        <td>\n",
    "            <h2 style=\"color:#ff7800;\">Super important - ignore me at your peril!</h2>\n",
    "            <span style=\"color:#ff7800;\">The model called <b>llama3.3</b> is FAR too large for home computers - it's not intended for personal computing and will consume all your resources! Stick with the nicely sized <b>llama3.2</b> or <b>llama3.2:1b</b> and if you want larger, try llama3.1 or smaller variants of Qwen, Gemma, Phi or DeepSeek. See the <A href=\"https://ollama.com/models\">the Ollama models page</a> for a full list of models and sizes.\n",
    "            </span>\n",
    "        </td>\n",
    "    </tr>\n",
    "</table>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "# !ollama pull llama3.2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [],
   "source": [
    "# ollama = OpenAI(base_url='http://localhost:11434/v1', api_key='ollama')\n",
    "# model_name = \"llama3.2\"\n",
    "\n",
    "# response = ollama.chat.completions.create(model=model_name, messag es=messages)\n",
    "# answer = response.choices[0].message.content\n",
    "\n",
    "# display(Markdown(answer))\n",
    "# competitors.append(model_name)\n",
    "# answers.append(answer)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['gpt-4o-mini', 'gemini-2.0-flash', 'llama-3.3-70b-versatile']\n",
      "['Designing an ethical framework for artificial intelligence (AI) that balances user autonomy, societal benefit, and potential risks involves a holistic approach. Here are the key principles I would incorporate, along with strategies to address conflicts that may arise:\\n\\n### Key Principles:\\n\\n1. **User Autonomy**\\n   - **Informed Consent**: Users should be fully informed about how their data is collected, used, and shared, ensuring they can make educated choices.\\n   - **Control and Customization**: Users should have control over their AI interactions, including customization options that allow them to tailor experiences to their personal values and preferences.\\n\\n2. **Beneficence and Societal Benefit**\\n   - **Promotion of Well-being**: AI should be designed to enhance human well-being and societal good, focusing on applications that address social issues such as health, education, and environmental sustainability.\\n   - **Equity and Inclusion**: AI systems should aim to reduce inequalities, ensuring that all societal groups have access to the benefits of AI and that disadvantages are not exacerbated.\\n\\n3. **Transparency and Explainability**\\n   - **Accountability**: AI systems should operate transparently, allowing users and stakeholders to understand how decisions are made and to hold entities accountable.\\n   - **Explainable AI**: Ensuring that AI algorithms can be understood and interpreted by users, fostering trust and enabling informed decision-making.\\n\\n4. **Safety and Risk Mitigation**\\n   - **Robustness and Security**: AI systems must be developed to be safe, secure, and resilient against misuse, errors, or adversarial attacks.\\n   - **Risk Assessment and Management**: Implement continuous processes for identifying, assessing, and mitigating risks associated with AI deployment.\\n\\n5. **Adaptive Governance**\\n   - **Dynamic Regulations**: Create a regulatory framework that can adapt to technological advancements and societal changes, ensuring that AI evolves in alignment with societal values.\\n   - **Stakeholder Engagement**: Involve diverse stakeholders (e.g., ethicists, technologists, community representatives) in the design, implementation, and governance of AI systems.\\n\\n### Addressing Conflicts:\\n\\n- **User Autonomy vs. Societal Benefit**: \\n   - **Approach**: Implement dual consent frameworks where users have a right to opt-in for societal benefit-driven features (e.g., data sharing for public health) while retaining the option to withdraw.\\n   - **Conflict Resolution**: Use anonymized data methods that allow societal benefits while protecting individual identities and privacy.\\n\\n- **Transparency vs. Proprietary Technology**: \\n   - **Approach**: Strike a balance by ensuring that critical aspects of decision-making are transparent without revealing proprietary algorithms. \\n   - **Conflict Resolution**: Establish independent review boards to assess the fairness and transparency of algorithms used in high-stakes settings, ensuring accountability without compromising business interests.\\n\\n- **Risk Mitigation vs. Innovation**: \\n   - **Approach**: Foster a culture of ethical innovation where risk assessments are integral to development processes. Encourage a \"fail-safe\" mentality that prioritizes safety in experimental phases.\\n   - **Conflict Resolution**: Introduce graduated testing and deployment phases, with strict monitoring protocols in place to manage risks alongside progressive innovation.\\n\\n### Conclusion:\\n\\nThe ethical framework should be dynamic and adaptable, allowing for continuous updates as technology and societal norms evolve. Through implementing these principles and strategies, it\\'s possible to create a balanced approach to AI that upholds user autonomy, promotes societal benefit, and effectively mitigates potential risks.', \"Designing an ethical framework for AI is a complex task, as it requires balancing individual freedom with collective well-being and mitigating potential harms. Here's my approach, incorporating key principles and conflict resolution strategies:\\n\\n**Key Principles:**\\n\\n1.  **Human-Centeredness:**\\n    *   **Definition:** AI should primarily serve humanity and promote human flourishing. Its development and deployment should prioritize human needs, values, and well-being.\\n    *   **Implementation:**  Prioritize accessibility for all demographics, focusing on education and training to enable humans to interact and utilize AI effectively. Regularly solicit user feedback to continuously improve the AI's design and functionality based on human needs.\\n    *   **Connection to Core Values:**  Links to respect for human dignity, equality, and social justice.\\n\\n2.  **Autonomy & Agency:**\\n    *   **Definition:** Users should retain control over their data and interactions with AI systems.  Transparency and explainability are crucial for informed consent and understanding.\\n    *   **Implementation:**\\n        *   **Transparent AI:** Make algorithms and decision-making processes as transparent as possible, within reasonable limits (considering trade secrets and system security).\\n        *   **Explainable AI (XAI):** Provide users with explanations for AI's decisions that affect them, focusing on the relevant factors and reasoning.\\n        *   **Data Ownership & Control:**  Give users ownership and control over their data, including the right to access, modify, and delete it.  Implement clear and concise privacy policies.\\n        *   **Opt-in/Opt-out:**  Offer clear and easy-to-use mechanisms for opting in or out of AI-driven services and data collection.\\n        *   **Human-in-the-Loop:** Where consequential decisions are being made, human oversight is essential. This ensures accountability and allows for human judgment to override AI recommendations when necessary.\\n    *   **Connection to Core Values:**  Links to freedom, self-determination, and privacy.\\n\\n3.  **Beneficence & Non-Maleficence:**\\n    *   **Definition:** AI should be designed to maximize benefits and minimize harms to individuals, society, and the environment.\\n    *   **Implementation:**\\n        *   **Risk Assessment:** Conduct thorough risk assessments throughout the AI lifecycle (design, development, deployment, and monitoring) to identify potential harms (e.g., bias, discrimination, job displacement, security vulnerabilities).\\n        *   **Bias Mitigation:**  Develop and implement techniques to detect and mitigate biases in AI systems, including data bias, algorithmic bias, and human bias.\\n        *   **Robustness & Reliability:**  Ensure that AI systems are robust, reliable, and resilient to adversarial attacks and unexpected inputs.\\n        *   **Safety Standards:** Develop and adhere to rigorous safety standards for AI systems, particularly in high-risk applications (e.g., autonomous vehicles, medical devices).\\n        *   **Environmental Sustainability:** Consider the environmental impact of AI systems, including energy consumption and resource usage.\\n    *   **Connection to Core Values:** Links to welfare, security, and environmental responsibility.\\n\\n4.  **Fairness & Justice:**\\n    *   **Definition:** AI systems should be designed and used in a way that promotes fairness, equity, and justice, and avoids discrimination.\\n    *   **Implementation:**\\n        *   **Equal Opportunity:** Ensure that AI systems provide equal opportunities to all individuals, regardless of their race, ethnicity, gender, religion, sexual orientation, or other protected characteristics.\\n        *   **Algorithmic Auditing:**  Implement independent audits of AI systems to assess their fairness and identify potential biases.\\n        *   **Redress Mechanisms:**  Establish clear mechanisms for individuals to challenge AI decisions that they believe are unfair or discriminatory.\\n        *   **Addressing Disparities:**  Proactively address existing societal disparities that may be exacerbated by AI systems.\\n    *   **Connection to Core Values:**  Links to equality, impartiality, and distributive justice.\\n\\n5.  **Accountability & Responsibility:**\\n    *   **Definition:**  Clear lines of accountability must be established for the actions and decisions of AI systems.\\n    *   **Implementation:**\\n        *   **Identify Responsible Parties:**  Clearly identify the individuals and organizations responsible for the design, development, deployment, and monitoring of AI systems.\\n        *   **Traceability:**  Ensure that the decision-making processes of AI systems are traceable and auditable.\\n        *   **Legal & Regulatory Framework:** Develop a legal and regulatory framework that holds individuals and organizations accountable for the harms caused by AI systems.\\n        *   **Ethical Review Boards:**  Establish ethical review boards to oversee the development and deployment of AI systems, particularly in high-risk applications.\\n    *   **Connection to Core Values:**  Links to integrity, transparency, and rule of law.\\n\\n**Addressing Conflicts Between Principles:**\\n\\nConflicts between these principles are inevitable. For example:\\n\\n*   **Autonomy vs. Societal Benefit:**  Personalized recommendation systems might enhance user experience (autonomy) but also contribute to echo chambers and political polarization (harming societal benefit).\\n*   **Beneficence vs. Accountability:**  Using AI to predict and prevent crime could improve safety (beneficence) but also lead to biased policing and disproportionate targeting of certain communities (undermining fairness).\\n*   **Transparency vs. Security:**  Full transparency of AI algorithms could expose vulnerabilities to malicious actors (compromising security).\\n*   **Fairness vs. Accuracy:**  Algorithms optimized for fairness can sometimes experience a decrease in predictive accuracy, and *vice versa*.\\n\\nHere's how to address these conflicts:\\n\\n1.  **Prioritization & Trade-offs:**\\n    *   Recognize that there's no one-size-fits-all solution.  The prioritization of principles will depend on the specific context, application, and potential impact.\\n    *   Establish a clear and transparent process for making trade-offs between competing principles.\\n    *   Document the rationale for these trade-offs and be prepared to justify them to stakeholders.\\n\\n2.  **Context-Specific Guidelines & Standards:**\\n    *   Develop specific ethical guidelines and standards for different AI applications (e.g., healthcare, finance, education).\\n    *   These guidelines should take into account the unique risks and opportunities associated with each application.\\n\\n3.  **Multi-Stakeholder Engagement:**\\n    *   Involve a diverse range of stakeholders (e.g., users, developers, policymakers, ethicists, civil society organizations) in the development and implementation of ethical frameworks.\\n    *   This will help ensure that the frameworks are comprehensive, relevant, and reflect a broad range of values and perspectives.\\n\\n4.  **Continuous Monitoring & Evaluation:**\\n    *   Continuously monitor the performance of AI systems to identify potential ethical issues.\\n    *   Regularly evaluate the effectiveness of ethical frameworks and update them as needed.\\n\\n5.  **Ethics as a Design Constraint:**\\n    *   Embed ethical considerations into the AI development process from the very beginning.\\n    *   Treat ethical principles as design constraints, rather than afterthoughts.\\n    *   Encourage ethical innovation – designing AI systems that proactively promote ethical values.\\n\\n6.  **The Principle of Proportionality:**\\n    *   A key guiding principle when conflicts arise. This principle suggests that interventions or actions should be proportionate to the potential benefits and risks involved.  It means carefully weighing the potential positive outcomes against the potential negative consequences, and ensuring that the chosen course of action is the least restrictive or intrusive option that effectively achieves the desired goal.\\n\\n**Examples of Conflict Resolution in Specific Scenarios:**\\n\\n*   **Autonomous Vehicles:** Balancing safety (beneficence) with user freedom (autonomy). Prioritize safety, especially when there is a risk to human life. However, users should retain some control over driving modes (e.g., adaptive cruise control) when safety is not significantly compromised.\\n*   **AI-Powered Hiring:** Balancing efficiency (societal benefit) with fairness. Conduct rigorous bias audits of algorithms and data. Implement human-in-the-loop processes to review AI-driven decisions and ensure fairness.  Be transparent with candidates about the use of AI in the hiring process.\\n*   **Healthcare AI:**  Balancing improved diagnostics (beneficence) with patient privacy (autonomy). Use de-identified or anonymized data whenever possible.  Implement strong data security measures. Obtain informed consent from patients before using their data for AI training or analysis.\\n\\n**Conclusion:**\\n\\nCreating an ethical framework for AI is an ongoing process that requires constant vigilance, adaptation, and collaboration. It's not about creating a perfect system, but rather about establishing a dynamic and responsive framework that guides the development and use of AI in a way that benefits humanity and minimizes potential harms.  The key is to cultivate a culture of ethical awareness and responsibility within the AI community.\\n\", 'Designing a new ethical framework for artificial intelligence (AI) requires a careful consideration of the complex interplay between user autonomy, societal benefit, and potential risks. Here are the key principles I would incorporate, along with strategies for addressing conflicts that may arise between them:\\n\\n**Key Principles:**\\n\\n1. **Respect for User Autonomy**: AI systems should prioritize user control and agency, ensuring that individuals have the ability to make informed decisions about their data, interactions, and outcomes.\\n2. **Societal Benefit**: AI development and deployment should aim to maximize overall societal benefit, considering factors such as economic growth, environmental sustainability, and social justice.\\n3. **Risk Mitigation**: AI systems should be designed to minimize potential risks, including those related to safety, security, and unintended consequences, such as bias, discrimination, or amplification of existing social issues.\\n4. **Transparency and Explainability**: AI decision-making processes should be transparent and explainable, allowing users to understand the reasoning behind AI-driven recommendations or actions.\\n5. **Accountability**: Developers, deployers, and users of AI systems should be accountable for their actions, including the potential consequences of AI-driven decisions or actions.\\n6. **Inclusivity and Accessibility**: AI systems should be designed to be inclusive and accessible, taking into account diverse user needs, abilities, and cultural backgrounds.\\n7. **Continuous Learning and Improvement**: AI systems should be designed to learn from user feedback, adapt to changing contexts, and improve over time.\\n\\n**Addressing Conflicts:**\\n\\nTo address conflicts that may arise between these principles, I would employ the following strategies:\\n\\n1. **Value-Based Decision-Making**: Establish a clear set of values and priorities that guide decision-making, such as prioritizing human well-being, dignity, and autonomy.\\n2. **Trade-Off Analysis**: Conduct thorough trade-off analyses to weigh the potential benefits and risks of different AI development and deployment scenarios.\\n3. **Multistakeholder Engagement**: Foster collaboration and dialogue among diverse stakeholders, including users, developers, policymakers, and civil society organizations, to ensure that a wide range of perspectives are considered.\\n4. **Regulatory Frameworks**: Establish and enforce regulatory frameworks that provide clear guidelines and standards for AI development and deployment, while also allowing for flexibility and innovation.\\n5. **Ethics Review Boards**: Establish ethics review boards or committees to review and assess AI systems, providing an independent, expert perspective on potential risks and benefits.\\n6. **Public Education and Awareness**: Promote public education and awareness about AI, its potential benefits and risks, and the importance of responsible AI development and use.\\n7. **Adaptive Governance**: Develop adaptive governance structures that can evolve with AI technologies, incorporating lessons learned and updates to regulatory frameworks, standards, and guidelines.\\n\\n**Implementation Roadmap:**\\n\\nTo implement this ethical framework, I would propose the following steps:\\n\\n1. **Establish a Global AI Ethics Forum**: Bring together international stakeholders to develop and refine the ethical framework, ensuring a comprehensive and inclusive approach.\\n2. **Develop Regulatory Frameworks**: Collaborate with governments and regulatory bodies to establish and enforce regulatory frameworks that support the ethical principles.\\n3. **Create Ethics Review Boards**: Establish ethics review boards or committees to review and assess AI systems, ensuring that they meet the ethical principles and guidelines.\\n4. **Promote Public Education and Awareness**: Develop and disseminate educational materials and programs to raise awareness about AI, its potential benefits and risks, and the importance of responsible AI development and use.\\n5. **Support Research and Development**: Fund research and development projects that focus on creating AI systems that prioritize user autonomy, societal benefit, and risk mitigation.\\n6. **Establish Accountability Mechanisms**: Develop and implement accountability mechanisms, such as certification programs or audit procedures, to ensure that AI developers and deployers are held accountable for their actions.\\n7. **Regularly Review and Update**: Regularly review and update the ethical framework, regulatory frameworks, and guidelines to ensure they remain relevant and effective in addressing the evolving AI landscape.\\n\\nBy incorporating these key principles and strategies, we can create a comprehensive ethical framework for AI that balances user autonomy, societal benefit, and potential risks, ultimately promoting responsible AI development and use that benefits humanity as a whole.']\n"
     ]
    }
   ],
   "source": [
    "# So where are we?\n",
    "\n",
    "print(competitors)\n",
    "print(answers)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Competitor: gpt-4o-mini\n",
      "\n",
      "Designing an ethical framework for artificial intelligence (AI) that balances user autonomy, societal benefit, and potential risks involves a holistic approach. Here are the key principles I would incorporate, along with strategies to address conflicts that may arise:\n",
      "\n",
      "### Key Principles:\n",
      "\n",
      "1. **User Autonomy**\n",
      "   - **Informed Consent**: Users should be fully informed about how their data is collected, used, and shared, ensuring they can make educated choices.\n",
      "   - **Control and Customization**: Users should have control over their AI interactions, including customization options that allow them to tailor experiences to their personal values and preferences.\n",
      "\n",
      "2. **Beneficence and Societal Benefit**\n",
      "   - **Promotion of Well-being**: AI should be designed to enhance human well-being and societal good, focusing on applications that address social issues such as health, education, and environmental sustainability.\n",
      "   - **Equity and Inclusion**: AI systems should aim to reduce inequalities, ensuring that all societal groups have access to the benefits of AI and that disadvantages are not exacerbated.\n",
      "\n",
      "3. **Transparency and Explainability**\n",
      "   - **Accountability**: AI systems should operate transparently, allowing users and stakeholders to understand how decisions are made and to hold entities accountable.\n",
      "   - **Explainable AI**: Ensuring that AI algorithms can be understood and interpreted by users, fostering trust and enabling informed decision-making.\n",
      "\n",
      "4. **Safety and Risk Mitigation**\n",
      "   - **Robustness and Security**: AI systems must be developed to be safe, secure, and resilient against misuse, errors, or adversarial attacks.\n",
      "   - **Risk Assessment and Management**: Implement continuous processes for identifying, assessing, and mitigating risks associated with AI deployment.\n",
      "\n",
      "5. **Adaptive Governance**\n",
      "   - **Dynamic Regulations**: Create a regulatory framework that can adapt to technological advancements and societal changes, ensuring that AI evolves in alignment with societal values.\n",
      "   - **Stakeholder Engagement**: Involve diverse stakeholders (e.g., ethicists, technologists, community representatives) in the design, implementation, and governance of AI systems.\n",
      "\n",
      "### Addressing Conflicts:\n",
      "\n",
      "- **User Autonomy vs. Societal Benefit**: \n",
      "   - **Approach**: Implement dual consent frameworks where users have a right to opt-in for societal benefit-driven features (e.g., data sharing for public health) while retaining the option to withdraw.\n",
      "   - **Conflict Resolution**: Use anonymized data methods that allow societal benefits while protecting individual identities and privacy.\n",
      "\n",
      "- **Transparency vs. Proprietary Technology**: \n",
      "   - **Approach**: Strike a balance by ensuring that critical aspects of decision-making are transparent without revealing proprietary algorithms. \n",
      "   - **Conflict Resolution**: Establish independent review boards to assess the fairness and transparency of algorithms used in high-stakes settings, ensuring accountability without compromising business interests.\n",
      "\n",
      "- **Risk Mitigation vs. Innovation**: \n",
      "   - **Approach**: Foster a culture of ethical innovation where risk assessments are integral to development processes. Encourage a \"fail-safe\" mentality that prioritizes safety in experimental phases.\n",
      "   - **Conflict Resolution**: Introduce graduated testing and deployment phases, with strict monitoring protocols in place to manage risks alongside progressive innovation.\n",
      "\n",
      "### Conclusion:\n",
      "\n",
      "The ethical framework should be dynamic and adaptable, allowing for continuous updates as technology and societal norms evolve. Through implementing these principles and strategies, it's possible to create a balanced approach to AI that upholds user autonomy, promotes societal benefit, and effectively mitigates potential risks.\n",
      "Competitor: gemini-2.0-flash\n",
      "\n",
      "Designing an ethical framework for AI is a complex task, as it requires balancing individual freedom with collective well-being and mitigating potential harms. Here's my approach, incorporating key principles and conflict resolution strategies:\n",
      "\n",
      "**Key Principles:**\n",
      "\n",
      "1.  **Human-Centeredness:**\n",
      "    *   **Definition:** AI should primarily serve humanity and promote human flourishing. Its development and deployment should prioritize human needs, values, and well-being.\n",
      "    *   **Implementation:**  Prioritize accessibility for all demographics, focusing on education and training to enable humans to interact and utilize AI effectively. Regularly solicit user feedback to continuously improve the AI's design and functionality based on human needs.\n",
      "    *   **Connection to Core Values:**  Links to respect for human dignity, equality, and social justice.\n",
      "\n",
      "2.  **Autonomy & Agency:**\n",
      "    *   **Definition:** Users should retain control over their data and interactions with AI systems.  Transparency and explainability are crucial for informed consent and understanding.\n",
      "    *   **Implementation:**\n",
      "        *   **Transparent AI:** Make algorithms and decision-making processes as transparent as possible, within reasonable limits (considering trade secrets and system security).\n",
      "        *   **Explainable AI (XAI):** Provide users with explanations for AI's decisions that affect them, focusing on the relevant factors and reasoning.\n",
      "        *   **Data Ownership & Control:**  Give users ownership and control over their data, including the right to access, modify, and delete it.  Implement clear and concise privacy policies.\n",
      "        *   **Opt-in/Opt-out:**  Offer clear and easy-to-use mechanisms for opting in or out of AI-driven services and data collection.\n",
      "        *   **Human-in-the-Loop:** Where consequential decisions are being made, human oversight is essential. This ensures accountability and allows for human judgment to override AI recommendations when necessary.\n",
      "    *   **Connection to Core Values:**  Links to freedom, self-determination, and privacy.\n",
      "\n",
      "3.  **Beneficence & Non-Maleficence:**\n",
      "    *   **Definition:** AI should be designed to maximize benefits and minimize harms to individuals, society, and the environment.\n",
      "    *   **Implementation:**\n",
      "        *   **Risk Assessment:** Conduct thorough risk assessments throughout the AI lifecycle (design, development, deployment, and monitoring) to identify potential harms (e.g., bias, discrimination, job displacement, security vulnerabilities).\n",
      "        *   **Bias Mitigation:**  Develop and implement techniques to detect and mitigate biases in AI systems, including data bias, algorithmic bias, and human bias.\n",
      "        *   **Robustness & Reliability:**  Ensure that AI systems are robust, reliable, and resilient to adversarial attacks and unexpected inputs.\n",
      "        *   **Safety Standards:** Develop and adhere to rigorous safety standards for AI systems, particularly in high-risk applications (e.g., autonomous vehicles, medical devices).\n",
      "        *   **Environmental Sustainability:** Consider the environmental impact of AI systems, including energy consumption and resource usage.\n",
      "    *   **Connection to Core Values:** Links to welfare, security, and environmental responsibility.\n",
      "\n",
      "4.  **Fairness & Justice:**\n",
      "    *   **Definition:** AI systems should be designed and used in a way that promotes fairness, equity, and justice, and avoids discrimination.\n",
      "    *   **Implementation:**\n",
      "        *   **Equal Opportunity:** Ensure that AI systems provide equal opportunities to all individuals, regardless of their race, ethnicity, gender, religion, sexual orientation, or other protected characteristics.\n",
      "        *   **Algorithmic Auditing:**  Implement independent audits of AI systems to assess their fairness and identify potential biases.\n",
      "        *   **Redress Mechanisms:**  Establish clear mechanisms for individuals to challenge AI decisions that they believe are unfair or discriminatory.\n",
      "        *   **Addressing Disparities:**  Proactively address existing societal disparities that may be exacerbated by AI systems.\n",
      "    *   **Connection to Core Values:**  Links to equality, impartiality, and distributive justice.\n",
      "\n",
      "5.  **Accountability & Responsibility:**\n",
      "    *   **Definition:**  Clear lines of accountability must be established for the actions and decisions of AI systems.\n",
      "    *   **Implementation:**\n",
      "        *   **Identify Responsible Parties:**  Clearly identify the individuals and organizations responsible for the design, development, deployment, and monitoring of AI systems.\n",
      "        *   **Traceability:**  Ensure that the decision-making processes of AI systems are traceable and auditable.\n",
      "        *   **Legal & Regulatory Framework:** Develop a legal and regulatory framework that holds individuals and organizations accountable for the harms caused by AI systems.\n",
      "        *   **Ethical Review Boards:**  Establish ethical review boards to oversee the development and deployment of AI systems, particularly in high-risk applications.\n",
      "    *   **Connection to Core Values:**  Links to integrity, transparency, and rule of law.\n",
      "\n",
      "**Addressing Conflicts Between Principles:**\n",
      "\n",
      "Conflicts between these principles are inevitable. For example:\n",
      "\n",
      "*   **Autonomy vs. Societal Benefit:**  Personalized recommendation systems might enhance user experience (autonomy) but also contribute to echo chambers and political polarization (harming societal benefit).\n",
      "*   **Beneficence vs. Accountability:**  Using AI to predict and prevent crime could improve safety (beneficence) but also lead to biased policing and disproportionate targeting of certain communities (undermining fairness).\n",
      "*   **Transparency vs. Security:**  Full transparency of AI algorithms could expose vulnerabilities to malicious actors (compromising security).\n",
      "*   **Fairness vs. Accuracy:**  Algorithms optimized for fairness can sometimes experience a decrease in predictive accuracy, and *vice versa*.\n",
      "\n",
      "Here's how to address these conflicts:\n",
      "\n",
      "1.  **Prioritization & Trade-offs:**\n",
      "    *   Recognize that there's no one-size-fits-all solution.  The prioritization of principles will depend on the specific context, application, and potential impact.\n",
      "    *   Establish a clear and transparent process for making trade-offs between competing principles.\n",
      "    *   Document the rationale for these trade-offs and be prepared to justify them to stakeholders.\n",
      "\n",
      "2.  **Context-Specific Guidelines & Standards:**\n",
      "    *   Develop specific ethical guidelines and standards for different AI applications (e.g., healthcare, finance, education).\n",
      "    *   These guidelines should take into account the unique risks and opportunities associated with each application.\n",
      "\n",
      "3.  **Multi-Stakeholder Engagement:**\n",
      "    *   Involve a diverse range of stakeholders (e.g., users, developers, policymakers, ethicists, civil society organizations) in the development and implementation of ethical frameworks.\n",
      "    *   This will help ensure that the frameworks are comprehensive, relevant, and reflect a broad range of values and perspectives.\n",
      "\n",
      "4.  **Continuous Monitoring & Evaluation:**\n",
      "    *   Continuously monitor the performance of AI systems to identify potential ethical issues.\n",
      "    *   Regularly evaluate the effectiveness of ethical frameworks and update them as needed.\n",
      "\n",
      "5.  **Ethics as a Design Constraint:**\n",
      "    *   Embed ethical considerations into the AI development process from the very beginning.\n",
      "    *   Treat ethical principles as design constraints, rather than afterthoughts.\n",
      "    *   Encourage ethical innovation – designing AI systems that proactively promote ethical values.\n",
      "\n",
      "6.  **The Principle of Proportionality:**\n",
      "    *   A key guiding principle when conflicts arise. This principle suggests that interventions or actions should be proportionate to the potential benefits and risks involved.  It means carefully weighing the potential positive outcomes against the potential negative consequences, and ensuring that the chosen course of action is the least restrictive or intrusive option that effectively achieves the desired goal.\n",
      "\n",
      "**Examples of Conflict Resolution in Specific Scenarios:**\n",
      "\n",
      "*   **Autonomous Vehicles:** Balancing safety (beneficence) with user freedom (autonomy). Prioritize safety, especially when there is a risk to human life. However, users should retain some control over driving modes (e.g., adaptive cruise control) when safety is not significantly compromised.\n",
      "*   **AI-Powered Hiring:** Balancing efficiency (societal benefit) with fairness. Conduct rigorous bias audits of algorithms and data. Implement human-in-the-loop processes to review AI-driven decisions and ensure fairness.  Be transparent with candidates about the use of AI in the hiring process.\n",
      "*   **Healthcare AI:**  Balancing improved diagnostics (beneficence) with patient privacy (autonomy). Use de-identified or anonymized data whenever possible.  Implement strong data security measures. Obtain informed consent from patients before using their data for AI training or analysis.\n",
      "\n",
      "**Conclusion:**\n",
      "\n",
      "Creating an ethical framework for AI is an ongoing process that requires constant vigilance, adaptation, and collaboration. It's not about creating a perfect system, but rather about establishing a dynamic and responsive framework that guides the development and use of AI in a way that benefits humanity and minimizes potential harms.  The key is to cultivate a culture of ethical awareness and responsibility within the AI community.\n",
      "\n",
      "Competitor: llama-3.3-70b-versatile\n",
      "\n",
      "Designing a new ethical framework for artificial intelligence (AI) requires a careful consideration of the complex interplay between user autonomy, societal benefit, and potential risks. Here are the key principles I would incorporate, along with strategies for addressing conflicts that may arise between them:\n",
      "\n",
      "**Key Principles:**\n",
      "\n",
      "1. **Respect for User Autonomy**: AI systems should prioritize user control and agency, ensuring that individuals have the ability to make informed decisions about their data, interactions, and outcomes.\n",
      "2. **Societal Benefit**: AI development and deployment should aim to maximize overall societal benefit, considering factors such as economic growth, environmental sustainability, and social justice.\n",
      "3. **Risk Mitigation**: AI systems should be designed to minimize potential risks, including those related to safety, security, and unintended consequences, such as bias, discrimination, or amplification of existing social issues.\n",
      "4. **Transparency and Explainability**: AI decision-making processes should be transparent and explainable, allowing users to understand the reasoning behind AI-driven recommendations or actions.\n",
      "5. **Accountability**: Developers, deployers, and users of AI systems should be accountable for their actions, including the potential consequences of AI-driven decisions or actions.\n",
      "6. **Inclusivity and Accessibility**: AI systems should be designed to be inclusive and accessible, taking into account diverse user needs, abilities, and cultural backgrounds.\n",
      "7. **Continuous Learning and Improvement**: AI systems should be designed to learn from user feedback, adapt to changing contexts, and improve over time.\n",
      "\n",
      "**Addressing Conflicts:**\n",
      "\n",
      "To address conflicts that may arise between these principles, I would employ the following strategies:\n",
      "\n",
      "1. **Value-Based Decision-Making**: Establish a clear set of values and priorities that guide decision-making, such as prioritizing human well-being, dignity, and autonomy.\n",
      "2. **Trade-Off Analysis**: Conduct thorough trade-off analyses to weigh the potential benefits and risks of different AI development and deployment scenarios.\n",
      "3. **Multistakeholder Engagement**: Foster collaboration and dialogue among diverse stakeholders, including users, developers, policymakers, and civil society organizations, to ensure that a wide range of perspectives are considered.\n",
      "4. **Regulatory Frameworks**: Establish and enforce regulatory frameworks that provide clear guidelines and standards for AI development and deployment, while also allowing for flexibility and innovation.\n",
      "5. **Ethics Review Boards**: Establish ethics review boards or committees to review and assess AI systems, providing an independent, expert perspective on potential risks and benefits.\n",
      "6. **Public Education and Awareness**: Promote public education and awareness about AI, its potential benefits and risks, and the importance of responsible AI development and use.\n",
      "7. **Adaptive Governance**: Develop adaptive governance structures that can evolve with AI technologies, incorporating lessons learned and updates to regulatory frameworks, standards, and guidelines.\n",
      "\n",
      "**Implementation Roadmap:**\n",
      "\n",
      "To implement this ethical framework, I would propose the following steps:\n",
      "\n",
      "1. **Establish a Global AI Ethics Forum**: Bring together international stakeholders to develop and refine the ethical framework, ensuring a comprehensive and inclusive approach.\n",
      "2. **Develop Regulatory Frameworks**: Collaborate with governments and regulatory bodies to establish and enforce regulatory frameworks that support the ethical principles.\n",
      "3. **Create Ethics Review Boards**: Establish ethics review boards or committees to review and assess AI systems, ensuring that they meet the ethical principles and guidelines.\n",
      "4. **Promote Public Education and Awareness**: Develop and disseminate educational materials and programs to raise awareness about AI, its potential benefits and risks, and the importance of responsible AI development and use.\n",
      "5. **Support Research and Development**: Fund research and development projects that focus on creating AI systems that prioritize user autonomy, societal benefit, and risk mitigation.\n",
      "6. **Establish Accountability Mechanisms**: Develop and implement accountability mechanisms, such as certification programs or audit procedures, to ensure that AI developers and deployers are held accountable for their actions.\n",
      "7. **Regularly Review and Update**: Regularly review and update the ethical framework, regulatory frameworks, and guidelines to ensure they remain relevant and effective in addressing the evolving AI landscape.\n",
      "\n",
      "By incorporating these key principles and strategies, we can create a comprehensive ethical framework for AI that balances user autonomy, societal benefit, and potential risks, ultimately promoting responsible AI development and use that benefits humanity as a whole.\n"
     ]
    }
   ],
   "source": [
    "# It's nice to know how to use \"zip\"\n",
    "for competitor, answer in zip(competitors, answers):\n",
    "    print(f\"Competitor: {competitor}\\n\\n{answer}\")\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Let's bring this together - note the use of \"enumerate\"\n",
    "\n",
    "together = \"\"\n",
    "for index, answer in enumerate(answers):\n",
    "    together += f\"# Response from competitor {index+1}\\n\\n\"\n",
    "    together += answer + \"\\n\\n\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "# Response from competitor 1\n",
      "\n",
      "Designing an ethical framework for artificial intelligence (AI) that balances user autonomy, societal benefit, and potential risks involves a holistic approach. Here are the key principles I would incorporate, along with strategies to address conflicts that may arise:\n",
      "\n",
      "### Key Principles:\n",
      "\n",
      "1. **User Autonomy**\n",
      "   - **Informed Consent**: Users should be fully informed about how their data is collected, used, and shared, ensuring they can make educated choices.\n",
      "   - **Control and Customization**: Users should have control over their AI interactions, including customization options that allow them to tailor experiences to their personal values and preferences.\n",
      "\n",
      "2. **Beneficence and Societal Benefit**\n",
      "   - **Promotion of Well-being**: AI should be designed to enhance human well-being and societal good, focusing on applications that address social issues such as health, education, and environmental sustainability.\n",
      "   - **Equity and Inclusion**: AI systems should aim to reduce inequalities, ensuring that all societal groups have access to the benefits of AI and that disadvantages are not exacerbated.\n",
      "\n",
      "3. **Transparency and Explainability**\n",
      "   - **Accountability**: AI systems should operate transparently, allowing users and stakeholders to understand how decisions are made and to hold entities accountable.\n",
      "   - **Explainable AI**: Ensuring that AI algorithms can be understood and interpreted by users, fostering trust and enabling informed decision-making.\n",
      "\n",
      "4. **Safety and Risk Mitigation**\n",
      "   - **Robustness and Security**: AI systems must be developed to be safe, secure, and resilient against misuse, errors, or adversarial attacks.\n",
      "   - **Risk Assessment and Management**: Implement continuous processes for identifying, assessing, and mitigating risks associated with AI deployment.\n",
      "\n",
      "5. **Adaptive Governance**\n",
      "   - **Dynamic Regulations**: Create a regulatory framework that can adapt to technological advancements and societal changes, ensuring that AI evolves in alignment with societal values.\n",
      "   - **Stakeholder Engagement**: Involve diverse stakeholders (e.g., ethicists, technologists, community representatives) in the design, implementation, and governance of AI systems.\n",
      "\n",
      "### Addressing Conflicts:\n",
      "\n",
      "- **User Autonomy vs. Societal Benefit**: \n",
      "   - **Approach**: Implement dual consent frameworks where users have a right to opt-in for societal benefit-driven features (e.g., data sharing for public health) while retaining the option to withdraw.\n",
      "   - **Conflict Resolution**: Use anonymized data methods that allow societal benefits while protecting individual identities and privacy.\n",
      "\n",
      "- **Transparency vs. Proprietary Technology**: \n",
      "   - **Approach**: Strike a balance by ensuring that critical aspects of decision-making are transparent without revealing proprietary algorithms. \n",
      "   - **Conflict Resolution**: Establish independent review boards to assess the fairness and transparency of algorithms used in high-stakes settings, ensuring accountability without compromising business interests.\n",
      "\n",
      "- **Risk Mitigation vs. Innovation**: \n",
      "   - **Approach**: Foster a culture of ethical innovation where risk assessments are integral to development processes. Encourage a \"fail-safe\" mentality that prioritizes safety in experimental phases.\n",
      "   - **Conflict Resolution**: Introduce graduated testing and deployment phases, with strict monitoring protocols in place to manage risks alongside progressive innovation.\n",
      "\n",
      "### Conclusion:\n",
      "\n",
      "The ethical framework should be dynamic and adaptable, allowing for continuous updates as technology and societal norms evolve. Through implementing these principles and strategies, it's possible to create a balanced approach to AI that upholds user autonomy, promotes societal benefit, and effectively mitigates potential risks.\n",
      "\n",
      "# Response from competitor 2\n",
      "\n",
      "Designing an ethical framework for AI is a complex task, as it requires balancing individual freedom with collective well-being and mitigating potential harms. Here's my approach, incorporating key principles and conflict resolution strategies:\n",
      "\n",
      "**Key Principles:**\n",
      "\n",
      "1.  **Human-Centeredness:**\n",
      "    *   **Definition:** AI should primarily serve humanity and promote human flourishing. Its development and deployment should prioritize human needs, values, and well-being.\n",
      "    *   **Implementation:**  Prioritize accessibility for all demographics, focusing on education and training to enable humans to interact and utilize AI effectively. Regularly solicit user feedback to continuously improve the AI's design and functionality based on human needs.\n",
      "    *   **Connection to Core Values:**  Links to respect for human dignity, equality, and social justice.\n",
      "\n",
      "2.  **Autonomy & Agency:**\n",
      "    *   **Definition:** Users should retain control over their data and interactions with AI systems.  Transparency and explainability are crucial for informed consent and understanding.\n",
      "    *   **Implementation:**\n",
      "        *   **Transparent AI:** Make algorithms and decision-making processes as transparent as possible, within reasonable limits (considering trade secrets and system security).\n",
      "        *   **Explainable AI (XAI):** Provide users with explanations for AI's decisions that affect them, focusing on the relevant factors and reasoning.\n",
      "        *   **Data Ownership & Control:**  Give users ownership and control over their data, including the right to access, modify, and delete it.  Implement clear and concise privacy policies.\n",
      "        *   **Opt-in/Opt-out:**  Offer clear and easy-to-use mechanisms for opting in or out of AI-driven services and data collection.\n",
      "        *   **Human-in-the-Loop:** Where consequential decisions are being made, human oversight is essential. This ensures accountability and allows for human judgment to override AI recommendations when necessary.\n",
      "    *   **Connection to Core Values:**  Links to freedom, self-determination, and privacy.\n",
      "\n",
      "3.  **Beneficence & Non-Maleficence:**\n",
      "    *   **Definition:** AI should be designed to maximize benefits and minimize harms to individuals, society, and the environment.\n",
      "    *   **Implementation:**\n",
      "        *   **Risk Assessment:** Conduct thorough risk assessments throughout the AI lifecycle (design, development, deployment, and monitoring) to identify potential harms (e.g., bias, discrimination, job displacement, security vulnerabilities).\n",
      "        *   **Bias Mitigation:**  Develop and implement techniques to detect and mitigate biases in AI systems, including data bias, algorithmic bias, and human bias.\n",
      "        *   **Robustness & Reliability:**  Ensure that AI systems are robust, reliable, and resilient to adversarial attacks and unexpected inputs.\n",
      "        *   **Safety Standards:** Develop and adhere to rigorous safety standards for AI systems, particularly in high-risk applications (e.g., autonomous vehicles, medical devices).\n",
      "        *   **Environmental Sustainability:** Consider the environmental impact of AI systems, including energy consumption and resource usage.\n",
      "    *   **Connection to Core Values:** Links to welfare, security, and environmental responsibility.\n",
      "\n",
      "4.  **Fairness & Justice:**\n",
      "    *   **Definition:** AI systems should be designed and used in a way that promotes fairness, equity, and justice, and avoids discrimination.\n",
      "    *   **Implementation:**\n",
      "        *   **Equal Opportunity:** Ensure that AI systems provide equal opportunities to all individuals, regardless of their race, ethnicity, gender, religion, sexual orientation, or other protected characteristics.\n",
      "        *   **Algorithmic Auditing:**  Implement independent audits of AI systems to assess their fairness and identify potential biases.\n",
      "        *   **Redress Mechanisms:**  Establish clear mechanisms for individuals to challenge AI decisions that they believe are unfair or discriminatory.\n",
      "        *   **Addressing Disparities:**  Proactively address existing societal disparities that may be exacerbated by AI systems.\n",
      "    *   **Connection to Core Values:**  Links to equality, impartiality, and distributive justice.\n",
      "\n",
      "5.  **Accountability & Responsibility:**\n",
      "    *   **Definition:**  Clear lines of accountability must be established for the actions and decisions of AI systems.\n",
      "    *   **Implementation:**\n",
      "        *   **Identify Responsible Parties:**  Clearly identify the individuals and organizations responsible for the design, development, deployment, and monitoring of AI systems.\n",
      "        *   **Traceability:**  Ensure that the decision-making processes of AI systems are traceable and auditable.\n",
      "        *   **Legal & Regulatory Framework:** Develop a legal and regulatory framework that holds individuals and organizations accountable for the harms caused by AI systems.\n",
      "        *   **Ethical Review Boards:**  Establish ethical review boards to oversee the development and deployment of AI systems, particularly in high-risk applications.\n",
      "    *   **Connection to Core Values:**  Links to integrity, transparency, and rule of law.\n",
      "\n",
      "**Addressing Conflicts Between Principles:**\n",
      "\n",
      "Conflicts between these principles are inevitable. For example:\n",
      "\n",
      "*   **Autonomy vs. Societal Benefit:**  Personalized recommendation systems might enhance user experience (autonomy) but also contribute to echo chambers and political polarization (harming societal benefit).\n",
      "*   **Beneficence vs. Accountability:**  Using AI to predict and prevent crime could improve safety (beneficence) but also lead to biased policing and disproportionate targeting of certain communities (undermining fairness).\n",
      "*   **Transparency vs. Security:**  Full transparency of AI algorithms could expose vulnerabilities to malicious actors (compromising security).\n",
      "*   **Fairness vs. Accuracy:**  Algorithms optimized for fairness can sometimes experience a decrease in predictive accuracy, and *vice versa*.\n",
      "\n",
      "Here's how to address these conflicts:\n",
      "\n",
      "1.  **Prioritization & Trade-offs:**\n",
      "    *   Recognize that there's no one-size-fits-all solution.  The prioritization of principles will depend on the specific context, application, and potential impact.\n",
      "    *   Establish a clear and transparent process for making trade-offs between competing principles.\n",
      "    *   Document the rationale for these trade-offs and be prepared to justify them to stakeholders.\n",
      "\n",
      "2.  **Context-Specific Guidelines & Standards:**\n",
      "    *   Develop specific ethical guidelines and standards for different AI applications (e.g., healthcare, finance, education).\n",
      "    *   These guidelines should take into account the unique risks and opportunities associated with each application.\n",
      "\n",
      "3.  **Multi-Stakeholder Engagement:**\n",
      "    *   Involve a diverse range of stakeholders (e.g., users, developers, policymakers, ethicists, civil society organizations) in the development and implementation of ethical frameworks.\n",
      "    *   This will help ensure that the frameworks are comprehensive, relevant, and reflect a broad range of values and perspectives.\n",
      "\n",
      "4.  **Continuous Monitoring & Evaluation:**\n",
      "    *   Continuously monitor the performance of AI systems to identify potential ethical issues.\n",
      "    *   Regularly evaluate the effectiveness of ethical frameworks and update them as needed.\n",
      "\n",
      "5.  **Ethics as a Design Constraint:**\n",
      "    *   Embed ethical considerations into the AI development process from the very beginning.\n",
      "    *   Treat ethical principles as design constraints, rather than afterthoughts.\n",
      "    *   Encourage ethical innovation – designing AI systems that proactively promote ethical values.\n",
      "\n",
      "6.  **The Principle of Proportionality:**\n",
      "    *   A key guiding principle when conflicts arise. This principle suggests that interventions or actions should be proportionate to the potential benefits and risks involved.  It means carefully weighing the potential positive outcomes against the potential negative consequences, and ensuring that the chosen course of action is the least restrictive or intrusive option that effectively achieves the desired goal.\n",
      "\n",
      "**Examples of Conflict Resolution in Specific Scenarios:**\n",
      "\n",
      "*   **Autonomous Vehicles:** Balancing safety (beneficence) with user freedom (autonomy). Prioritize safety, especially when there is a risk to human life. However, users should retain some control over driving modes (e.g., adaptive cruise control) when safety is not significantly compromised.\n",
      "*   **AI-Powered Hiring:** Balancing efficiency (societal benefit) with fairness. Conduct rigorous bias audits of algorithms and data. Implement human-in-the-loop processes to review AI-driven decisions and ensure fairness.  Be transparent with candidates about the use of AI in the hiring process.\n",
      "*   **Healthcare AI:**  Balancing improved diagnostics (beneficence) with patient privacy (autonomy). Use de-identified or anonymized data whenever possible.  Implement strong data security measures. Obtain informed consent from patients before using their data for AI training or analysis.\n",
      "\n",
      "**Conclusion:**\n",
      "\n",
      "Creating an ethical framework for AI is an ongoing process that requires constant vigilance, adaptation, and collaboration. It's not about creating a perfect system, but rather about establishing a dynamic and responsive framework that guides the development and use of AI in a way that benefits humanity and minimizes potential harms.  The key is to cultivate a culture of ethical awareness and responsibility within the AI community.\n",
      "\n",
      "\n",
      "# Response from competitor 3\n",
      "\n",
      "Designing a new ethical framework for artificial intelligence (AI) requires a careful consideration of the complex interplay between user autonomy, societal benefit, and potential risks. Here are the key principles I would incorporate, along with strategies for addressing conflicts that may arise between them:\n",
      "\n",
      "**Key Principles:**\n",
      "\n",
      "1. **Respect for User Autonomy**: AI systems should prioritize user control and agency, ensuring that individuals have the ability to make informed decisions about their data, interactions, and outcomes.\n",
      "2. **Societal Benefit**: AI development and deployment should aim to maximize overall societal benefit, considering factors such as economic growth, environmental sustainability, and social justice.\n",
      "3. **Risk Mitigation**: AI systems should be designed to minimize potential risks, including those related to safety, security, and unintended consequences, such as bias, discrimination, or amplification of existing social issues.\n",
      "4. **Transparency and Explainability**: AI decision-making processes should be transparent and explainable, allowing users to understand the reasoning behind AI-driven recommendations or actions.\n",
      "5. **Accountability**: Developers, deployers, and users of AI systems should be accountable for their actions, including the potential consequences of AI-driven decisions or actions.\n",
      "6. **Inclusivity and Accessibility**: AI systems should be designed to be inclusive and accessible, taking into account diverse user needs, abilities, and cultural backgrounds.\n",
      "7. **Continuous Learning and Improvement**: AI systems should be designed to learn from user feedback, adapt to changing contexts, and improve over time.\n",
      "\n",
      "**Addressing Conflicts:**\n",
      "\n",
      "To address conflicts that may arise between these principles, I would employ the following strategies:\n",
      "\n",
      "1. **Value-Based Decision-Making**: Establish a clear set of values and priorities that guide decision-making, such as prioritizing human well-being, dignity, and autonomy.\n",
      "2. **Trade-Off Analysis**: Conduct thorough trade-off analyses to weigh the potential benefits and risks of different AI development and deployment scenarios.\n",
      "3. **Multistakeholder Engagement**: Foster collaboration and dialogue among diverse stakeholders, including users, developers, policymakers, and civil society organizations, to ensure that a wide range of perspectives are considered.\n",
      "4. **Regulatory Frameworks**: Establish and enforce regulatory frameworks that provide clear guidelines and standards for AI development and deployment, while also allowing for flexibility and innovation.\n",
      "5. **Ethics Review Boards**: Establish ethics review boards or committees to review and assess AI systems, providing an independent, expert perspective on potential risks and benefits.\n",
      "6. **Public Education and Awareness**: Promote public education and awareness about AI, its potential benefits and risks, and the importance of responsible AI development and use.\n",
      "7. **Adaptive Governance**: Develop adaptive governance structures that can evolve with AI technologies, incorporating lessons learned and updates to regulatory frameworks, standards, and guidelines.\n",
      "\n",
      "**Implementation Roadmap:**\n",
      "\n",
      "To implement this ethical framework, I would propose the following steps:\n",
      "\n",
      "1. **Establish a Global AI Ethics Forum**: Bring together international stakeholders to develop and refine the ethical framework, ensuring a comprehensive and inclusive approach.\n",
      "2. **Develop Regulatory Frameworks**: Collaborate with governments and regulatory bodies to establish and enforce regulatory frameworks that support the ethical principles.\n",
      "3. **Create Ethics Review Boards**: Establish ethics review boards or committees to review and assess AI systems, ensuring that they meet the ethical principles and guidelines.\n",
      "4. **Promote Public Education and Awareness**: Develop and disseminate educational materials and programs to raise awareness about AI, its potential benefits and risks, and the importance of responsible AI development and use.\n",
      "5. **Support Research and Development**: Fund research and development projects that focus on creating AI systems that prioritize user autonomy, societal benefit, and risk mitigation.\n",
      "6. **Establish Accountability Mechanisms**: Develop and implement accountability mechanisms, such as certification programs or audit procedures, to ensure that AI developers and deployers are held accountable for their actions.\n",
      "7. **Regularly Review and Update**: Regularly review and update the ethical framework, regulatory frameworks, and guidelines to ensure they remain relevant and effective in addressing the evolving AI landscape.\n",
      "\n",
      "By incorporating these key principles and strategies, we can create a comprehensive ethical framework for AI that balances user autonomy, societal benefit, and potential risks, ultimately promoting responsible AI development and use that benefits humanity as a whole.\n",
      "\n",
      "\n"
     ]
    }
   ],
   "source": [
    "print(together)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [],
   "source": [
    "judge = f\"\"\"You are judging a competition between {len(competitors)} competitors.\n",
    "Each model has been given this question:\n",
    "\n",
    "{question}\n",
    "\n",
    "Your job is to evaluate each response for clarity and strength of argument, and rank them in order of best to worst.\n",
    "Respond with JSON, and only JSON, with the following format:\n",
    "{{\"results\": [\"best competitor number\", \"second best competitor number\", \"third best competitor number\", ...]}}\n",
    "\n",
    "Here are the responses from each competitor:\n",
    "\n",
    "{together}\n",
    "\n",
    "Now respond with the JSON with the ranked order of the competitors, nothing else. Do not include markdown formatting or code blocks.\"\"\"\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "You are judging a competition between 3 competitors.\n",
      "Each model has been given this question:\n",
      "\n",
      "If you had to design a new ethical framework for artificial intelligence that balances user autonomy, societal benefit, and potential risks, what key principles would you incorporate, and how would you address the conflicts that arise between them?\n",
      "\n",
      "Your job is to evaluate each response for clarity and strength of argument, and rank them in order of best to worst.\n",
      "Respond with JSON, and only JSON, with the following format:\n",
      "{\"results\": [\"best competitor number\", \"second best competitor number\", \"third best competitor number\", ...]}\n",
      "\n",
      "Here are the responses from each competitor:\n",
      "\n",
      "# Response from competitor 1\n",
      "\n",
      "Designing an ethical framework for artificial intelligence (AI) that balances user autonomy, societal benefit, and potential risks involves a holistic approach. Here are the key principles I would incorporate, along with strategies to address conflicts that may arise:\n",
      "\n",
      "### Key Principles:\n",
      "\n",
      "1. **User Autonomy**\n",
      "   - **Informed Consent**: Users should be fully informed about how their data is collected, used, and shared, ensuring they can make educated choices.\n",
      "   - **Control and Customization**: Users should have control over their AI interactions, including customization options that allow them to tailor experiences to their personal values and preferences.\n",
      "\n",
      "2. **Beneficence and Societal Benefit**\n",
      "   - **Promotion of Well-being**: AI should be designed to enhance human well-being and societal good, focusing on applications that address social issues such as health, education, and environmental sustainability.\n",
      "   - **Equity and Inclusion**: AI systems should aim to reduce inequalities, ensuring that all societal groups have access to the benefits of AI and that disadvantages are not exacerbated.\n",
      "\n",
      "3. **Transparency and Explainability**\n",
      "   - **Accountability**: AI systems should operate transparently, allowing users and stakeholders to understand how decisions are made and to hold entities accountable.\n",
      "   - **Explainable AI**: Ensuring that AI algorithms can be understood and interpreted by users, fostering trust and enabling informed decision-making.\n",
      "\n",
      "4. **Safety and Risk Mitigation**\n",
      "   - **Robustness and Security**: AI systems must be developed to be safe, secure, and resilient against misuse, errors, or adversarial attacks.\n",
      "   - **Risk Assessment and Management**: Implement continuous processes for identifying, assessing, and mitigating risks associated with AI deployment.\n",
      "\n",
      "5. **Adaptive Governance**\n",
      "   - **Dynamic Regulations**: Create a regulatory framework that can adapt to technological advancements and societal changes, ensuring that AI evolves in alignment with societal values.\n",
      "   - **Stakeholder Engagement**: Involve diverse stakeholders (e.g., ethicists, technologists, community representatives) in the design, implementation, and governance of AI systems.\n",
      "\n",
      "### Addressing Conflicts:\n",
      "\n",
      "- **User Autonomy vs. Societal Benefit**: \n",
      "   - **Approach**: Implement dual consent frameworks where users have a right to opt-in for societal benefit-driven features (e.g., data sharing for public health) while retaining the option to withdraw.\n",
      "   - **Conflict Resolution**: Use anonymized data methods that allow societal benefits while protecting individual identities and privacy.\n",
      "\n",
      "- **Transparency vs. Proprietary Technology**: \n",
      "   - **Approach**: Strike a balance by ensuring that critical aspects of decision-making are transparent without revealing proprietary algorithms. \n",
      "   - **Conflict Resolution**: Establish independent review boards to assess the fairness and transparency of algorithms used in high-stakes settings, ensuring accountability without compromising business interests.\n",
      "\n",
      "- **Risk Mitigation vs. Innovation**: \n",
      "   - **Approach**: Foster a culture of ethical innovation where risk assessments are integral to development processes. Encourage a \"fail-safe\" mentality that prioritizes safety in experimental phases.\n",
      "   - **Conflict Resolution**: Introduce graduated testing and deployment phases, with strict monitoring protocols in place to manage risks alongside progressive innovation.\n",
      "\n",
      "### Conclusion:\n",
      "\n",
      "The ethical framework should be dynamic and adaptable, allowing for continuous updates as technology and societal norms evolve. Through implementing these principles and strategies, it's possible to create a balanced approach to AI that upholds user autonomy, promotes societal benefit, and effectively mitigates potential risks.\n",
      "\n",
      "# Response from competitor 2\n",
      "\n",
      "Designing an ethical framework for AI is a complex task, as it requires balancing individual freedom with collective well-being and mitigating potential harms. Here's my approach, incorporating key principles and conflict resolution strategies:\n",
      "\n",
      "**Key Principles:**\n",
      "\n",
      "1.  **Human-Centeredness:**\n",
      "    *   **Definition:** AI should primarily serve humanity and promote human flourishing. Its development and deployment should prioritize human needs, values, and well-being.\n",
      "    *   **Implementation:**  Prioritize accessibility for all demographics, focusing on education and training to enable humans to interact and utilize AI effectively. Regularly solicit user feedback to continuously improve the AI's design and functionality based on human needs.\n",
      "    *   **Connection to Core Values:**  Links to respect for human dignity, equality, and social justice.\n",
      "\n",
      "2.  **Autonomy & Agency:**\n",
      "    *   **Definition:** Users should retain control over their data and interactions with AI systems.  Transparency and explainability are crucial for informed consent and understanding.\n",
      "    *   **Implementation:**\n",
      "        *   **Transparent AI:** Make algorithms and decision-making processes as transparent as possible, within reasonable limits (considering trade secrets and system security).\n",
      "        *   **Explainable AI (XAI):** Provide users with explanations for AI's decisions that affect them, focusing on the relevant factors and reasoning.\n",
      "        *   **Data Ownership & Control:**  Give users ownership and control over their data, including the right to access, modify, and delete it.  Implement clear and concise privacy policies.\n",
      "        *   **Opt-in/Opt-out:**  Offer clear and easy-to-use mechanisms for opting in or out of AI-driven services and data collection.\n",
      "        *   **Human-in-the-Loop:** Where consequential decisions are being made, human oversight is essential. This ensures accountability and allows for human judgment to override AI recommendations when necessary.\n",
      "    *   **Connection to Core Values:**  Links to freedom, self-determination, and privacy.\n",
      "\n",
      "3.  **Beneficence & Non-Maleficence:**\n",
      "    *   **Definition:** AI should be designed to maximize benefits and minimize harms to individuals, society, and the environment.\n",
      "    *   **Implementation:**\n",
      "        *   **Risk Assessment:** Conduct thorough risk assessments throughout the AI lifecycle (design, development, deployment, and monitoring) to identify potential harms (e.g., bias, discrimination, job displacement, security vulnerabilities).\n",
      "        *   **Bias Mitigation:**  Develop and implement techniques to detect and mitigate biases in AI systems, including data bias, algorithmic bias, and human bias.\n",
      "        *   **Robustness & Reliability:**  Ensure that AI systems are robust, reliable, and resilient to adversarial attacks and unexpected inputs.\n",
      "        *   **Safety Standards:** Develop and adhere to rigorous safety standards for AI systems, particularly in high-risk applications (e.g., autonomous vehicles, medical devices).\n",
      "        *   **Environmental Sustainability:** Consider the environmental impact of AI systems, including energy consumption and resource usage.\n",
      "    *   **Connection to Core Values:** Links to welfare, security, and environmental responsibility.\n",
      "\n",
      "4.  **Fairness & Justice:**\n",
      "    *   **Definition:** AI systems should be designed and used in a way that promotes fairness, equity, and justice, and avoids discrimination.\n",
      "    *   **Implementation:**\n",
      "        *   **Equal Opportunity:** Ensure that AI systems provide equal opportunities to all individuals, regardless of their race, ethnicity, gender, religion, sexual orientation, or other protected characteristics.\n",
      "        *   **Algorithmic Auditing:**  Implement independent audits of AI systems to assess their fairness and identify potential biases.\n",
      "        *   **Redress Mechanisms:**  Establish clear mechanisms for individuals to challenge AI decisions that they believe are unfair or discriminatory.\n",
      "        *   **Addressing Disparities:**  Proactively address existing societal disparities that may be exacerbated by AI systems.\n",
      "    *   **Connection to Core Values:**  Links to equality, impartiality, and distributive justice.\n",
      "\n",
      "5.  **Accountability & Responsibility:**\n",
      "    *   **Definition:**  Clear lines of accountability must be established for the actions and decisions of AI systems.\n",
      "    *   **Implementation:**\n",
      "        *   **Identify Responsible Parties:**  Clearly identify the individuals and organizations responsible for the design, development, deployment, and monitoring of AI systems.\n",
      "        *   **Traceability:**  Ensure that the decision-making processes of AI systems are traceable and auditable.\n",
      "        *   **Legal & Regulatory Framework:** Develop a legal and regulatory framework that holds individuals and organizations accountable for the harms caused by AI systems.\n",
      "        *   **Ethical Review Boards:**  Establish ethical review boards to oversee the development and deployment of AI systems, particularly in high-risk applications.\n",
      "    *   **Connection to Core Values:**  Links to integrity, transparency, and rule of law.\n",
      "\n",
      "**Addressing Conflicts Between Principles:**\n",
      "\n",
      "Conflicts between these principles are inevitable. For example:\n",
      "\n",
      "*   **Autonomy vs. Societal Benefit:**  Personalized recommendation systems might enhance user experience (autonomy) but also contribute to echo chambers and political polarization (harming societal benefit).\n",
      "*   **Beneficence vs. Accountability:**  Using AI to predict and prevent crime could improve safety (beneficence) but also lead to biased policing and disproportionate targeting of certain communities (undermining fairness).\n",
      "*   **Transparency vs. Security:**  Full transparency of AI algorithms could expose vulnerabilities to malicious actors (compromising security).\n",
      "*   **Fairness vs. Accuracy:**  Algorithms optimized for fairness can sometimes experience a decrease in predictive accuracy, and *vice versa*.\n",
      "\n",
      "Here's how to address these conflicts:\n",
      "\n",
      "1.  **Prioritization & Trade-offs:**\n",
      "    *   Recognize that there's no one-size-fits-all solution.  The prioritization of principles will depend on the specific context, application, and potential impact.\n",
      "    *   Establish a clear and transparent process for making trade-offs between competing principles.\n",
      "    *   Document the rationale for these trade-offs and be prepared to justify them to stakeholders.\n",
      "\n",
      "2.  **Context-Specific Guidelines & Standards:**\n",
      "    *   Develop specific ethical guidelines and standards for different AI applications (e.g., healthcare, finance, education).\n",
      "    *   These guidelines should take into account the unique risks and opportunities associated with each application.\n",
      "\n",
      "3.  **Multi-Stakeholder Engagement:**\n",
      "    *   Involve a diverse range of stakeholders (e.g., users, developers, policymakers, ethicists, civil society organizations) in the development and implementation of ethical frameworks.\n",
      "    *   This will help ensure that the frameworks are comprehensive, relevant, and reflect a broad range of values and perspectives.\n",
      "\n",
      "4.  **Continuous Monitoring & Evaluation:**\n",
      "    *   Continuously monitor the performance of AI systems to identify potential ethical issues.\n",
      "    *   Regularly evaluate the effectiveness of ethical frameworks and update them as needed.\n",
      "\n",
      "5.  **Ethics as a Design Constraint:**\n",
      "    *   Embed ethical considerations into the AI development process from the very beginning.\n",
      "    *   Treat ethical principles as design constraints, rather than afterthoughts.\n",
      "    *   Encourage ethical innovation – designing AI systems that proactively promote ethical values.\n",
      "\n",
      "6.  **The Principle of Proportionality:**\n",
      "    *   A key guiding principle when conflicts arise. This principle suggests that interventions or actions should be proportionate to the potential benefits and risks involved.  It means carefully weighing the potential positive outcomes against the potential negative consequences, and ensuring that the chosen course of action is the least restrictive or intrusive option that effectively achieves the desired goal.\n",
      "\n",
      "**Examples of Conflict Resolution in Specific Scenarios:**\n",
      "\n",
      "*   **Autonomous Vehicles:** Balancing safety (beneficence) with user freedom (autonomy). Prioritize safety, especially when there is a risk to human life. However, users should retain some control over driving modes (e.g., adaptive cruise control) when safety is not significantly compromised.\n",
      "*   **AI-Powered Hiring:** Balancing efficiency (societal benefit) with fairness. Conduct rigorous bias audits of algorithms and data. Implement human-in-the-loop processes to review AI-driven decisions and ensure fairness.  Be transparent with candidates about the use of AI in the hiring process.\n",
      "*   **Healthcare AI:**  Balancing improved diagnostics (beneficence) with patient privacy (autonomy). Use de-identified or anonymized data whenever possible.  Implement strong data security measures. Obtain informed consent from patients before using their data for AI training or analysis.\n",
      "\n",
      "**Conclusion:**\n",
      "\n",
      "Creating an ethical framework for AI is an ongoing process that requires constant vigilance, adaptation, and collaboration. It's not about creating a perfect system, but rather about establishing a dynamic and responsive framework that guides the development and use of AI in a way that benefits humanity and minimizes potential harms.  The key is to cultivate a culture of ethical awareness and responsibility within the AI community.\n",
      "\n",
      "\n",
      "# Response from competitor 3\n",
      "\n",
      "Designing a new ethical framework for artificial intelligence (AI) requires a careful consideration of the complex interplay between user autonomy, societal benefit, and potential risks. Here are the key principles I would incorporate, along with strategies for addressing conflicts that may arise between them:\n",
      "\n",
      "**Key Principles:**\n",
      "\n",
      "1. **Respect for User Autonomy**: AI systems should prioritize user control and agency, ensuring that individuals have the ability to make informed decisions about their data, interactions, and outcomes.\n",
      "2. **Societal Benefit**: AI development and deployment should aim to maximize overall societal benefit, considering factors such as economic growth, environmental sustainability, and social justice.\n",
      "3. **Risk Mitigation**: AI systems should be designed to minimize potential risks, including those related to safety, security, and unintended consequences, such as bias, discrimination, or amplification of existing social issues.\n",
      "4. **Transparency and Explainability**: AI decision-making processes should be transparent and explainable, allowing users to understand the reasoning behind AI-driven recommendations or actions.\n",
      "5. **Accountability**: Developers, deployers, and users of AI systems should be accountable for their actions, including the potential consequences of AI-driven decisions or actions.\n",
      "6. **Inclusivity and Accessibility**: AI systems should be designed to be inclusive and accessible, taking into account diverse user needs, abilities, and cultural backgrounds.\n",
      "7. **Continuous Learning and Improvement**: AI systems should be designed to learn from user feedback, adapt to changing contexts, and improve over time.\n",
      "\n",
      "**Addressing Conflicts:**\n",
      "\n",
      "To address conflicts that may arise between these principles, I would employ the following strategies:\n",
      "\n",
      "1. **Value-Based Decision-Making**: Establish a clear set of values and priorities that guide decision-making, such as prioritizing human well-being, dignity, and autonomy.\n",
      "2. **Trade-Off Analysis**: Conduct thorough trade-off analyses to weigh the potential benefits and risks of different AI development and deployment scenarios.\n",
      "3. **Multistakeholder Engagement**: Foster collaboration and dialogue among diverse stakeholders, including users, developers, policymakers, and civil society organizations, to ensure that a wide range of perspectives are considered.\n",
      "4. **Regulatory Frameworks**: Establish and enforce regulatory frameworks that provide clear guidelines and standards for AI development and deployment, while also allowing for flexibility and innovation.\n",
      "5. **Ethics Review Boards**: Establish ethics review boards or committees to review and assess AI systems, providing an independent, expert perspective on potential risks and benefits.\n",
      "6. **Public Education and Awareness**: Promote public education and awareness about AI, its potential benefits and risks, and the importance of responsible AI development and use.\n",
      "7. **Adaptive Governance**: Develop adaptive governance structures that can evolve with AI technologies, incorporating lessons learned and updates to regulatory frameworks, standards, and guidelines.\n",
      "\n",
      "**Implementation Roadmap:**\n",
      "\n",
      "To implement this ethical framework, I would propose the following steps:\n",
      "\n",
      "1. **Establish a Global AI Ethics Forum**: Bring together international stakeholders to develop and refine the ethical framework, ensuring a comprehensive and inclusive approach.\n",
      "2. **Develop Regulatory Frameworks**: Collaborate with governments and regulatory bodies to establish and enforce regulatory frameworks that support the ethical principles.\n",
      "3. **Create Ethics Review Boards**: Establish ethics review boards or committees to review and assess AI systems, ensuring that they meet the ethical principles and guidelines.\n",
      "4. **Promote Public Education and Awareness**: Develop and disseminate educational materials and programs to raise awareness about AI, its potential benefits and risks, and the importance of responsible AI development and use.\n",
      "5. **Support Research and Development**: Fund research and development projects that focus on creating AI systems that prioritize user autonomy, societal benefit, and risk mitigation.\n",
      "6. **Establish Accountability Mechanisms**: Develop and implement accountability mechanisms, such as certification programs or audit procedures, to ensure that AI developers and deployers are held accountable for their actions.\n",
      "7. **Regularly Review and Update**: Regularly review and update the ethical framework, regulatory frameworks, and guidelines to ensure they remain relevant and effective in addressing the evolving AI landscape.\n",
      "\n",
      "By incorporating these key principles and strategies, we can create a comprehensive ethical framework for AI that balances user autonomy, societal benefit, and potential risks, ultimately promoting responsible AI development and use that benefits humanity as a whole.\n",
      "\n",
      "\n",
      "\n",
      "Now respond with the JSON with the ranked order of the competitors, nothing else. Do not include markdown formatting or code blocks.\n"
     ]
    }
   ],
   "source": [
    "print(judge)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [],
   "source": [
    "judge_messages = [{\"role\": \"user\", \"content\": judge}]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{\"results\": [\"2\", \"1\", \"3\"]}\n"
     ]
    }
   ],
   "source": [
    "# Judgement time!\n",
    "\n",
    "openai = OpenAI()\n",
    "response = openai.chat.completions.create(\n",
    "    model=\"o3-mini\",\n",
    "    messages=judge_messages,\n",
    ")\n",
    "results = response.choices[0].message.content\n",
    "print(results)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Rank 1: gemini-2.0-flash\n",
      "Rank 2: gpt-4o-mini\n",
      "Rank 3: llama-3.3-70b-versatile\n"
     ]
    }
   ],
   "source": [
    "# OK let's turn this into results!\n",
    "\n",
    "results_dict = json.loads(results)\n",
    "ranks = results_dict[\"results\"]\n",
    "for index, result in enumerate(ranks):\n",
    "    competitor = competitors[int(result)-1]\n",
    "    print(f\"Rank {index+1}: {competitor}\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<table style=\"margin: 0; text-align: left; width:100%\">\n",
    "    <tr>\n",
    "        <td style=\"width: 150px; height: 150px; vertical-align: middle;\">\n",
    "            <img src=\"../assets/exercise.png\" width=\"150\" height=\"150\" style=\"display: block;\" />\n",
    "        </td>\n",
    "        <td>\n",
    "            <h2 style=\"color:#ff7800;\">Exercise</h2>\n",
    "            <span style=\"color:#ff7800;\">Which pattern(s) did this use? Try updating this to add another Agentic design pattern.\n",
    "            </span>\n",
    "        </td>\n",
    "    </tr>\n",
    "</table>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<table style=\"margin: 0; text-align: left; width:100%\">\n",
    "    <tr>\n",
    "        <td style=\"width: 150px; height: 150px; vertical-align: middle;\">\n",
    "            <img src=\"../assets/business.png\" width=\"150\" height=\"150\" style=\"display: block;\" />\n",
    "        </td>\n",
    "        <td>\n",
    "            <h2 style=\"color:#00bfff;\">Commercial implications</h2>\n",
    "            <span style=\"color:#00bfff;\">These kinds of patterns - to send a task to multiple models, and evaluate results,\n",
    "            are common where you need to improve the quality of your LLM response. This approach can be universally applied\n",
    "            to business projects where accuracy is critical.\n",
    "            </span>\n",
    "        </td>\n",
    "    </tr>\n",
    "</table>"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": ".venv",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}