Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Mistralai Client python Models And Files Management

From Leeroopedia
Revision as of 13:15, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/Mistralai_Client_python_Models_And_Files_Management.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Knowledge Sources
Domains Fine_Tuning, Resource_Management
Last Updated 2026-02-15 14:00 GMT

Overview

Concrete tool for listing/retrieving models and deleting files provided by the Models and Files SDK resources.

Description

Models.list() returns all available models. Models.retrieve(model_id=...) returns detailed information about a specific model. Files.delete(file_id=...) permanently deletes an uploaded file. All methods have async variants.

Usage

Access via client.models.list(), client.models.retrieve(), and client.files.delete().

Code Reference

Source Location

  • Repository: client-python
  • File: src/mistralai/client/models_.py (L15-249), src/mistralai/client/files.py (L604-770)

Signature

class Models:
    def list(self) -> ModelList: ...
    async def list_async(self) -> ModelList: ...
    def retrieve(self, *, model_id: str) -> ResponseRetrieveModelV1ModelsModelIDGet: ...
    async def retrieve_async(self, *, model_id: str) -> ResponseRetrieveModelV1ModelsModelIDGet: ...

class Files:
    def delete(self, *, file_id: str) -> DeleteFileOut: ...
    async def delete_async(self, *, file_id: str) -> DeleteFileOut: ...

Import

from mistralai import Mistral
# Access via: client.models.list(), client.models.retrieve(), client.files.delete()

I/O Contract

Inputs

Name Type Required Description
model_id (retrieve) str Yes Model ID to retrieve
file_id (delete) str Yes File ID to delete

Outputs

Name Type Description
ModelList (list) ModelList All available models
Model details (retrieve) Response Detailed model info
DeleteFileOut (delete) DeleteFileOut Confirmation with id and deleted flag

Usage Examples

List and Clean Up

from mistralai import Mistral

client = Mistral(api_key="your-key")

# List all models
models = client.models.list()
for model in models.data:
    print(f"{model.id}: {model.object}")

# Retrieve a specific model
model = client.models.retrieve(model_id="ft:open-mistral-7b:my-model:abc123")
print(f"Model: {model.id}")

# Delete training file
result = client.files.delete(file_id="file-abc123")
print(f"Deleted: {result.deleted}")

Related Pages

Implements Principle

Requires Environment

Uses Heuristic

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment