Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

README.md

Models

Overview

Model Management API

Available Operations

list

List all models available to the user.

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.models.list()

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
provider OptionalNullable[str] N/A
model OptionalNullable[str] N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.ModelList

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.SDKError 4XX, 5XX */*

retrieve

Retrieve information about a model.

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.models.retrieve(model_id="ft:open-mistral-7b:587a6b29:20240514:7e773925")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description Example
model_id str ✔️ The ID of the model to retrieve. ft:open-mistral-7b:587a6b29:20240514:7e773925
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.ResponseRetrieveModelV1ModelsModelIDGet

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.SDKError 4XX, 5XX */*

delete

Delete a fine-tuned model.

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.models.delete(model_id="ft:open-mistral-7b:587a6b29:20240514:7e773925")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description Example
model_id str ✔️ The ID of the model to delete. ft:open-mistral-7b:587a6b29:20240514:7e773925
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.DeleteModelResponse

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.SDKError 4XX, 5XX */*

update

Update a model name or description.

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.models.update(model_id="ft:open-mistral-7b:587a6b29:20240514:7e773925")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description Example
model_id str ✔️ The ID of the model to update. ft:open-mistral-7b:587a6b29:20240514:7e773925
name OptionalNullable[str] N/A
description OptionalNullable[str] N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.JobsAPIRoutesFineTuningUpdateFineTunedModelResponse

Errors

Error Type Status Code Content Type
errors.SDKError 4XX, 5XX */*

archive

Archive a fine-tuned model.

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.models.archive(model_id="ft:open-mistral-7b:587a6b29:20240514:7e773925")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description Example
model_id str ✔️ The ID of the model to archive. ft:open-mistral-7b:587a6b29:20240514:7e773925
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.ArchiveModelResponse

Errors

Error Type Status Code Content Type
errors.SDKError 4XX, 5XX */*

unarchive

Un-archive a fine-tuned model.

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.models.unarchive(model_id="ft:open-mistral-7b:587a6b29:20240514:7e773925")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description Example
model_id str ✔️ The ID of the model to unarchive. ft:open-mistral-7b:587a6b29:20240514:7e773925
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.UnarchiveModelResponse

Errors

Error Type Status Code Content Type
errors.SDKError 4XX, 5XX */*