(fine_tuning.jobs)
- list - Get Fine Tuning Jobs
- create - Create Fine Tuning Job
- get - Get Fine Tuning Job
- cancel - Cancel Fine Tuning Job
- start - Start Fine Tuning Job
Get a list of fine-tuning jobs for your organization and user.
from mistralai import Mistral
import os
with Mistral(
api_key=os.getenv("MISTRAL_API_KEY", ""),
) as s:
res = s.fine_tuning.jobs.list()
if res is not None:
# handle response
pass
Parameter |
Type |
Required |
Description |
page |
Optional[int] |
➖ |
The page number of the results to be returned. |
page_size |
Optional[int] |
➖ |
The number of items to return per page. |
model |
OptionalNullable[str] |
➖ |
The model name used for fine-tuning to filter on. When set, the other results are not displayed. |
created_after |
date |
➖ |
The date/time to filter on. When set, the results for previous creation times are not displayed. |
created_by_me |
Optional[bool] |
➖ |
When set, only return results for jobs created by the API caller. Other results are not displayed. |
status |
OptionalNullable[models.QueryParamStatus] |
➖ |
The current job state to filter on. When set, the other results are not displayed. |
wandb_project |
OptionalNullable[str] |
➖ |
The Weights and Biases project to filter on. When set, the other results are not displayed. |
wandb_name |
OptionalNullable[str] |
➖ |
The Weight and Biases run name to filter on. When set, the other results are not displayed. |
suffix |
OptionalNullable[str] |
➖ |
The model suffix to filter on. When set, the other results are not displayed. |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.JobsOut
Error Type |
Status Code |
Content Type |
models.SDKError |
4XX, 5XX |
*/* |
Create a new fine-tuning job, it will be queued for processing.
from mistralai import Mistral
import os
with Mistral(
api_key=os.getenv("MISTRAL_API_KEY", ""),
) as s:
res = s.fine_tuning.jobs.create(model="codestral-latest", hyperparameters={})
if res is not None:
# handle response
pass
Parameter |
Type |
Required |
Description |
model |
str |
✔️ |
The name of the model to fine-tune. |
hyperparameters |
models.TrainingParametersIn |
✔️ |
The fine-tuning hyperparameter settings used in a fine-tune job. |
training_files |
List[models.TrainingFile] |
➖ |
N/A |
validation_files |
List[str] |
➖ |
A list containing the IDs of uploaded files that contain validation data. If you provide these files, the data is used to generate validation metrics periodically during fine-tuning. These metrics can be viewed in checkpoints when getting the status of a running fine-tuning job. The same data should not be present in both train and validation files. |
suffix |
OptionalNullable[str] |
➖ |
A string that will be added to your fine-tuning model name. For example, a suffix of "my-great-model" would produce a model name like ft:open-mistral-7b:my-great-model:xxx... |
integrations |
List[models.JobInIntegrations] |
➖ |
A list of integrations to enable for your fine-tuning job. |
repositories |
List[models.JobInRepositories] |
➖ |
N/A |
auto_start |
Optional[bool] |
➖ |
This field will be required in a future release. |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.JobsAPIRoutesFineTuningCreateFineTuningJobResponse
Error Type |
Status Code |
Content Type |
models.SDKError |
4XX, 5XX |
*/* |
Get a fine-tuned job details by its UUID.
from mistralai import Mistral
import os
with Mistral(
api_key=os.getenv("MISTRAL_API_KEY", ""),
) as s:
res = s.fine_tuning.jobs.get(job_id="b18d8d81-fd7b-4764-a31e-475cb1f36591")
if res is not None:
# handle response
pass
Parameter |
Type |
Required |
Description |
job_id |
str |
✔️ |
The ID of the job to analyse. |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.DetailedJobOut
Error Type |
Status Code |
Content Type |
models.SDKError |
4XX, 5XX |
*/* |
Request the cancellation of a fine tuning job.
from mistralai import Mistral
import os
with Mistral(
api_key=os.getenv("MISTRAL_API_KEY", ""),
) as s:
res = s.fine_tuning.jobs.cancel(job_id="03fa7112-315a-4072-a9f2-43f3f1ec962e")
if res is not None:
# handle response
pass
Parameter |
Type |
Required |
Description |
job_id |
str |
✔️ |
The ID of the job to cancel. |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.DetailedJobOut
Error Type |
Status Code |
Content Type |
models.SDKError |
4XX, 5XX |
*/* |
Request the start of a validated fine tuning job.
from mistralai import Mistral
import os
with Mistral(
api_key=os.getenv("MISTRAL_API_KEY", ""),
) as s:
res = s.fine_tuning.jobs.start(job_id="0eb0f807-fb9f-4e46-9c13-4e257df6e1ba")
if res is not None:
# handle response
pass
Parameter |
Type |
Required |
Description |
job_id |
str |
✔️ |
N/A |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.DetailedJobOut
Error Type |
Status Code |
Content Type |
models.SDKError |
4XX, 5XX |
*/* |