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