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