|
13 | 13 | CosineLRScheduler, |
14 | 14 | CosineLRSchedulerArgs, |
15 | 15 | FinetuneCheckpoint, |
| 16 | + FinetuneDeleteResponse, |
16 | 17 | FinetuneDownloadResult, |
17 | 18 | FinetuneList, |
18 | 19 | FinetuneListEvents, |
@@ -570,6 +571,37 @@ def cancel(self, id: str) -> FinetuneResponse: |
570 | 571 |
|
571 | 572 | return FinetuneResponse(**response.data) |
572 | 573 |
|
| 574 | + def delete(self, id: str, force: bool = False) -> FinetuneDeleteResponse: |
| 575 | + """ |
| 576 | + Method to delete a fine-tuning job |
| 577 | +
|
| 578 | + Args: |
| 579 | + id (str): Fine-tune ID to delete. A string that starts with `ft-`. |
| 580 | + force (bool, optional): Force deletion. Defaults to False. |
| 581 | +
|
| 582 | + Returns: |
| 583 | + FinetuneDeleteResponse: Object containing deletion confirmation message. |
| 584 | + """ |
| 585 | + |
| 586 | + requestor = api_requestor.APIRequestor( |
| 587 | + client=self._client, |
| 588 | + ) |
| 589 | + |
| 590 | + params = {"force": str(force).lower()} |
| 591 | + |
| 592 | + response, _, _ = requestor.request( |
| 593 | + options=TogetherRequest( |
| 594 | + method="DELETE", |
| 595 | + url=f"fine-tunes/{id}", |
| 596 | + params=params, |
| 597 | + ), |
| 598 | + stream=False, |
| 599 | + ) |
| 600 | + |
| 601 | + assert isinstance(response, TogetherResponse) |
| 602 | + |
| 603 | + return FinetuneDeleteResponse(**response.data) |
| 604 | + |
573 | 605 | def list_events(self, id: str) -> FinetuneListEvents: |
574 | 606 | """ |
575 | 607 | Lists events of a fine-tune job |
@@ -1007,6 +1039,37 @@ async def cancel(self, id: str) -> FinetuneResponse: |
1007 | 1039 |
|
1008 | 1040 | return FinetuneResponse(**response.data) |
1009 | 1041 |
|
| 1042 | + async def delete(self, id: str, force: bool = False) -> FinetuneDeleteResponse: |
| 1043 | + """ |
| 1044 | + Async method to delete a fine-tuning job |
| 1045 | +
|
| 1046 | + Args: |
| 1047 | + id (str): Fine-tune ID to delete. A string that starts with `ft-`. |
| 1048 | + force (bool, optional): Force deletion. Defaults to False. |
| 1049 | +
|
| 1050 | + Returns: |
| 1051 | + FinetuneDeleteResponse: Object containing deletion confirmation message. |
| 1052 | + """ |
| 1053 | + |
| 1054 | + requestor = api_requestor.APIRequestor( |
| 1055 | + client=self._client, |
| 1056 | + ) |
| 1057 | + |
| 1058 | + params = {"force": str(force).lower()} |
| 1059 | + |
| 1060 | + response, _, _ = await requestor.arequest( |
| 1061 | + options=TogetherRequest( |
| 1062 | + method="DELETE", |
| 1063 | + url=f"fine-tunes/{id}", |
| 1064 | + params=params, |
| 1065 | + ), |
| 1066 | + stream=False, |
| 1067 | + ) |
| 1068 | + |
| 1069 | + assert isinstance(response, TogetherResponse) |
| 1070 | + |
| 1071 | + return FinetuneDeleteResponse(**response.data) |
| 1072 | + |
1010 | 1073 | async def list_events(self, id: str) -> FinetuneListEvents: |
1011 | 1074 | """ |
1012 | 1075 | List fine-tuning events |
|
0 commit comments