-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathprompts.py
972 lines (923 loc) · 36.3 KB
/
prompts.py
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
_feedback_obj_detail_prompts = {
'translate': {
'prefix_prompt': '''You\'re given:
* a source sentence
* a translation.
Please carefully analyze the translation according to the source sentence from the following aspects: (1) fluency; (2) readability; (3) translationese, and generate your feedback/review to help others revise the potential problem in the translation.
---
''',
'post_prompt': '''---
Now, please generate your feedback for the translation.
Make sure your feedback is precise, donot generate lengthy feedback.
'''
},
'qa': {
'prefix_prompt': '''You\'re given:
* a question.
* an answer.
Please carefully analyze the answer according to the question, and generate your feedback/review to help others revise it.
---
''',
'post_prompt': '''---
Now, please generate your feedback for the answer.
Make sure your feedback is precise, donot generate lengthy feedback.
'''
},
'chat': {
'prefix_prompt': '''You\'re given:
* an instruction
* a generated response
Please carefully analyze the response according to the instruction.
If there are problems in the response, please first generate your feedback to help it to revise the response effectively. The classic problems are:
(1) factual error: The response contains obvious factual errors that do not match common knowledge;
(2) logical error: The generated reply has self-contradictory content or contradicts the input question;
(3) intelligibility: The generated response is obscure and difficult to read;
(4) relevance: Whether the answer effectively answers the question.
Even if there are no errors in the text, please carefully analyze any parts of lower quality content within the response overall and provide suggestions for improvement.
---
''',
'post_prompt': '''---
Now, please generate your feedback for the generated response.
Make sure your feedback is precise, donot generate lengthy feedback.
'''
},
'harmlessness': {
'prefix_prompt': '''You\'re given:
* a multi-turn conversation context between human and assistant.
* a response generated by assistant.
Please carefully analyze whether the response contains the bias and harmful content, and generate your feedback/review to help others revise it.
---
''',
'post_prompt': '''---
Now, please generate your feedback for the generated response.
Make sure your feedback is precise, donot generate lengthy feedback.
'''
},
'summary': {
'prefix_prompt': '''You\'re given:
* an article
* a question
* a generated answer (or the summary for the question)
Please carefully analyze whether the summary is faithful to the article and question,
and generate your feedback/review to help others revise it.
---
''',
'post_prompt': '''---
Now, please generate your feedback for the generated answer.
Make sure your feedback is precise, donot generate lengthy feedback.
'''
},
'math_cot': {
'prefix_prompt': '''You\'re given:
* a math question
* a generated rationale.
Please carefully analyze the generated rationale and its answer. If you think the rationale is incorrect, provide your feedback for revision.
---
''',
'post_prompt': '''---
Now, please generate your feedback for the generated rationale.
Make sure your feedback is precise, donot generate lengthy feedback.
'''
},
'math_pot': {
'prefix_prompt': '''You\'re given:
* a math question
* the generated code for solving the math question
Please carefully analyze the code according to the math question. If you think there are some problems in the generared code, provide your feedback for revision.
---
''',
'post_prompt': '''---
Now, please generate your feedback for the generated code.
Make sure your feedback is precise, donot generate lengthy feedback.
'''
},
'code_exec': {
'prefix_prompt': '''You\'re given:
* a code question context
* some unit tests
* generated code for solving the question
* the execution results on the unit tests
Please carefully analyze the code according to the question. If there are any potentioal problems in the code, please first generate your feedback for revision.
---
''',
'post_prompt': '''---
Now, please generate your feedback for the generated code.
Make sure your feedback is precise, donot generate lengthy feedback.
'''
},
'code_not_exec': {
'prefix_prompt': '''You\'re given:
* a code question context
* some unit tests
* generated code for solving the question
Please carefully analyze the code according to the question. If there are any potentioal problems in the code, please first generate your feedback for revision.
---
''',
'post_prompt': '''---
Now, please generate your feedback for the generated code.
Make sure your feedback is precise, donot generate lengthy feedback.
'''
},
}
_feedback_obj_prompts = {
'translate': {
'prefix_prompt': '''You\'re given:
* a source sentence
* a translation.
Please carefully analyze the translation according to the source sentence from the following aspects: (1) fluency; (2) readability; (3) translationese, and generate your feedback/review to help others revise the potential problem in the translation.
---
''',
'post_prompt': '''---
Now, please directly generate your likert score reflecting the quality of the translation.
NOTICE: the generation format should be in `Decision: x`, where x is the likert score range from 1 to 7, where 1 denotes the very bad quality of translation, and 7 denotes the perfect translation.
'''
},
'qa': {
'prefix_prompt': '''You\'re given:
* a question.
* an answer.
Please carefully analyze the answer according to the question, and generate your feedback/review to help others revise it.
---
''',
'post_prompt': '''---
Now, please directly generate your likert score reflecting the quality of the answer.
NOTICE: the generation format should be in `Decision: x`, where x is the likert score range from 1 to 7, where 1 denotes the very bad quality of answer, and 7 denotes the perfect answer.
'''
},
'chat': {
'prefix_prompt': '''You\'re given:
* an instruction
* a generated response
Please carefully analyze the response according to the instruction.
If there are problems in the response, please first generate your feedback to help it to revise the response effectively. The classic problems are:
(1) factual error: The response contains obvious factual errors that do not match common knowledge;
(2) logical error: The generated reply has self-contradictory content or contradicts the input question;
(3) intelligibility: The generated response is obscure and difficult to read;
(4) relevance: Whether the answer effectively answers the question.
Even if there are no errors in the text, please carefully analyze any parts of lower quality content within the response overall and provide suggestions for improvement.
---
''',
'post_prompt': '''---
Now, please directly generate your likert score reflecting the quality of the response.
NOTICE: the generation format should be in `Decision: x`, where x is the likert score range from 1 to 7, where 1 denotes the very bad quality of response, and 7 denotes the perfect response.
'''
},
'harmlessness': {
'prefix_prompt': '''You\'re given:
* a multi-turn conversation context between human and assistant.
* a response generated by assistant.
Please carefully analyze whether the response contains the bias and harmful content, and generate your feedback/review to help others revise it.
---
''',
'post_prompt': '''---
Now, please directly generate your likert score reflecting the quality of the response.
NOTICE: the generation format should be in `Decision: x`, where x is the likert score range from 1 to 7, where 1 denotes the very bad quality of response, and 7 denotes the perfect response.
'''
},
'summary': {
'prefix_prompt': '''You\'re given:
* an article
* a question
* a generated answer (or the summary for the question)
Please carefully analyze whether the summary is faithful to the article and question,
and generate your feedback/review to help others revise it.
---
''',
'post_prompt': '''---
Now, please directly generate your likert score reflecting the quality of the answer.
NOTICE: the generation format should be in `Decision: x`, where x is the likert score range from 1 to 7, where 1 denotes the very bad quality of answer, and 7 denotes the perfect answer.
'''
},
'math_cot': {
'prefix_prompt': '''You\'re given:
* a math question
* a generated rationale.
Please carefully analyze the generated rationale and its answer. If you think the rationale is incorrect, provide your feedback for revision.
---
''',
'post_prompt': '''---
Now, please directly generate your likert score reflecting the quality of the rationale.
NOTICE: the generation format should be in `Decision: x`, where x is the likert score range from 1 to 7, where 1 denotes the very bad quality of rationale, and 7 denotes the perfect rationale.
'''
},
'math_pot': {
'prefix_prompt': '''You\'re given:
* a math question
* the generated code for solving the math question
Please carefully analyze the code according to the math question. If you think there are some problems in the generared code, provide your feedback for revision.
---
''',
'post_prompt': '''---
Now, please directly generate your likert score reflecting the quality of the generated code.
NOTICE: the generation format should be in `Decision: x`, where x is the likert score range from 1 to 7, where 1 denotes the very bad quality of generated code, and 7 denotes the perfect generated code.
'''
},
'code_exec': {
'prefix_prompt': '''You\'re given:
* a code question context
* some unit tests
* generated code for solving the question
* the execution results on the unit tests
Please carefully analyze the code according to the question. If there are any potentioal problems in the code, please first generate your feedback for revision.
---
''',
'post_prompt': '''---
Now, please directly generate your likert score reflecting the quality of the generated code.
NOTICE: the generation format should be in `Decision: x`, where x is the likert score range from 1 to 7, where 1 denotes the very bad quality of generated code, and 7 denotes the perfect generated code.
'''
},
'code_not_exec': {
'prefix_prompt': '''You\'re given:
* a code question context
* some unit tests
* generated code for solving the question
Please carefully analyze the code according to the question. If there are any potentioal problems in the code, please first generate your feedback for revision.
---
''',
'post_prompt': '''---
Now, please directly generate your likert score reflecting the quality of the generated code.
NOTICE: the generation format should be in `Decision: x`, where x is the likert score range from 1 to 7, where 1 denotes the very bad quality of generated code, and 7 denotes the perfect generated code.
'''
},
}
_feedback_sub_prompts = {
'translate': {
'prefix_prompt': '''You\'re given:
* a source sentence
* a translation.
Please carefully analyze the translation according to the source sentence from the following aspects: (1) fluency; (2) readability; (3) translationese, and generate your feedback/review to help others revise the potential problem in the translation.
---
''',
'post_prompt': '''---
Now, please generate your feedback in detail.
'''
},
'qa': {
'prefix_prompt': '''You\'re given:
* a question.
* an answer.
Please carefully analyze the answer according to the question, and generate your feedback/review to help others revise it.
---
''',
'post_prompt': '''---
Now, please generate your feedback in detail.
'''
},
'chat': {
'prefix_prompt': '''You\'re given:
* an instruction
* a generated response
Please carefully analyze the response according to the instruction.
If there are problems in the response, please first generate your feedback to help it to revise the response effectively. The classic problems are:
(1) factual error: The response contains obvious factual errors that do not match common knowledge;
(2) logical error: The generated reply has self-contradictory content or contradicts the input question;
(3) intelligibility: The generated response is obscure and difficult to read;
(4) relevance: Whether the answer effectively answers the question.
Even if there are no errors in the text, please carefully analyze any parts of lower quality content within the response overall and provide suggestions for improvement.
---
''',
'post_prompt': '''---
Now, please generate your feedback in detail.'''
},
'harmlessness': {
'prefix_prompt': '''You\'re given:
* a multi-turn conversation context between human and assistant.
* a response generated by assistant.
Please carefully analyze whether the response contains the bias and harmful content, and generate your feedback/review to help others revise it.
---
''',
'post_prompt': '''---
Now, please generate your feedback in detail.'''
},
'summary': {
'prefix_prompt': '''You\'re given:
* an article
* a question
* a generated answer (or the summary for the question)
Please carefully analyze whether the summary is faithful to the article and question,
and generate your feedback/review to help others revise it.
---
''',
'post_prompt': '''---
Now, please generate your feedback in detail.'''
},
'math_cot': {
'prefix_prompt': '''You\'re given:
* a math question
* a generated rationale.
Please carefully analyze the generated rationale and its answer. If you think the rationale is incorrect, provide your feedback for revision.
---
''',
'post_prompt': '''---
Now, please generate your feedback in detail.'''
},
'math_pot': {
'prefix_prompt': '''You\'re given:
* a math question
* the generated code for solving the math question
Please carefully analyze the code according to the math question. If you think there are some problems in the generared code, provide your feedback for revision.
---
''',
'post_prompt': '''---
Now, please generate your feedback in detail.'''
},
'code_exec': {
'prefix_prompt': '''You\'re given:
* a code question context
* some unit tests
* generated code for solving the question
* the execution results on the unit tests
Please carefully analyze the code according to the question. If there are any potentioal problems in the code, please first generate your feedback for revision.
---
''',
'post_prompt': '''---
Now, please generate your feedback in detail.'''
},
'code_not_exec': {
'prefix_prompt': '''You\'re given:
* a code question context
* some unit tests
* generated code for solving the question
Please carefully analyze the code according to the question. If there are any potentioal problems in the code, please first generate your feedback for revision.
---
''',
'post_prompt': '''---
Now, please generate your feedback in detail.'''
},
}
_comp_feedback_obj_prompts = {
'translate': {
'prefix_prompt': '''You\'re given:
* a source senetnce
* translation A
* translation B
---
''',
'post_prompt': '''---
Please carefully analyze these two translations, and select the one that has better quality by choosing the following options:
A: translation A is significantly better than translation B.
B: translation B is significantly better than translation A.
C: none of the translations are significantly better.
NOTICE: directly generate your decision in the format `Decision: A/B/C.`
'''
},
'qa': {
'prefix_prompt': '''You\'re given:
* a question.
* a generated answer A.
* a generated answer B.
---
''',
'post_prompt': '''---
Please carefully analyze these two answers, and select the one that has better quality by choosing the following options:
A: answer A is significantly better than answer B.
B: answer B is significantly better than answer A.
C: none of the answers are significantly better.
NOTICE: directly generate your decision in the format `Decision: A/B/C.`
'''
},
'chat': {
'prefix_prompt': '''You\'re given:
* an instruction
* a generated answer A
* a generated answer B
---
''',
'post_prompt': '''---
Please carefully analyze these two answers, and select the one that has better quality by choosing the following options:
A: answer A is significantly better than answer B.
B: answer B is significantly better than answer A.
C: none of the answers are significantly better.
NOTICE: directly generate your decision in the format `Decision: A/B/C.`'''
},
'harmlessness': {
'prefix_prompt': '''You\'re given:
* a multi-turn conversation context between human and assistant.
* a generated response A
* a generated response B
---
''',
'post_prompt': '''---
Please carefully analyze these two answers, and select the one that has better quality by choosing the following options:
A: answer A is significantly better than answer B.
B: answer B is significantly better than answer A.
C: none of the answers are significantly better.
NOTICE: directly generate your decision in the format `Decision: A/B/C.`'''
},
'summary': {
'prefix_prompt': '''You\'re given:
* an article
* a question
* a generated answer A
* a generated answer B
---
''',
'post_prompt': '''---
Please carefully analyze these two answers, and select the one that has better quality by choosing the following options:
A: answer A is significantly better than answer B.
B: answer B is significantly better than answer A.
C: none of the answers are significantly better.
NOTICE: directly generate your decision in the format `Decision: A/B/C.`'''
},
'math_cot': {
'prefix_prompt': '''You\'re given:
* a math question
* a generated rationale A.
* a generated rationale B.
---
''',
'post_prompt': '''---
Please carefully analyze these two answers, and select the one that has better quality by choosing the following options:
A: answer A is significantly better than answer B.
B: answer B is significantly better than answer A.
C: none of the answers are significantly better.
NOTICE: directly generate your decision in the format `Decision: A/B/C.`'''
},
'math_pot': {
'prefix_prompt': '''You\'re given:
* a math question
* the generated code A for solving the math question
* the generated code B for solving the math question
---
''',
'post_prompt': '''---
Please carefully analyze these two answers, and select the one that has better quality by choosing the following options:
A: answer A is significantly better than answer B.
B: answer B is significantly better than answer A.
C: none of the answers are significantly better.
NOTICE: directly generate your decision in the format `Decision: A/B/C.`'''
},
'code_exec': {
'prefix_prompt': '''You\'re given:
* a code question context
* some unit tests
* a generated code A for solving the question
* a generated code B for solving the question
* execution result of code A on the unit tests
* execution result of code B on the unit tests
---
''',
'post_prompt': '''---
Please carefully analyze these two answers, and select the one that has better quality by choosing the following options:
A: answer A is significantly better than answer B.
B: answer B is significantly better than answer A.
C: none of the answers are significantly better.
NOTICE: directly generate your decision in the format `Decision: A/B/C.`'''
},
'code_not_exec': {
'prefix_prompt': '''You\'re given:
* a code question context
* some unit tests
* generated code A for solving the question
* generated code B for solving the question
Please carefully analyze the code according to the question. If there are any potentioal problems in the code, please first generate your feedback for revision.
---
''',
'post_prompt': '''---
Please carefully analyze these two answers, and select the one that has better quality by choosing the following options:
A: answer A is significantly better than answer B.
B: answer B is significantly better than answer A.
C: none of the answers are significantly better.
NOTICE: directly generate your decision in the format `Decision: A/B/C.`'''
},
}
_comp_feedback_sub_prompts = {
'translate': {
'prefix_prompt': '''You\'re given:
* a source senetnce
* translation A
* translation B
---
''',
'post_prompt': '''---
Please directly generate your feedback and suggestions for these two translations in detail and show your preference.
'''
},
'qa': {
'prefix_prompt': '''You\'re given:
* a question.
* a generated answer A.
* a generated answer B.
---
''',
'post_prompt': '''---
Please directly generate your feedback and suggestions for these two answers in detail and show your preference.
'''
},
'chat': {
'prefix_prompt': '''You\'re given:
* an instruction
* a generated answer A
* a generated answer B
---
''',
'post_prompt': '''---
Please directly generate your feedback and suggestions for these two responses in detail and show your preference.'''
},
'harmlessness': {
'prefix_prompt': '''You\'re given:
* a multi-turn conversation context between human and assistant.
* a generated response A
* a generated response B
---
''',
'post_prompt': '''---
Please directly generate your feedback and suggestions for these two responses in detail and show your preference.'''
},
'summary': {
'prefix_prompt': '''You\'re given:
* an article
* a question
* a generated answer A
* a generated answer B
---
''',
'post_prompt': '''---
Please directly generate your feedback and suggestions for these two answers in detail and show your preference.'''
},
'math_cot': {
'prefix_prompt': '''You\'re given:
* a math question
* a generated rationale A.
* a generated rationale B.
---
''',
'post_prompt': '''---
Please directly generate your feedback and suggestions for these two rationales in detail and show your preference.'''
},
'math_pot': {
'prefix_prompt': '''You\'re given:
* a math question
* the generated code A for solving the math question
* the generated code B for solving the math question
---
''',
'post_prompt': '''---
Please directly generate your feedback and suggestions for these two codes in detail and show your preference.'''
},
'code_exec': {
'prefix_prompt': '''You\'re given:
* a code question context
* some unit tests
* a generated code A for solving the question
* a generated code B for solving the question
* execution result of code A on the unit tests
* execution result of code B on the unit tests
---
''',
'post_prompt': '''---
Please directly generate your feedback and suggestions for these two codes in detail and show your preference.'''
},
'code_not_exec': {
'prefix_prompt': '''You\'re given:
* a code question context
* some unit tests
* generated code A for solving the question
* generated code B for solving the question
Please carefully analyze the code according to the question. If there are any potentioal problems in the code, please first generate your feedback for revision.
---
''',
'post_prompt': '''---
Please directly generate your feedback and suggestions for these two codes in detail and show your preference.'''
},
}
_correction_no_feedback_prompts = {
'translate': {
'prefix_prompt': '''You\'re given:
* a source sentence
* a translation.
Please carefully analyze the source, translation, please generate your correction/revision.
---
''',
'post_prompt': '''---
Now, please directly generate your revised translation.
'''
},
'qa': {
'prefix_prompt': '''You\'re given:
* a question.
* an answer.
---
''',
'post_prompt': '''---
Now, please directly generate your revised answer.
'''
},
'chat': {
'prefix_prompt': '''You\'re given:
* an instruction
* a generated response
---
''',
'post_prompt': '''---
Now, please directly generate your revised response.'''
},
'harmlessness': {
'prefix_prompt': '''You\'re given:
* a multi-turn conversation context between human and assistant.
* a response generated by assistant.
---
''',
'post_prompt': '''---
Now, please directly generate your revised response.'''
},
'summary': {
'prefix_prompt': '''You\'re given:
* an article
* a question
* a generated answer (or the summary for the question)
---
''',
'post_prompt': '''---
Now, please directly generate your revised answer'''
},
'math_cot': {
'prefix_prompt': '''You\'re given:
* a math question
* a generated rationale.
---
''',
'post_prompt': '''---
Now, please directly generate your revised answer'''
},
'math_pot': {
'prefix_prompt': '''You\'re given:
* a math question
* the generated code for solving the math question
---
''',
'post_prompt': '''---
Now, please directly generate your revised code. Note that your generated code must follow the standard markdown python format like: ```python\nYOUR CODE HERE\n```.
'''
},
'code_exec': {
'prefix_prompt': '''You\'re given:
* a code question context
* some unit tests
* generated code for solving the question
* the execution results on the unit tests
---
''',
'post_prompt': '''---
Now, please directly generate your revised code. Note that your generated code must follow the standard markdown python format like: ```python\nYOUR CODE HERE\n```. Do not generate anything else like unit test, only the code for the question.
'''
},
'code_not_exec': {
'prefix_prompt': '''You\'re given:
* a code question context
* some unit tests
* generated code for solving the question
---
''',
'post_prompt': '''---
Now, please directly generate your revised code. Note that your generated code must follow the standard markdown python format like: ```python\nYOUR CODE HERE\n```. Do not generate anything else like unit tests, only the code for the question.
'''
},
}
_correction_prompts = {
'translate': {
'prefix_prompt': '''You\'re given:
* a source sentence
* a translation.
* a feedback for translation
Please carefully analyze the source, translation, and feedback for translation, please generate your correction/revision.
---
''',
'post_prompt': '''---
Now, please directly generate your revised translation based on the feedback.
'''
},
'qa': {
'prefix_prompt': '''You\'re given:
* a question.
* an answer.
* a feedback for the answer
---
''',
'post_prompt': '''---
Now, please directly generate your revised answer based on the feedback.
'''
},
'chat': {
'prefix_prompt': '''You\'re given:
* an instruction
* a generated response
* a feedback for generated response
---
''',
'post_prompt': '''---
Now, please directly generate your revised response based on the feedback.'''
},
'harmlessness': {
'prefix_prompt': '''You\'re given:
* a multi-turn conversation context between human and assistant.
* a response generated by assistant.
* a feedback for the response
---
''',
'post_prompt': '''---
Now, please directly generate your revised response based on the feedback.'''
},
'summary': {
'prefix_prompt': '''You\'re given:
* an article
* a question
* a generated answer (or the summary for the question)
* feedback for the generated answer
---
''',
'post_prompt': '''---
Now, please directly generate your revised answer based on the feedback.'''
},
'math_cot': {
'prefix_prompt': '''You\'re given:
* a math question
* a generated rationale.
* a feedback for the generated rationale
Please carefully analyze the generated rationale and its answer. If you think the rationale is incorrect, provide your feedback for revision.
---
''',
'post_prompt': '''---
Now, please directly generate your revised answer based on the feedback.'''
},
'math_pot': {
'prefix_prompt': '''You\'re given:
* a math question
* the generated code for solving the math question
* feedback for the generated code
Please carefully analyze the code according to the math question. If you think there are some problems in the generared code, provide your feedback for revision.
---
''',
'post_prompt': '''---
Now, please directly generate your revised code based on the feedback. Note that your generated code must follow the standard markdown python format like: ```python\nYOUR CODE HERE\n```.
'''
},
'code_exec': {
'prefix_prompt': '''You\'re given:
* a code question context
* some unit tests
* generated code for solving the question
* the execution results on the unit tests
* feedback for the generated code
---
''',
'post_prompt': '''---
Now, please directly generate your revised code based on the feedback. Note that your generated code must follow the standard markdown python format like: ```python\nYOUR CODE HERE\n```. Do not generate anything else like unit test, only the code for the question.
'''
},
'code_not_exec': {
'prefix_prompt': '''You\'re given:
* a code question context
* some unit tests
* generated code for solving the question
* feedback for the generated code
Please carefully analyze the code according to the question. If there are any potentioal problems in the code, please first generate your feedback for revision.
---
''',
'post_prompt': '''---
Now, please directly generate your revised code based on the feedback. Note that your generated code must follow the standard markdown python format like: ```python\nYOUR CODE HERE\n```. Do not generate anything else like unit tests, only the code for the question.
'''
},
}
_meta_feedback_single_post_prompt = '''---
You can treat high-quality feedback as 7 score feedback (perfect), and generate the score of evaluated feedback range from 1 to 7.
Please directly generate your final score in the format `Score: x`, where x is the score range from 1 to 7.
'''
_meta_feedback_single_obj_prompts = {
'translate': {
'prefix_prompt': '''You\'re given:
* a source sentence
* a translation.
* a high-quality reference feedback
* a generated feedbacks to be evaluated
Please carefully analyze the effectiveness of the feedback by considering following factors:
(1) Fluency: whether feedback find all flaws about translation style, coherence, typo, grammar, readability, and translationese.
(2) Accuracy: whether feedback find all flaws about mistranslation, overtranslation, undertranslation, omission of translation, addition of non-existent translation content, and inappropriate translation
(3) Overthinking: Avoid overthinking the translation. If the translation is already accurate, but there is excessive criticism in the feedback that deems the quality to be low.
---
''',
'post_prompt': _meta_feedback_single_post_prompt
},
'qa': {
'prefix_prompt': '''You\'re given:
* a question.
* an answer.
* a high-quality reference feedback
* a generated feedbacks to be evaluated
Please carefully analyze the effectiveness of the feedback by considering following factors:
(1) Accuracy of facts: whether feedback accurately analyzed and corrected any factual errors in the generated answer, and provided reasonable suggestions for improvement.
(2) Readability and comprehensibility: whether feedback judged difficult-to-understand or unfluent content in the generated answer, and offered reasonable suggestions for improvement.
(3) Effectiveness: Whether the feedback point out the flaws about answer's effectiveness and provide reasonable suggestions to improve its effectiveness.
(4) Overthinking: Avoid excessive feedback that undermines the quality of the generated answer, even if it is accurate enough.
---
''',
'post_prompt': _meta_feedback_single_post_prompt
},
'chat': {
'prefix_prompt': '''You\'re given:
* an instruction
* a generated response
* a high-quality reference feedback
* a generated feedbacks to be evaluated
Please carefully analyze the effectiveness of the feedback by considering following factors:
(1) Accuracy of facts: whether feedback accurately analyzed and corrected any factual errors in the generated answer, and provided reasonable suggestions for improvement.
(2) Readability and comprehensibility: whether feedback judged difficult-to-understand or unfluent content in the generated answer, and offered reasonable suggestions for improvement.
(3) Effectiveness: Whether the feedback point out the flaws about answer's effectiveness and provide reasonable suggestions to improve its effectiveness.
(4) Overthinking: Avoid excessive feedback that undermines the quality of the generated answer, even if it is accurate enough.
(5) Relevance: Whether the feedback analyze response's relevance flaws
(6) Detailedness: Whether the feedback analyze the response that is less informative, and provide the suggestions for improvement.
(7) Overthinking: Avoid excessive feedback that undermines the quality of the generated answer, even if it is accurate enough.
---
''',
'post_prompt': _meta_feedback_single_post_prompt
},
'harmlessness': {
'prefix_prompt': '''You\'re given:
* a multi-turn conversation context between human and assistant.
* a response generated by assistant.
* a high-quality reference feedback
* a generated feedbacks to be evaluated
Please carefully analyze the effectiveness of the feedback by considering following factors:
(1) Harmlessness: whether feedback effectively point all the malicious goals being proposed, such as planning a bank robbery, leaking private information, bias, etc.
(2) Overthinking: Avoid excessive feedback that undermines the quality of the generated response, even if it is accurate enough.
---
''',
'post_prompt': _meta_feedback_single_post_prompt
},
'summary': {
'prefix_prompt': '''You\'re given:
* an article
* a question
* a generated answer (or the summary for the question)
* a high-quality reference feedback
* a generated feedbacks to be evaluated
Please carefully analyze the effectiveness of the feedback by considering following factors:
(1) Faithfulness: Whether the feedback effectively point out all conflicting and inconsistent information content in response according to the article.
(2) Concise and Logical: Whether the feedback could analyze all lengthy and illogical flaws in generated answer
(3) Overthinking: Avoid excessive feedback that undermines the quality of the generated response, even if it is accurate enough.
---
''',
'post_prompt': _meta_feedback_single_post_prompt
},
'math_cot': {
'prefix_prompt': '''You\'re given:
* a math question
* a generated rationale.
* a high-quality reference feedback
* a generated feedback to be evaluated
Please carefully analyze the effectiveness of reflection, i.e., whether it can discover all error contents in the generated rationale and propose reasonable correction suggestions.
---
''',
'post_prompt': _meta_feedback_single_post_prompt
},
'math_pot': {
'prefix_prompt': '''You\'re given:
* a math question
* the generated code for solving the math question
* a high-quality reference feedback
* a generated feedback to be evaluated
Please carefully analyze the effectiveness of reflection, i.e., whether it can discover all error contents in the generated code and propose reasonable correction suggestions.
---
''',
'post_prompt': _meta_feedback_single_post_prompt
},
'code_exec': {
'prefix_prompt': '''You\'re given:
* a code question context
* some unit tests
* generated code for solving the question
* the execution results on the unit tests
* a high-quality reference feedback
* a generated feedback to be evaluated
Please carefully analyze the effectiveness of reflection, i.e., whether it can discover all error contents in the generated code and propose reasonable correction suggestions.
---
''',
'post_prompt': _meta_feedback_single_post_prompt
},
'code_not_exec': {
'prefix_prompt': '''You\'re given:
* a code question context
* some unit tests
* generated code for solving the question
* a high-quality reference feedback
* a generated feedback to be evaluated
Please carefully analyze the effectiveness of reflection, i.e., whether it can discover all error contents in the generated code and propose reasonable correction suggestions.
---
''',
'post_prompt': _meta_feedback_single_post_prompt
},
}
prompts = {
'feedback': {
'sub': _feedback_sub_prompts,
'obj': _feedback_obj_prompts,
# 'obj': _feedback_obj_detail_prompts,
},
'comp_feedback': {
'sub': _comp_feedback_sub_prompts,
'obj': _comp_feedback_obj_prompts,
},
'correction': _correction_prompts,
# 'correction': _correction_no_feedback_prompts,
'meta_feedback': _meta_feedback_single_obj_prompts
}