Skip to content

Commit

Permalink
feat: 添加删除精调作业和任务的管控接口 (#874)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dobiichi-Origami authored Nov 21, 2024
1 parent d585e79 commit 5d59bef
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
2 changes: 2 additions & 0 deletions python/qianfan/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ class Consts:
FineTuneTaskDetailAction: str = "DescribeFineTuningTask"
FineTuneStopTaskAction: str = "StopFineTuningTask"
FineTuneSupportedModelsAction: str = "DescribeFineTuningSupportModels"
FineTuneDeleteTaskAction: str = "DeleteFineTuningTask"
FineTuneDeleteJobAction: str = "DeleteFineTuningJob"
ModelV2BaseRouteAPI: str = "/v2/model"
ModelCreateCustomModelSetAction: str = "CreateCustomModelSet"
ModelDescribeSystemModelSetsAction: str = "DescribeSystemModelSets"
Expand Down
64 changes: 64 additions & 0 deletions python/qianfan/resources/console/finetune.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,70 @@ def stop_task(
}
return req

@classmethod
@console_api_request
def delete_task(
cls,
task_id: str,
**kwargs: Any,
) -> QfRequest:
"""
delete the fine-tune task
Parameters:
task_id: str
task_id of the task.
kwargs:
Additional keyword arguments that can be passed to customize
the request.
Note:
The `@console_api_request` decorator is applied to this method, enabling
it to send the generated QfRequest and return a QfResponse to the user.
"""
req = QfRequest(
method="POST",
url=cls.base_api_route(),
query=_get_console_v2_query(Consts.FineTuneDeleteTaskAction),
)
req.json_body = {
**kwargs,
"taskId": task_id,
}
return req

@classmethod
@console_api_request
def delete_job(
cls,
job_id: str,
**kwargs: Any,
) -> QfRequest:
"""
delete the fine-tune job
Parameters:
job_id: str
job_id of the job.
kwargs:
Additional keyword arguments that can be passed to customize
the request.
Note:
The `@console_api_request` decorator is applied to this method, enabling
it to send the generated QfRequest and return a QfResponse to the user.
"""
req = QfRequest(
method="POST",
url=cls.base_api_route(),
query=_get_console_v2_query(Consts.FineTuneDeleteJobAction),
)
req.json_body = {
**kwargs,
"jobId": job_id,
}
return req

@classmethod
@console_api_request
def supported_models(cls, **kwargs: Any) -> QfRequest:
Expand Down

0 comments on commit 5d59bef

Please sign in to comment.