9
9
from ....pagination import SyncCursorPage
10
10
from ....types .fine_tuning import (
11
11
FineTuningJob ,
12
+ FineTuningJobEvent ,
12
13
)
13
14
14
15
if TYPE_CHECKING :
@@ -55,6 +56,26 @@ def register(subparser: _SubParsersAction[ArgumentParser]) -> None:
55
56
)
56
57
57
58
sub = subparser .add_parser ("fine_tuning.jobs.list_events" )
59
+ sub .add_argument (
60
+ "-i" ,
61
+ "--id" ,
62
+ help = "The ID of the fine-tuning job to list events for." ,
63
+ required = True ,
64
+ )
65
+ sub .add_argument (
66
+ "-a" ,
67
+ "--after" ,
68
+ help = "Identifier for the last event from the previous pagination request. If provided, only events created after this event will be returned." ,
69
+ )
70
+ sub .add_argument (
71
+ "-l" ,
72
+ "--limit" ,
73
+ help = "Number of fine-tuning job events to retrieve." ,
74
+ type = int ,
75
+ )
76
+ sub .set_defaults (
77
+ func = CLIFineTuningJobs .list_events , args_model = CLIFineTuningJobsListEventsArgs
78
+ )
58
79
59
80
60
81
class CLIFineTuningJobsRetrieveArgs (BaseModel ):
@@ -67,6 +88,12 @@ class CLIFineTuningJobsListArgs(BaseModel):
67
88
class CLIFineTuningJobsCancelArgs (BaseModel ):
68
89
id : str
69
90
91
+ class CLIFineTuningJobsListEventsArgs (BaseModel ):
92
+ id : str
93
+ after : NotGivenOr [str ] = NOT_GIVEN
94
+ limit : NotGivenOr [int ] = NOT_GIVEN
95
+
96
+
70
97
class CLIFineTuningJobs :
71
98
@staticmethod
72
99
def retrieve (args : CLIFineTuningJobsRetrieveArgs ) -> None :
@@ -89,4 +116,15 @@ def cancel(args: CLIFineTuningJobsCancelArgs) -> None:
89
116
fine_tuning_job : FineTuningJob = get_client ().fine_tuning .jobs .cancel (
90
117
fine_tuning_job_id = args .id
91
118
)
92
- print_model (fine_tuning_job )
119
+ print_model (fine_tuning_job )
120
+
121
+ @staticmethod
122
+ def list_events (args : CLIFineTuningJobsListEventsArgs ) -> None :
123
+ fine_tuning_job_events : SyncCursorPage [
124
+ FineTuningJobEvent
125
+ ] = get_client ().fine_tuning .jobs .list_events (
126
+ fine_tuning_job_id = args .id ,
127
+ after = args .after or NOT_GIVEN ,
128
+ limit = args .limit or NOT_GIVEN ,
129
+ )
130
+ print_model (fine_tuning_job_events )
0 commit comments