Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 添加删除精调作业和任务的管控接口 #874

Merged
merged 1 commit into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading