Model Management API
List all models available to the user.
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)
| Parameter | Type | Required | Description |
|---|
provider | OptionalNullable[str] | :heavy_minus_sign: | N/A |
model | OptionalNullable[str] | :heavy_minus_sign: | N/A |
retries | Optional[utils.RetryConfig] | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. |
models.ModelList
| Error Type | Status Code | Content Type |
|---|
| errors.HTTPValidationError | 422 | application/json |
| errors.SDKError | 4XX, 5XX | */* |
Retrieve information about a model.
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)
| Parameter | Type | Required | Description | Example |
|---|
model_id | str | :heavy_check_mark: | The ID of the model to retrieve. | ft:open-mistral-7b:587a6b29:20240514:7e773925 |
retries | Optional[utils.RetryConfig] | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | |
models.ResponseRetrieveModelV1ModelsModelIDGet
| Error Type | Status Code | Content Type |
|---|
| errors.HTTPValidationError | 422 | application/json |
| errors.SDKError | 4XX, 5XX | */* |
Delete a fine-tuned model.
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)
| Parameter | Type | Required | Description | Example |
|---|
model_id | str | :heavy_check_mark: | The ID of the model to delete. | ft:open-mistral-7b:587a6b29:20240514:7e773925 |
retries | Optional[utils.RetryConfig] | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | |
models.DeleteModelResponse
| Error Type | Status Code | Content Type |
|---|
| errors.HTTPValidationError | 422 | application/json |
| errors.SDKError | 4XX, 5XX | */* |
Update a model name or description.
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)
| Parameter | Type | Required | Description | Example |
|---|
model_id | str | :heavy_check_mark: | The ID of the model to update. | ft:open-mistral-7b:587a6b29:20240514:7e773925 |
name | OptionalNullable[str] | :heavy_minus_sign: | N/A | |
description | OptionalNullable[str] | :heavy_minus_sign: | N/A | |
retries | Optional[utils.RetryConfig] | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | |
models.JobsAPIRoutesFineTuningUpdateFineTunedModelResponse
| Error Type | Status Code | Content Type |
|---|
| errors.SDKError | 4XX, 5XX | */* |
Archive a fine-tuned model.
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)
| Parameter | Type | Required | Description | Example |
|---|
model_id | str | :heavy_check_mark: | The ID of the model to archive. | ft:open-mistral-7b:587a6b29:20240514:7e773925 |
retries | Optional[utils.RetryConfig] | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | |
models.ArchiveModelResponse
| Error Type | Status Code | Content Type |
|---|
| errors.SDKError | 4XX, 5XX | */* |
Un-archive a fine-tuned model.
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)
| Parameter | Type | Required | Description | Example |
|---|
model_id | str | :heavy_check_mark: | The ID of the model to unarchive. | ft:open-mistral-7b:587a6b29:20240514:7e773925 |
retries | Optional[utils.RetryConfig] | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | |
models.UnarchiveModelResponse
| Error Type | Status Code | Content Type |
|---|
| errors.SDKError | 4XX, 5XX | */* |