18
18
19
19
def register (subparser : _SubParsersAction [ArgumentParser ]) -> None :
20
20
sub = subparser .add_parser ("fine_tuning.jobs.create" )
21
+ sub .add_argument (
22
+ "-m" ,
23
+ "--model" ,
24
+ help = "The model to fine-tune." ,
25
+ required = True ,
26
+ )
27
+ sub .add_argument (
28
+ "-F" ,
29
+ "--training-file" ,
30
+ help = "The training file to fine-tune the model on." ,
31
+ required = True ,
32
+ )
33
+ sub .add_argument (
34
+ "-s" ,
35
+ "--suffix" ,
36
+ help = "A suffix to add to the fine-tuned model name." ,
37
+ )
38
+ sub .add_argument (
39
+ "-V" ,
40
+ "--validation-file" ,
41
+ help = "The validation file to use for fine-tuning." ,
42
+ )
43
+ sub .set_defaults (
44
+ func = CLIFineTuningJobs .create , args_model = CLIFineTuningJobsCreateArgs
45
+ )
46
+
21
47
22
48
sub = subparser .add_parser ("fine_tuning.jobs.retrieve" )
23
49
sub .add_argument (
@@ -77,6 +103,11 @@ def register(subparser: _SubParsersAction[ArgumentParser]) -> None:
77
103
func = CLIFineTuningJobs .list_events , args_model = CLIFineTuningJobsListEventsArgs
78
104
)
79
105
106
+ class CLIFineTuningJobsCreateArgs (BaseModel ):
107
+ model : str
108
+ training_file : str
109
+ suffix : NotGivenOr [str ] = NOT_GIVEN
110
+ validation_file : NotGivenOr [str ] = NOT_GIVEN
80
111
81
112
class CLIFineTuningJobsRetrieveArgs (BaseModel ):
82
113
id : str
@@ -95,6 +126,16 @@ class CLIFineTuningJobsListEventsArgs(BaseModel):
95
126
96
127
97
128
class CLIFineTuningJobs :
129
+ @staticmethod
130
+ def create (args : CLIFineTuningJobsCreateArgs ) -> None :
131
+ fine_tuning_job : FineTuningJob = get_client ().fine_tuning .jobs .create (
132
+ model = args .model ,
133
+ training_file = args .training_file ,
134
+ suffix = args .suffix ,
135
+ validation_file = args .validation_file ,
136
+ )
137
+ print_model (fine_tuning_job )
138
+
98
139
@staticmethod
99
140
def retrieve (args : CLIFineTuningJobsRetrieveArgs ) -> None :
100
141
fine_tuning_job : FineTuningJob = get_client ().fine_tuning .jobs .retrieve (
0 commit comments