python/resources/graders/subresources/grader_models/index.md +0 −1052 deleted
File Deleted View Diff
1# Grader Models
2
3## Domain Types
4
5### Grader Inputs
6
7- `List[GraderInputItem]`
8
9 A list of inputs, each of which may be either an input text, output text, input
10 image, or input audio object.
11
12 - `str`
13
14 A text input to the model.
15
16 - `class ResponseInputText: …`
17
18 A text input to the model.
19
20 - `text: str`
21
22 The text input to the model.
23
24 - `type: Literal["input_text"]`
25
26 The type of the input item. Always `input_text`.
27
28 - `"input_text"`
29
30 - `class GraderInputItemOutputText: …`
31
32 A text output from the model.
33
34 - `text: str`
35
36 The text output from the model.
37
38 - `type: Literal["output_text"]`
39
40 The type of the output text. Always `output_text`.
41
42 - `"output_text"`
43
44 - `class GraderInputItemInputImage: …`
45
46 An image input block used within EvalItem content arrays.
47
48 - `image_url: str`
49
50 The URL of the image input.
51
52 - `type: Literal["input_image"]`
53
54 The type of the image input. Always `input_image`.
55
56 - `"input_image"`
57
58 - `detail: Optional[str]`
59
60 The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.
61
62 - `class ResponseInputAudio: …`
63
64 An audio input to the model.
65
66 - `input_audio: InputAudio`
67
68 - `data: str`
69
70 Base64-encoded audio data.
71
72 - `format: Literal["mp3", "wav"]`
73
74 The format of the audio data. Currently supported formats are `mp3` and
75 `wav`.
76
77 - `"mp3"`
78
79 - `"wav"`
80
81 - `type: Literal["input_audio"]`
82
83 The type of the input item. Always `input_audio`.
84
85 - `"input_audio"`
86
87### Label Model Grader
88
89- `class LabelModelGrader: …`
90
91 A LabelModelGrader object which uses a model to assign labels to each item
92 in the evaluation.
93
94 - `input: List[Input]`
95
96 - `content: InputContent`
97
98 Inputs to the model - can contain template strings. Supports text, output text, input images, and input audio, either as a single item or an array of items.
99
100 - `str`
101
102 A text input to the model.
103
104 - `class ResponseInputText: …`
105
106 A text input to the model.
107
108 - `text: str`
109
110 The text input to the model.
111
112 - `type: Literal["input_text"]`
113
114 The type of the input item. Always `input_text`.
115
116 - `"input_text"`
117
118 - `class InputContentOutputText: …`
119
120 A text output from the model.
121
122 - `text: str`
123
124 The text output from the model.
125
126 - `type: Literal["output_text"]`
127
128 The type of the output text. Always `output_text`.
129
130 - `"output_text"`
131
132 - `class InputContentInputImage: …`
133
134 An image input block used within EvalItem content arrays.
135
136 - `image_url: str`
137
138 The URL of the image input.
139
140 - `type: Literal["input_image"]`
141
142 The type of the image input. Always `input_image`.
143
144 - `"input_image"`
145
146 - `detail: Optional[str]`
147
148 The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.
149
150 - `class ResponseInputAudio: …`
151
152 An audio input to the model.
153
154 - `input_audio: InputAudio`
155
156 - `data: str`
157
158 Base64-encoded audio data.
159
160 - `format: Literal["mp3", "wav"]`
161
162 The format of the audio data. Currently supported formats are `mp3` and
163 `wav`.
164
165 - `"mp3"`
166
167 - `"wav"`
168
169 - `type: Literal["input_audio"]`
170
171 The type of the input item. Always `input_audio`.
172
173 - `"input_audio"`
174
175 - `List[GraderInputItem]`
176
177 - `str`
178
179 A text input to the model.
180
181 - `class ResponseInputText: …`
182
183 A text input to the model.
184
185 - `class GraderInputItemOutputText: …`
186
187 A text output from the model.
188
189 - `text: str`
190
191 The text output from the model.
192
193 - `type: Literal["output_text"]`
194
195 The type of the output text. Always `output_text`.
196
197 - `"output_text"`
198
199 - `class GraderInputItemInputImage: …`
200
201 An image input block used within EvalItem content arrays.
202
203 - `image_url: str`
204
205 The URL of the image input.
206
207 - `type: Literal["input_image"]`
208
209 The type of the image input. Always `input_image`.
210
211 - `"input_image"`
212
213 - `detail: Optional[str]`
214
215 The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.
216
217 - `class ResponseInputAudio: …`
218
219 An audio input to the model.
220
221 - `role: Literal["user", "assistant", "system", "developer"]`
222
223 The role of the message input. One of `user`, `assistant`, `system`, or
224 `developer`.
225
226 - `"user"`
227
228 - `"assistant"`
229
230 - `"system"`
231
232 - `"developer"`
233
234 - `type: Optional[Literal["message"]]`
235
236 The type of the message input. Always `message`.
237
238 - `"message"`
239
240 - `labels: List[str]`
241
242 The labels to assign to each item in the evaluation.
243
244 - `model: str`
245
246 The model to use for the evaluation. Must support structured outputs.
247
248 - `name: str`
249
250 The name of the grader.
251
252 - `passing_labels: List[str]`
253
254 The labels that indicate a passing result. Must be a subset of labels.
255
256 - `type: Literal["label_model"]`
257
258 The object type, which is always `label_model`.
259
260 - `"label_model"`
261
262### Multi Grader
263
264- `class MultiGrader: …`
265
266 A MultiGrader object combines the output of multiple graders to produce a single score.
267
268 - `calculate_output: str`
269
270 A formula to calculate the output based on grader results.
271
272 - `graders: Graders`
273
274 A StringCheckGrader object that performs a string comparison between input and reference using a specified operation.
275
276 - `class StringCheckGrader: …`
277
278 A StringCheckGrader object that performs a string comparison between input and reference using a specified operation.
279
280 - `input: str`
281
282 The input text. This may include template strings.
283
284 - `name: str`
285
286 The name of the grader.
287
288 - `operation: Literal["eq", "ne", "like", "ilike"]`
289
290 The string check operation to perform. One of `eq`, `ne`, `like`, or `ilike`.
291
292 - `"eq"`
293
294 - `"ne"`
295
296 - `"like"`
297
298 - `"ilike"`
299
300 - `reference: str`
301
302 The reference text. This may include template strings.
303
304 - `type: Literal["string_check"]`
305
306 The object type, which is always `string_check`.
307
308 - `"string_check"`
309
310 - `class TextSimilarityGrader: …`
311
312 A TextSimilarityGrader object which grades text based on similarity metrics.
313
314 - `evaluation_metric: Literal["cosine", "fuzzy_match", "bleu", 8 more]`
315
316 The evaluation metric to use. One of `cosine`, `fuzzy_match`, `bleu`,
317 `gleu`, `meteor`, `rouge_1`, `rouge_2`, `rouge_3`, `rouge_4`, `rouge_5`,
318 or `rouge_l`.
319
320 - `"cosine"`
321
322 - `"fuzzy_match"`
323
324 - `"bleu"`
325
326 - `"gleu"`
327
328 - `"meteor"`
329
330 - `"rouge_1"`
331
332 - `"rouge_2"`
333
334 - `"rouge_3"`
335
336 - `"rouge_4"`
337
338 - `"rouge_5"`
339
340 - `"rouge_l"`
341
342 - `input: str`
343
344 The text being graded.
345
346 - `name: str`
347
348 The name of the grader.
349
350 - `reference: str`
351
352 The text being graded against.
353
354 - `type: Literal["text_similarity"]`
355
356 The type of grader.
357
358 - `"text_similarity"`
359
360 - `class PythonGrader: …`
361
362 A PythonGrader object that runs a python script on the input.
363
364 - `name: str`
365
366 The name of the grader.
367
368 - `source: str`
369
370 The source code of the python script.
371
372 - `type: Literal["python"]`
373
374 The object type, which is always `python`.
375
376 - `"python"`
377
378 - `image_tag: Optional[str]`
379
380 The image tag to use for the python script.
381
382 - `class ScoreModelGrader: …`
383
384 A ScoreModelGrader object that uses a model to assign a score to the input.
385
386 - `input: List[Input]`
387
388 The input messages evaluated by the grader. Supports text, output text, input image, and input audio content blocks, and may include template strings.
389
390 - `content: InputContent`
391
392 Inputs to the model - can contain template strings. Supports text, output text, input images, and input audio, either as a single item or an array of items.
393
394 - `str`
395
396 A text input to the model.
397
398 - `class ResponseInputText: …`
399
400 A text input to the model.
401
402 - `text: str`
403
404 The text input to the model.
405
406 - `type: Literal["input_text"]`
407
408 The type of the input item. Always `input_text`.
409
410 - `"input_text"`
411
412 - `class InputContentOutputText: …`
413
414 A text output from the model.
415
416 - `text: str`
417
418 The text output from the model.
419
420 - `type: Literal["output_text"]`
421
422 The type of the output text. Always `output_text`.
423
424 - `"output_text"`
425
426 - `class InputContentInputImage: …`
427
428 An image input block used within EvalItem content arrays.
429
430 - `image_url: str`
431
432 The URL of the image input.
433
434 - `type: Literal["input_image"]`
435
436 The type of the image input. Always `input_image`.
437
438 - `"input_image"`
439
440 - `detail: Optional[str]`
441
442 The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.
443
444 - `class ResponseInputAudio: …`
445
446 An audio input to the model.
447
448 - `input_audio: InputAudio`
449
450 - `data: str`
451
452 Base64-encoded audio data.
453
454 - `format: Literal["mp3", "wav"]`
455
456 The format of the audio data. Currently supported formats are `mp3` and
457 `wav`.
458
459 - `"mp3"`
460
461 - `"wav"`
462
463 - `type: Literal["input_audio"]`
464
465 The type of the input item. Always `input_audio`.
466
467 - `"input_audio"`
468
469 - `List[GraderInputItem]`
470
471 - `str`
472
473 A text input to the model.
474
475 - `class ResponseInputText: …`
476
477 A text input to the model.
478
479 - `class GraderInputItemOutputText: …`
480
481 A text output from the model.
482
483 - `text: str`
484
485 The text output from the model.
486
487 - `type: Literal["output_text"]`
488
489 The type of the output text. Always `output_text`.
490
491 - `"output_text"`
492
493 - `class GraderInputItemInputImage: …`
494
495 An image input block used within EvalItem content arrays.
496
497 - `image_url: str`
498
499 The URL of the image input.
500
501 - `type: Literal["input_image"]`
502
503 The type of the image input. Always `input_image`.
504
505 - `"input_image"`
506
507 - `detail: Optional[str]`
508
509 The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.
510
511 - `class ResponseInputAudio: …`
512
513 An audio input to the model.
514
515 - `role: Literal["user", "assistant", "system", "developer"]`
516
517 The role of the message input. One of `user`, `assistant`, `system`, or
518 `developer`.
519
520 - `"user"`
521
522 - `"assistant"`
523
524 - `"system"`
525
526 - `"developer"`
527
528 - `type: Optional[Literal["message"]]`
529
530 The type of the message input. Always `message`.
531
532 - `"message"`
533
534 - `model: str`
535
536 The model to use for the evaluation.
537
538 - `name: str`
539
540 The name of the grader.
541
542 - `type: Literal["score_model"]`
543
544 The object type, which is always `score_model`.
545
546 - `"score_model"`
547
548 - `range: Optional[List[float]]`
549
550 The range of the score. Defaults to `[0, 1]`.
551
552 - `sampling_params: Optional[SamplingParams]`
553
554 The sampling parameters for the model.
555
556 - `max_completions_tokens: Optional[int]`
557
558 The maximum number of tokens the grader model may generate in its response.
559
560 - `reasoning_effort: Optional[ReasoningEffort]`
561
562 Constrains effort on reasoning for
563 [reasoning models](https://platform.openai.com/docs/guides/reasoning).
564 Currently supported values are `none`, `minimal`, `low`, `medium`, `high`, and `xhigh`. Reducing
565 reasoning effort can result in faster responses and fewer tokens used
566 on reasoning in a response.
567
568 - `gpt-5.1` defaults to `none`, which does not perform reasoning. The supported reasoning values for `gpt-5.1` are `none`, `low`, `medium`, and `high`. Tool calls are supported for all reasoning values in gpt-5.1.
569 - All models before `gpt-5.1` default to `medium` reasoning effort, and do not support `none`.
570 - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort.
571 - `xhigh` is supported for all models after `gpt-5.1-codex-max`.
572
573 - `"none"`
574
575 - `"minimal"`
576
577 - `"low"`
578
579 - `"medium"`
580
581 - `"high"`
582
583 - `"xhigh"`
584
585 - `seed: Optional[int]`
586
587 A seed value to initialize the randomness, during sampling.
588
589 - `temperature: Optional[float]`
590
591 A higher temperature increases randomness in the outputs.
592
593 - `top_p: Optional[float]`
594
595 An alternative to temperature for nucleus sampling; 1.0 includes all tokens.
596
597 - `class LabelModelGrader: …`
598
599 A LabelModelGrader object which uses a model to assign labels to each item
600 in the evaluation.
601
602 - `input: List[Input]`
603
604 - `content: InputContent`
605
606 Inputs to the model - can contain template strings. Supports text, output text, input images, and input audio, either as a single item or an array of items.
607
608 - `str`
609
610 A text input to the model.
611
612 - `class ResponseInputText: …`
613
614 A text input to the model.
615
616 - `class InputContentOutputText: …`
617
618 A text output from the model.
619
620 - `text: str`
621
622 The text output from the model.
623
624 - `type: Literal["output_text"]`
625
626 The type of the output text. Always `output_text`.
627
628 - `"output_text"`
629
630 - `class InputContentInputImage: …`
631
632 An image input block used within EvalItem content arrays.
633
634 - `image_url: str`
635
636 The URL of the image input.
637
638 - `type: Literal["input_image"]`
639
640 The type of the image input. Always `input_image`.
641
642 - `"input_image"`
643
644 - `detail: Optional[str]`
645
646 The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.
647
648 - `class ResponseInputAudio: …`
649
650 An audio input to the model.
651
652 - `List[GraderInputItem]`
653
654 - `str`
655
656 A text input to the model.
657
658 - `class ResponseInputText: …`
659
660 A text input to the model.
661
662 - `class GraderInputItemOutputText: …`
663
664 A text output from the model.
665
666 - `class GraderInputItemInputImage: …`
667
668 An image input block used within EvalItem content arrays.
669
670 - `class ResponseInputAudio: …`
671
672 An audio input to the model.
673
674 - `role: Literal["user", "assistant", "system", "developer"]`
675
676 The role of the message input. One of `user`, `assistant`, `system`, or
677 `developer`.
678
679 - `"user"`
680
681 - `"assistant"`
682
683 - `"system"`
684
685 - `"developer"`
686
687 - `type: Optional[Literal["message"]]`
688
689 The type of the message input. Always `message`.
690
691 - `"message"`
692
693 - `labels: List[str]`
694
695 The labels to assign to each item in the evaluation.
696
697 - `model: str`
698
699 The model to use for the evaluation. Must support structured outputs.
700
701 - `name: str`
702
703 The name of the grader.
704
705 - `passing_labels: List[str]`
706
707 The labels that indicate a passing result. Must be a subset of labels.
708
709 - `type: Literal["label_model"]`
710
711 The object type, which is always `label_model`.
712
713 - `"label_model"`
714
715 - `name: str`
716
717 The name of the grader.
718
719 - `type: Literal["multi"]`
720
721 The object type, which is always `multi`.
722
723 - `"multi"`
724
725### Python Grader
726
727- `class PythonGrader: …`
728
729 A PythonGrader object that runs a python script on the input.
730
731 - `name: str`
732
733 The name of the grader.
734
735 - `source: str`
736
737 The source code of the python script.
738
739 - `type: Literal["python"]`
740
741 The object type, which is always `python`.
742
743 - `"python"`
744
745 - `image_tag: Optional[str]`
746
747 The image tag to use for the python script.
748
749### Score Model Grader
750
751- `class ScoreModelGrader: …`
752
753 A ScoreModelGrader object that uses a model to assign a score to the input.
754
755 - `input: List[Input]`
756
757 The input messages evaluated by the grader. Supports text, output text, input image, and input audio content blocks, and may include template strings.
758
759 - `content: InputContent`
760
761 Inputs to the model - can contain template strings. Supports text, output text, input images, and input audio, either as a single item or an array of items.
762
763 - `str`
764
765 A text input to the model.
766
767 - `class ResponseInputText: …`
768
769 A text input to the model.
770
771 - `text: str`
772
773 The text input to the model.
774
775 - `type: Literal["input_text"]`
776
777 The type of the input item. Always `input_text`.
778
779 - `"input_text"`
780
781 - `class InputContentOutputText: …`
782
783 A text output from the model.
784
785 - `text: str`
786
787 The text output from the model.
788
789 - `type: Literal["output_text"]`
790
791 The type of the output text. Always `output_text`.
792
793 - `"output_text"`
794
795 - `class InputContentInputImage: …`
796
797 An image input block used within EvalItem content arrays.
798
799 - `image_url: str`
800
801 The URL of the image input.
802
803 - `type: Literal["input_image"]`
804
805 The type of the image input. Always `input_image`.
806
807 - `"input_image"`
808
809 - `detail: Optional[str]`
810
811 The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.
812
813 - `class ResponseInputAudio: …`
814
815 An audio input to the model.
816
817 - `input_audio: InputAudio`
818
819 - `data: str`
820
821 Base64-encoded audio data.
822
823 - `format: Literal["mp3", "wav"]`
824
825 The format of the audio data. Currently supported formats are `mp3` and
826 `wav`.
827
828 - `"mp3"`
829
830 - `"wav"`
831
832 - `type: Literal["input_audio"]`
833
834 The type of the input item. Always `input_audio`.
835
836 - `"input_audio"`
837
838 - `List[GraderInputItem]`
839
840 - `str`
841
842 A text input to the model.
843
844 - `class ResponseInputText: …`
845
846 A text input to the model.
847
848 - `class GraderInputItemOutputText: …`
849
850 A text output from the model.
851
852 - `text: str`
853
854 The text output from the model.
855
856 - `type: Literal["output_text"]`
857
858 The type of the output text. Always `output_text`.
859
860 - `"output_text"`
861
862 - `class GraderInputItemInputImage: …`
863
864 An image input block used within EvalItem content arrays.
865
866 - `image_url: str`
867
868 The URL of the image input.
869
870 - `type: Literal["input_image"]`
871
872 The type of the image input. Always `input_image`.
873
874 - `"input_image"`
875
876 - `detail: Optional[str]`
877
878 The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.
879
880 - `class ResponseInputAudio: …`
881
882 An audio input to the model.
883
884 - `role: Literal["user", "assistant", "system", "developer"]`
885
886 The role of the message input. One of `user`, `assistant`, `system`, or
887 `developer`.
888
889 - `"user"`
890
891 - `"assistant"`
892
893 - `"system"`
894
895 - `"developer"`
896
897 - `type: Optional[Literal["message"]]`
898
899 The type of the message input. Always `message`.
900
901 - `"message"`
902
903 - `model: str`
904
905 The model to use for the evaluation.
906
907 - `name: str`
908
909 The name of the grader.
910
911 - `type: Literal["score_model"]`
912
913 The object type, which is always `score_model`.
914
915 - `"score_model"`
916
917 - `range: Optional[List[float]]`
918
919 The range of the score. Defaults to `[0, 1]`.
920
921 - `sampling_params: Optional[SamplingParams]`
922
923 The sampling parameters for the model.
924
925 - `max_completions_tokens: Optional[int]`
926
927 The maximum number of tokens the grader model may generate in its response.
928
929 - `reasoning_effort: Optional[ReasoningEffort]`
930
931 Constrains effort on reasoning for
932 [reasoning models](https://platform.openai.com/docs/guides/reasoning).
933 Currently supported values are `none`, `minimal`, `low`, `medium`, `high`, and `xhigh`. Reducing
934 reasoning effort can result in faster responses and fewer tokens used
935 on reasoning in a response.
936
937 - `gpt-5.1` defaults to `none`, which does not perform reasoning. The supported reasoning values for `gpt-5.1` are `none`, `low`, `medium`, and `high`. Tool calls are supported for all reasoning values in gpt-5.1.
938 - All models before `gpt-5.1` default to `medium` reasoning effort, and do not support `none`.
939 - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort.
940 - `xhigh` is supported for all models after `gpt-5.1-codex-max`.
941
942 - `"none"`
943
944 - `"minimal"`
945
946 - `"low"`
947
948 - `"medium"`
949
950 - `"high"`
951
952 - `"xhigh"`
953
954 - `seed: Optional[int]`
955
956 A seed value to initialize the randomness, during sampling.
957
958 - `temperature: Optional[float]`
959
960 A higher temperature increases randomness in the outputs.
961
962 - `top_p: Optional[float]`
963
964 An alternative to temperature for nucleus sampling; 1.0 includes all tokens.
965
966### String Check Grader
967
968- `class StringCheckGrader: …`
969
970 A StringCheckGrader object that performs a string comparison between input and reference using a specified operation.
971
972 - `input: str`
973
974 The input text. This may include template strings.
975
976 - `name: str`
977
978 The name of the grader.
979
980 - `operation: Literal["eq", "ne", "like", "ilike"]`
981
982 The string check operation to perform. One of `eq`, `ne`, `like`, or `ilike`.
983
984 - `"eq"`
985
986 - `"ne"`
987
988 - `"like"`
989
990 - `"ilike"`
991
992 - `reference: str`
993
994 The reference text. This may include template strings.
995
996 - `type: Literal["string_check"]`
997
998 The object type, which is always `string_check`.
999
1000 - `"string_check"`
1001
1002### Text Similarity Grader
1003
1004- `class TextSimilarityGrader: …`
1005
1006 A TextSimilarityGrader object which grades text based on similarity metrics.
1007
1008 - `evaluation_metric: Literal["cosine", "fuzzy_match", "bleu", 8 more]`
1009
1010 The evaluation metric to use. One of `cosine`, `fuzzy_match`, `bleu`,
1011 `gleu`, `meteor`, `rouge_1`, `rouge_2`, `rouge_3`, `rouge_4`, `rouge_5`,
1012 or `rouge_l`.
1013
1014 - `"cosine"`
1015
1016 - `"fuzzy_match"`
1017
1018 - `"bleu"`
1019
1020 - `"gleu"`
1021
1022 - `"meteor"`
1023
1024 - `"rouge_1"`
1025
1026 - `"rouge_2"`
1027
1028 - `"rouge_3"`
1029
1030 - `"rouge_4"`
1031
1032 - `"rouge_5"`
1033
1034 - `"rouge_l"`
1035
1036 - `input: str`
1037
1038 The text being graded.
1039
1040 - `name: str`
1041
1042 The name of the grader.
1043
1044 - `reference: str`
1045
1046 The text being graded against.
1047
1048 - `type: Literal["text_similarity"]`
1049
1050 The type of grader.
1051
1052 - `"text_similarity"`