python/resources/fine_tuning/subresources/methods/index.md +0 −825 deleted
File Deleted View Diff
1# Methods
2
3## Domain Types
4
5### Dpo Hyperparameters
6
7- `class DpoHyperparameters: …`
8
9 The hyperparameters used for the DPO fine-tuning job.
10
11 - `batch_size: Optional[Union[Literal["auto"], int, null]]`
12
13 Number of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.
14
15 - `Literal["auto"]`
16
17 - `"auto"`
18
19 - `int`
20
21 - `beta: Optional[Union[Literal["auto"], float, null]]`
22
23 The beta value for the DPO method. A higher beta value will increase the weight of the penalty between the policy and reference model.
24
25 - `Literal["auto"]`
26
27 - `"auto"`
28
29 - `float`
30
31 - `learning_rate_multiplier: Optional[Union[Literal["auto"], float, null]]`
32
33 Scaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
34
35 - `Literal["auto"]`
36
37 - `"auto"`
38
39 - `float`
40
41 - `n_epochs: Optional[Union[Literal["auto"], int, null]]`
42
43 The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
44
45 - `Literal["auto"]`
46
47 - `"auto"`
48
49 - `int`
50
51### Dpo Method
52
53- `class DpoMethod: …`
54
55 Configuration for the DPO fine-tuning method.
56
57 - `hyperparameters: Optional[DpoHyperparameters]`
58
59 The hyperparameters used for the DPO fine-tuning job.
60
61 - `batch_size: Optional[Union[Literal["auto"], int, null]]`
62
63 Number of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.
64
65 - `Literal["auto"]`
66
67 - `"auto"`
68
69 - `int`
70
71 - `beta: Optional[Union[Literal["auto"], float, null]]`
72
73 The beta value for the DPO method. A higher beta value will increase the weight of the penalty between the policy and reference model.
74
75 - `Literal["auto"]`
76
77 - `"auto"`
78
79 - `float`
80
81 - `learning_rate_multiplier: Optional[Union[Literal["auto"], float, null]]`
82
83 Scaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
84
85 - `Literal["auto"]`
86
87 - `"auto"`
88
89 - `float`
90
91 - `n_epochs: Optional[Union[Literal["auto"], int, null]]`
92
93 The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
94
95 - `Literal["auto"]`
96
97 - `"auto"`
98
99 - `int`
100
101### Reinforcement Hyperparameters
102
103- `class ReinforcementHyperparameters: …`
104
105 The hyperparameters used for the reinforcement fine-tuning job.
106
107 - `batch_size: Optional[Union[Literal["auto"], int, null]]`
108
109 Number of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.
110
111 - `Literal["auto"]`
112
113 - `"auto"`
114
115 - `int`
116
117 - `compute_multiplier: Optional[Union[Literal["auto"], float, null]]`
118
119 Multiplier on amount of compute used for exploring search space during training.
120
121 - `Literal["auto"]`
122
123 - `"auto"`
124
125 - `float`
126
127 - `eval_interval: Optional[Union[Literal["auto"], int, null]]`
128
129 The number of training steps between evaluation runs.
130
131 - `Literal["auto"]`
132
133 - `"auto"`
134
135 - `int`
136
137 - `eval_samples: Optional[Union[Literal["auto"], int, null]]`
138
139 Number of evaluation samples to generate per training step.
140
141 - `Literal["auto"]`
142
143 - `"auto"`
144
145 - `int`
146
147 - `learning_rate_multiplier: Optional[Union[Literal["auto"], float, null]]`
148
149 Scaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
150
151 - `Literal["auto"]`
152
153 - `"auto"`
154
155 - `float`
156
157 - `n_epochs: Optional[Union[Literal["auto"], int, null]]`
158
159 The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
160
161 - `Literal["auto"]`
162
163 - `"auto"`
164
165 - `int`
166
167 - `reasoning_effort: Optional[Literal["default", "low", "medium", "high"]]`
168
169 Level of reasoning effort.
170
171 - `"default"`
172
173 - `"low"`
174
175 - `"medium"`
176
177 - `"high"`
178
179### Reinforcement Method
180
181- `class ReinforcementMethod: …`
182
183 Configuration for the reinforcement fine-tuning method.
184
185 - `grader: Grader`
186
187 The grader used for the fine-tuning job.
188
189 - `class StringCheckGrader: …`
190
191 A StringCheckGrader object that performs a string comparison between input and reference using a specified operation.
192
193 - `input: str`
194
195 The input text. This may include template strings.
196
197 - `name: str`
198
199 The name of the grader.
200
201 - `operation: Literal["eq", "ne", "like", "ilike"]`
202
203 The string check operation to perform. One of `eq`, `ne`, `like`, or `ilike`.
204
205 - `"eq"`
206
207 - `"ne"`
208
209 - `"like"`
210
211 - `"ilike"`
212
213 - `reference: str`
214
215 The reference text. This may include template strings.
216
217 - `type: Literal["string_check"]`
218
219 The object type, which is always `string_check`.
220
221 - `"string_check"`
222
223 - `class TextSimilarityGrader: …`
224
225 A TextSimilarityGrader object which grades text based on similarity metrics.
226
227 - `evaluation_metric: Literal["cosine", "fuzzy_match", "bleu", 8 more]`
228
229 The evaluation metric to use. One of `cosine`, `fuzzy_match`, `bleu`,
230 `gleu`, `meteor`, `rouge_1`, `rouge_2`, `rouge_3`, `rouge_4`, `rouge_5`,
231 or `rouge_l`.
232
233 - `"cosine"`
234
235 - `"fuzzy_match"`
236
237 - `"bleu"`
238
239 - `"gleu"`
240
241 - `"meteor"`
242
243 - `"rouge_1"`
244
245 - `"rouge_2"`
246
247 - `"rouge_3"`
248
249 - `"rouge_4"`
250
251 - `"rouge_5"`
252
253 - `"rouge_l"`
254
255 - `input: str`
256
257 The text being graded.
258
259 - `name: str`
260
261 The name of the grader.
262
263 - `reference: str`
264
265 The text being graded against.
266
267 - `type: Literal["text_similarity"]`
268
269 The type of grader.
270
271 - `"text_similarity"`
272
273 - `class PythonGrader: …`
274
275 A PythonGrader object that runs a python script on the input.
276
277 - `name: str`
278
279 The name of the grader.
280
281 - `source: str`
282
283 The source code of the python script.
284
285 - `type: Literal["python"]`
286
287 The object type, which is always `python`.
288
289 - `"python"`
290
291 - `image_tag: Optional[str]`
292
293 The image tag to use for the python script.
294
295 - `class ScoreModelGrader: …`
296
297 A ScoreModelGrader object that uses a model to assign a score to the input.
298
299 - `input: List[Input]`
300
301 The input messages evaluated by the grader. Supports text, output text, input image, and input audio content blocks, and may include template strings.
302
303 - `content: InputContent`
304
305 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.
306
307 - `str`
308
309 A text input to the model.
310
311 - `class ResponseInputText: …`
312
313 A text input to the model.
314
315 - `text: str`
316
317 The text input to the model.
318
319 - `type: Literal["input_text"]`
320
321 The type of the input item. Always `input_text`.
322
323 - `"input_text"`
324
325 - `prompt_cache_breakpoint: Optional[PromptCacheBreakpoint]`
326
327 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.
328
329 - `mode: Literal["explicit"]`
330
331 The breakpoint mode. Always `explicit`.
332
333 - `"explicit"`
334
335 - `class InputContentOutputText: …`
336
337 A text output from the model.
338
339 - `text: str`
340
341 The text output from the model.
342
343 - `type: Literal["output_text"]`
344
345 The type of the output text. Always `output_text`.
346
347 - `"output_text"`
348
349 - `class InputContentInputImage: …`
350
351 An image input block used within EvalItem content arrays.
352
353 - `image_url: str`
354
355 The URL of the image input.
356
357 - `type: Literal["input_image"]`
358
359 The type of the image input. Always `input_image`.
360
361 - `"input_image"`
362
363 - `detail: Optional[str]`
364
365 The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.
366
367 - `class ResponseInputAudio: …`
368
369 An audio input to the model.
370
371 - `input_audio: InputAudio`
372
373 - `data: str`
374
375 Base64-encoded audio data.
376
377 - `format: Literal["mp3", "wav"]`
378
379 The format of the audio data. Currently supported formats are `mp3` and
380 `wav`.
381
382 - `"mp3"`
383
384 - `"wav"`
385
386 - `type: Literal["input_audio"]`
387
388 The type of the input item. Always `input_audio`.
389
390 - `"input_audio"`
391
392 - `List[GraderInputItem]`
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 - `class GraderInputItemOutputText: …`
403
404 A text output from the model.
405
406 - `text: str`
407
408 The text output from the model.
409
410 - `type: Literal["output_text"]`
411
412 The type of the output text. Always `output_text`.
413
414 - `"output_text"`
415
416 - `class GraderInputItemInputImage: …`
417
418 An image input block used within EvalItem content arrays.
419
420 - `image_url: str`
421
422 The URL of the image input.
423
424 - `type: Literal["input_image"]`
425
426 The type of the image input. Always `input_image`.
427
428 - `"input_image"`
429
430 - `detail: Optional[str]`
431
432 The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.
433
434 - `class ResponseInputAudio: …`
435
436 An audio input to the model.
437
438 - `role: Literal["user", "assistant", "system", "developer"]`
439
440 The role of the message input. One of `user`, `assistant`, `system`, or
441 `developer`.
442
443 - `"user"`
444
445 - `"assistant"`
446
447 - `"system"`
448
449 - `"developer"`
450
451 - `type: Optional[Literal["message"]]`
452
453 The type of the message input. Always `message`.
454
455 - `"message"`
456
457 - `model: str`
458
459 The model to use for the evaluation.
460
461 - `name: str`
462
463 The name of the grader.
464
465 - `type: Literal["score_model"]`
466
467 The object type, which is always `score_model`.
468
469 - `"score_model"`
470
471 - `range: Optional[List[float]]`
472
473 The range of the score. Defaults to `[0, 1]`.
474
475 - `sampling_params: Optional[SamplingParams]`
476
477 The sampling parameters for the model.
478
479 - `max_completions_tokens: Optional[int]`
480
481 The maximum number of tokens the grader model may generate in its response.
482
483 - `reasoning_effort: Optional[ReasoningEffort]`
484
485 Constrains effort on reasoning for reasoning models. Currently supported
486 values are `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, and `max`.
487 Reducing reasoning effort can result in faster responses and fewer tokens
488 used on reasoning in a response. Not all reasoning models support every
489 value. See the
490 [reasoning guide](https://platform.openai.com/docs/guides/reasoning)
491 for model-specific support.
492
493 - `"none"`
494
495 - `"minimal"`
496
497 - `"low"`
498
499 - `"medium"`
500
501 - `"high"`
502
503 - `"xhigh"`
504
505 - `"max"`
506
507 - `seed: Optional[int]`
508
509 A seed value to initialize the randomness, during sampling.
510
511 - `temperature: Optional[float]`
512
513 A higher temperature increases randomness in the outputs.
514
515 - `top_p: Optional[float]`
516
517 An alternative to temperature for nucleus sampling; 1.0 includes all tokens.
518
519 - `class MultiGrader: …`
520
521 A MultiGrader object combines the output of multiple graders to produce a single score.
522
523 - `calculate_output: str`
524
525 A formula to calculate the output based on grader results.
526
527 - `graders: Graders`
528
529 A StringCheckGrader object that performs a string comparison between input and reference using a specified operation.
530
531 - `class StringCheckGrader: …`
532
533 A StringCheckGrader object that performs a string comparison between input and reference using a specified operation.
534
535 - `class TextSimilarityGrader: …`
536
537 A TextSimilarityGrader object which grades text based on similarity metrics.
538
539 - `class PythonGrader: …`
540
541 A PythonGrader object that runs a python script on the input.
542
543 - `class ScoreModelGrader: …`
544
545 A ScoreModelGrader object that uses a model to assign a score to the input.
546
547 - `class LabelModelGrader: …`
548
549 A LabelModelGrader object which uses a model to assign labels to each item
550 in the evaluation.
551
552 - `input: List[Input]`
553
554 - `content: InputContent`
555
556 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.
557
558 - `str`
559
560 A text input to the model.
561
562 - `class ResponseInputText: …`
563
564 A text input to the model.
565
566 - `class InputContentOutputText: …`
567
568 A text output from the model.
569
570 - `text: str`
571
572 The text output from the model.
573
574 - `type: Literal["output_text"]`
575
576 The type of the output text. Always `output_text`.
577
578 - `"output_text"`
579
580 - `class InputContentInputImage: …`
581
582 An image input block used within EvalItem content arrays.
583
584 - `image_url: str`
585
586 The URL of the image input.
587
588 - `type: Literal["input_image"]`
589
590 The type of the image input. Always `input_image`.
591
592 - `"input_image"`
593
594 - `detail: Optional[str]`
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 - `List[GraderInputItem]`
603
604 - `str`
605
606 A text input to the model.
607
608 - `class ResponseInputText: …`
609
610 A text input to the model.
611
612 - `class GraderInputItemOutputText: …`
613
614 A text output from the model.
615
616 - `class GraderInputItemInputImage: …`
617
618 An image input block used within EvalItem content arrays.
619
620 - `class ResponseInputAudio: …`
621
622 An audio input to the model.
623
624 - `role: Literal["user", "assistant", "system", "developer"]`
625
626 The role of the message input. One of `user`, `assistant`, `system`, or
627 `developer`.
628
629 - `"user"`
630
631 - `"assistant"`
632
633 - `"system"`
634
635 - `"developer"`
636
637 - `type: Optional[Literal["message"]]`
638
639 The type of the message input. Always `message`.
640
641 - `"message"`
642
643 - `labels: List[str]`
644
645 The labels to assign to each item in the evaluation.
646
647 - `model: str`
648
649 The model to use for the evaluation. Must support structured outputs.
650
651 - `name: str`
652
653 The name of the grader.
654
655 - `passing_labels: List[str]`
656
657 The labels that indicate a passing result. Must be a subset of labels.
658
659 - `type: Literal["label_model"]`
660
661 The object type, which is always `label_model`.
662
663 - `"label_model"`
664
665 - `name: str`
666
667 The name of the grader.
668
669 - `type: Literal["multi"]`
670
671 The object type, which is always `multi`.
672
673 - `"multi"`
674
675 - `hyperparameters: Optional[ReinforcementHyperparameters]`
676
677 The hyperparameters used for the reinforcement fine-tuning job.
678
679 - `batch_size: Optional[Union[Literal["auto"], int, null]]`
680
681 Number of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.
682
683 - `Literal["auto"]`
684
685 - `"auto"`
686
687 - `int`
688
689 - `compute_multiplier: Optional[Union[Literal["auto"], float, null]]`
690
691 Multiplier on amount of compute used for exploring search space during training.
692
693 - `Literal["auto"]`
694
695 - `"auto"`
696
697 - `float`
698
699 - `eval_interval: Optional[Union[Literal["auto"], int, null]]`
700
701 The number of training steps between evaluation runs.
702
703 - `Literal["auto"]`
704
705 - `"auto"`
706
707 - `int`
708
709 - `eval_samples: Optional[Union[Literal["auto"], int, null]]`
710
711 Number of evaluation samples to generate per training step.
712
713 - `Literal["auto"]`
714
715 - `"auto"`
716
717 - `int`
718
719 - `learning_rate_multiplier: Optional[Union[Literal["auto"], float, null]]`
720
721 Scaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
722
723 - `Literal["auto"]`
724
725 - `"auto"`
726
727 - `float`
728
729 - `n_epochs: Optional[Union[Literal["auto"], int, null]]`
730
731 The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
732
733 - `Literal["auto"]`
734
735 - `"auto"`
736
737 - `int`
738
739 - `reasoning_effort: Optional[Literal["default", "low", "medium", "high"]]`
740
741 Level of reasoning effort.
742
743 - `"default"`
744
745 - `"low"`
746
747 - `"medium"`
748
749 - `"high"`
750
751### Supervised Hyperparameters
752
753- `class SupervisedHyperparameters: …`
754
755 The hyperparameters used for the fine-tuning job.
756
757 - `batch_size: Optional[Union[Literal["auto"], int, null]]`
758
759 Number of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.
760
761 - `Literal["auto"]`
762
763 - `"auto"`
764
765 - `int`
766
767 - `learning_rate_multiplier: Optional[Union[Literal["auto"], float, null]]`
768
769 Scaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
770
771 - `Literal["auto"]`
772
773 - `"auto"`
774
775 - `float`
776
777 - `n_epochs: Optional[Union[Literal["auto"], int, null]]`
778
779 The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
780
781 - `Literal["auto"]`
782
783 - `"auto"`
784
785 - `int`
786
787### Supervised Method
788
789- `class SupervisedMethod: …`
790
791 Configuration for the supervised fine-tuning method.
792
793 - `hyperparameters: Optional[SupervisedHyperparameters]`
794
795 The hyperparameters used for the fine-tuning job.
796
797 - `batch_size: Optional[Union[Literal["auto"], int, null]]`
798
799 Number of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.
800
801 - `Literal["auto"]`
802
803 - `"auto"`
804
805 - `int`
806
807 - `learning_rate_multiplier: Optional[Union[Literal["auto"], float, null]]`
808
809 Scaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.
810
811 - `Literal["auto"]`
812
813 - `"auto"`
814
815 - `float`
816
817 - `n_epochs: Optional[Union[Literal["auto"], int, null]]`
818
819 The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
820
821 - `Literal["auto"]`
822
823 - `"auto"`
824
825 - `int`