File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed
Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -72,6 +72,22 @@ def list_batches(self) -> List[BatchJob]:
7272 jobs = response .data or []
7373 return [BatchJob (** job ) for job in jobs ]
7474
75+ def cancel_batch (self , batch_job_id : str ) -> BatchJob :
76+ requestor = api_requestor .APIRequestor (
77+ client = self ._client ,
78+ )
79+
80+ response , _ , _ = requestor .request (
81+ options = TogetherRequest (
82+ method = "POST" ,
83+ url = f"batches/{ batch_job_id } /cancel" ,
84+ ),
85+ stream = False ,
86+ )
87+
88+ assert isinstance (response , TogetherResponse )
89+ return BatchJob (** response .data )
90+
7591
7692class AsyncBatches :
7793 def __init__ (self , client : TogetherClient ) -> None :
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ class BatchJobStatus(str, Enum):
2020 FAILED = "FAILED"
2121 EXPIRED = "EXPIRED"
2222 CANCELLED = "CANCELLED"
23+ CANCELING = "CANCELING"
2324
2425
2526class BatchEndpoint (str , Enum ):
You can’t perform that action at this time.
0 commit comments