client. See Get started with the SDK.
Deletion methods
Delete fine-tuning jobs and projects over REST. See Delete fine-tuning jobs and projects for a worked example.
List your resources
Begin by listing the resource type you intend to remove. The list methods differ in shape. Some return a list directly. Others return a response object with the results underdata.
client.tools.list(), client.files.list(), client.data_jobs.list(), and client.projects.list() accept paging arguments. When a workspace holds more resources than one page returns, increase limit or request successive pages with offset.
client.data_jobs.list() also filters by job_type and sorts with sort_by and sort_order. See Manage data jobs.
Delete a single resource
Each delete method takes the resource ID.Delete in bulk
To remove several resources at once, filter a list call to the resources you want to delete, then iterate over the result. This example removes every tool whose name starts with a test prefix.Cancel compared with delete
Cancel and delete are different operations on fine-tuning jobs, and only one of them frees the job from your list.- Cancel – stops a job that is queued or in progress. The job remains in your list with a cancelled status, and its record and artifacts are retained. Use
client.fine_tuning.cancel(id). - Delete – removes the job record and its artifacts. A job in any state can be deleted, including one that finished or was cancelled.
client.data_jobs.cancel(data_job_id) stops an in-progress alignment run, and client.data_jobs.delete(data_job_id) removes the record.
Delete fine-tuning jobs and projects
Delete fine-tuning jobs and projects with a direct HTTP request to the REST endpoints. Deleting a project does not delete the fine-tuning jobs in it. The jobs are disassociated from the project and remain in your workspace. To remove them as well, delete the jobs first.204 No Content on success. The deleted job or project no longer appears in client.fine_tuning.list() or client.projects.list().
To remove all finished fine-tuning jobs from a workspace, list them with the SDK and delete them over REST.